Advertisement
Dekita

pkore beta 2

Dec 24th, 2012
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.17 KB | None | 0 0
  1. =begin =========================================================================
  2. Dekita's v1.0
  3. ★ Pokémon CORE™ ★
  4.  
  5. ================================================================================
  6. Script Information:
  7. ====================
  8. This is simply a "core" script to house some things ill need for some other
  9. pokemon related scripts i will do.
  10.  
  11. The following scripts require this and should be placed below this script.
  12.  
  13. Pokemon Capture,
  14. Pokemon Evolution,
  15.  
  16. This script creates the following features
  17.  
  18. ACTORS: (and enemies)
  19. weight,
  20. gender,
  21. types,
  22. species,
  23. generation_id,
  24. legendary,
  25.  
  26. ================================================================================
  27. ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
  28. ================================================================================
  29. 1. You must give credit to "Dekita"
  30. 2. You are NOT allowed to repost this script.(or modified versions)
  31. 3. You are NOT allowed to convert this script.(into other game engines e.g RGSS2)
  32. 4. You are NOT allowed to use this script for Commercial games.
  33. 5. ENJOY!
  34.  
  35. "FINE PRINT"
  36. By using this script you hereby agree to the above terms and conditions,
  37. if any violation of the above terms occurs "legal action" may be taken.
  38. Not understanding the above terms and conditions does NOT mean that
  39. they do not apply to you.
  40. If you wish to discuss the terms and conditions in further detail you can
  41. contact me at http://dekitarpg.wordpress.com/ or DekitaRPG@gmail.com
  42.  
  43. ================================================================================
  44. History:
  45. =========
  46. D /M /Y
  47. 24/12/2o12 - released beta version,
  48. 13/11/2012 - started,
  49.  
  50. ================================================================================
  51. Known Bugs:
  52. ============
  53. N/A
  54.  
  55. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  56. If a new bug is found please contact me at
  57. http://dekitarpg.wordpress.com/
  58.  
  59. ================================================================================
  60. INSTRUCTIONS:
  61. ==============
  62. Place this script UNDER "▼ Materials" and ABOVE "▼ Main" in your script editor.
  63. Place this above other pokemon scripts i have written
  64.  
  65. =end #==========================================================================#
  66.  
  67. module Dekita__Pokémon_CORE
  68. # NOTETAG LIST :~
  69.  
  70. # <weight: X>
  71.  
  72.  
  73. # <gender: X>
  74. # Where X is the percentage chance for a male actor. (can be a float value)
  75.  
  76.  
  77. # <species: X>
  78.  
  79.  
  80. # <legendary>
  81. # just give this notetag to a legendary enemy.
  82.  
  83. # <gen id: X>
  84. # X = 1 - 5
  85.  
  86.  
  87. Main_Pokeball_Item_id = 1 # The id of your main pokeball item
  88. # this can be found in the database.
  89.  
  90. p "Loaded : Pokemon Core"
  91. end
  92.  
  93.  
  94. module PkMn_Types
  95.  
  96. # These are the id tags for each type, use the notetag like this...
  97. # <type: TYPE_ONE, TYPE_TWO>
  98. # replace TYPE_ONE and TYPE_TWO with the id number for the type you want..
  99. # e.g if you want water and dark type it would be
  100. # <type: 3, 16>
  101. # if you only want one type put "nil" in place of the id number... like so...
  102. # <type: 3, nil>
  103. # This notetag is for actors && enemies
  104.  
  105. # PLEASE NOTE YOU !> MUST <! PUT IN THE TYPES IN ORDER E.G <type: 16, 3>
  106. # WOULD NOT BE ACCEPTED !!
  107.  
  108. # <type: TYPE_ID>
  109. # use this notetag for skills, ( they can have only one type )
  110.  
  111. Types = []
  112. # DO NOT USE "Types[0]"
  113. Types[1] = "Normal"
  114. Types[2] = "Fire"
  115. Types[3] = "Water"
  116. Types[4] = "Electric"
  117. Types[5] = "Grass"
  118. Types[6] = "Ice"
  119. Types[7] = "Fighting"
  120. Types[8] = "Poison"
  121. Types[9] = "Ground"
  122. Types[10]= "Flying"
  123. Types[11]= "Psychic"
  124. Types[12]= "Bug"
  125. Types[13]= "Rock"
  126. Types[14]= "Ghost"
  127. Types[15]= "Dragon"
  128. Types[16]= "Dark"
  129. Types[17]= "Steel"
  130.  
  131. # End Types Config.
  132. end
  133.  
  134. $imported = {} if $imported.nil?
  135. $imported[:Dekita__Pokémon_CORE] = true
  136.  
  137. #==============================================================================
  138. module DataManager
  139. #==============================================================================
  140.  
  141. class <<self; alias load_database_Poké_CORE load_database; end
  142. def self.load_database
  143. load_database_Poké_CORE
  144. load_Poké_CORE
  145. end
  146.  
  147. def self.load_Poké_CORE
  148. groups = [$data_actors, $data_enemies, $data_skills]
  149. for group in groups
  150. for obj in group
  151. next if obj.nil?
  152. obj.load_Poké_CORE
  153. end
  154. end
  155. end
  156.  
  157. end # DataManager
  158.  
  159. #==============================================================================
  160. class RPG::UsableItem < RPG::BaseItem
  161. #==============================================================================
  162.  
  163. attr_accessor :type
  164.  
  165. def load_Poké_CORE
  166. @type = [nil , nil]
  167. load_Poké_CORE_Notes
  168. end
  169.  
  170. def load_Poké_CORE_Notes
  171. # @type = [0, 0]
  172. self.note.split(/[\r\n]+/).each { |line|
  173. case line
  174. when /<type: (.*)>/i
  175. @type = [PkMn_Types::Types[$1.to_i], nil]
  176. #---
  177. when /<type: (.*), (.*)>/i
  178. @type = [PkMn_Types::Types[$1.to_i], PkMn_Types::Types[$2.to_i]]
  179. #---
  180. end
  181. } # self.note.split
  182. #---
  183. end
  184.  
  185. end
  186.  
  187. #==============================================================================
  188. class RPG::Actor < RPG::BaseItem
  189. #==============================================================================
  190.  
  191. attr_accessor :pokemon_database_id
  192. attr_accessor :gender_ratio
  193. attr_accessor :type
  194. attr_accessor :species
  195. attr_accessor :weight
  196. attr_accessor :legendary
  197. attr_accessor :generation_id
  198. #attr_accessor :pokemons_pokeball
  199.  
  200.  
  201. def load_Poké_CORE
  202. @pokemon_database_id = @id
  203. @type = [nil , nil]
  204. @gender_ratio = [nil]
  205. @species = ""
  206. @weight = 0.0
  207. @legendary = false
  208. @generation_id = nil
  209. # @pokemons_pokeball = $data_items[Dekita__Pokémon_CORE::Main_Pokeball_Item_id].name
  210. load_Poké_CORE_Notes
  211. end
  212.  
  213. def load_Poké_CORE_Notes
  214. self.note.split(/[\r\n]+/).each { |line|
  215. case line
  216. when /<gender: (.*)>/i
  217. @gender_ratio[0] = $1.to_f
  218. #---
  219. when /<weight: (.*)>/i
  220. @weight = $1.to_f
  221. #---
  222. when /<species: (.*)>/i
  223. @species = $1.to_s
  224. #---
  225. when /<legendary>/i
  226. @legendary = true
  227. #---
  228. when /<gen id: (.*)>/i
  229. @generation_id = $1.to_i
  230. #---
  231. when /<type: (.*), (.*)>/i
  232. @type = [PkMn_Types::Types[$1.to_i], PkMn_Types::Types[$2.to_i]]
  233. #---
  234. end
  235. } # self.note.split
  236. #---
  237. end
  238.  
  239. end # RPG::Actor
  240.  
  241. #==============================================================================
  242. class RPG::Enemy < RPG::BaseItem
  243. #==============================================================================
  244.  
  245. #attr_accessor :pokemon_id
  246. #attr_accessor :catch_rate
  247. #attr_accessor :pokemon_database_id
  248.  
  249. attr_accessor :gender
  250. attr_accessor :type
  251. attr_accessor :species
  252. attr_accessor :weight
  253. attr_accessor :legendary
  254. attr_accessor :generation_id
  255.  
  256. def load_Poké_CORE
  257. @pokemon_database_id = @id
  258. @type = [nil , nil]
  259. @gender = [nil]
  260. @species = ""
  261. @weight = 0.0
  262. @legendary = false
  263. @generation_id = nil
  264. load_Poké_CORE_Notes
  265. end
  266.  
  267. def load_Poké_CORE_Notes
  268. self.note.split(/[\r\n]+/).each { |line|
  269. case line
  270. when /<gender: (.*)>/i
  271. @gender_ratio[0] = $1.to_f
  272. #---
  273. when /<weight: (.*)>/i
  274. @weight = $1.to_f
  275. #---
  276. when /<species: (.*)>/i
  277. @species = $1.to_s
  278. #---
  279. when /<legendary>/i
  280. @legendary = true
  281. #---
  282. when /<gen id: (.*)>/i
  283. @generation_id = $1.to_i
  284. #---
  285. when /<type: (.*), (.*)>/i
  286. @type = [PkMn_Types::Types[$1.to_i], PkMn_Types::Types[$2.to_i]]
  287. #---
  288. end
  289. } # self.note.split
  290. #---
  291. end
  292.  
  293. end # RPG::Enemy
  294.  
  295. #==============================================================================
  296. class Game_Actor < Game_Battler
  297. #==============================================================================
  298.  
  299. attr_accessor :pokemons_pokeball
  300. attr_accessor :pokemon_captured
  301. attr_accessor :pokemon_team
  302.  
  303. attr_reader :pokemon_database_id
  304. attr_reader :gender
  305. attr_reader :type
  306. attr_reader :species
  307. attr_reader :weight
  308. attr_reader :legendary
  309. attr_reader :generation_id
  310. attr_reader :trainer_id
  311. attr_reader :real_game_id
  312.  
  313.  
  314. alias Poké_CORE_A_GO_GO setup
  315. def setup(actor_id)
  316. Poké_CORE_A_GO_GO(actor_id)
  317. setup_pokemon_system_by_Dekita_RPG
  318. end
  319.  
  320. def setup_pokemon_system_by_Dekita_RPG
  321. @pokemon_database_id = actor.pokemon_database_id
  322. @gender = get_unique_gender
  323. @species = actor.species
  324. @weight = actor.weight
  325. @type = actor.type
  326. @legendary = actor.legendary
  327. @generation_id = actor.generation_id
  328. @trainer_id = rand(999_99)
  329. @pokemons_pokeball = $data_items[Dekita__Pokémon_CORE::Main_Pokeball_Item_id]
  330. @real_game_id = actor.id
  331. @pokemon_captured = 0
  332. init_poketeam
  333. end
  334.  
  335. def get_unique_gender
  336. sex = rand(100+1)
  337. g = actor.gender_ratio
  338. return "" if g[0].nil?
  339. sex <= g[0] ? @gender = "male" : @gender = "female"
  340. end
  341.  
  342. def init_poketeam
  343. @pokemon_team = []# * 6
  344. end
  345.  
  346. def add_pokemon_into_team(pokemon)
  347. if @pokemon_team.size <= 5
  348. @pokemon_team.push($game_actors[pokemon])
  349. else
  350. end
  351. new_poke = gained_new_pokemon?($game_actors[pokemon].pokemon_database_id)
  352. @pokemon_captured += 1 if new_poke
  353. end
  354.  
  355. def remove_pokemon_from_team(pokemon)
  356. @pokemon_team.delete_at(pokemon)
  357. end
  358.  
  359. def gained_new_pokemon?(poke_id)
  360. istrue = 0
  361. $game_party.members.size.times{|i|
  362. istrue += 1 if $game_party.members[i].pokemon_database_id == poke_id
  363. }
  364. return false if istrue > 1
  365. return true
  366. end
  367.  
  368. end
  369.  
  370. #===============================================================================#
  371. class Game_Enemy < Game_Battler
  372. #===============================================================================#
  373.  
  374. # attr_reader :gender
  375. # attr_reader :species
  376. # attr_reader :weight
  377. # attr_reader :type
  378. # attr_reader :legendary
  379. # attr_reader :generation_id
  380. attr_accessor :gender
  381. attr_accessor :type
  382. attr_accessor :species
  383. attr_accessor :weight
  384. attr_accessor :legendary
  385. attr_accessor :generation_id
  386.  
  387.  
  388. alias genderinitfoene initialize
  389. def initialize(index, enemy_id)
  390. genderinitfoene(index, enemy_id)
  391. dekita_pokemon_core_script_enemy_init(enemy_id)
  392. end
  393.  
  394. def dekita_pokemon_core_script_enemy_init(enemy_id)
  395. @gender = get_unique_gender
  396. @species = $data_enemies[enemy_id].species
  397. @weight = $data_enemies[enemy_id].weight
  398. @type = $data_enemies[enemy_id].type
  399. @legendary = $data_enemies[enemy_id].legendary
  400. @generation_id = $data_enemies[enemy_id].generation_id
  401. end
  402.  
  403. def get_unique_gender
  404. sex = rand(100+1)
  405. g = $data_enemies[enemy_id].gender
  406. return "" if g[0].nil?
  407. sex <= g[0] ? @gender = "male" : @gender = "female"
  408. end
  409.  
  410. end
  411.  
  412. #==============================================================================
  413. class Game_System
  414. #==============================================================================
  415.  
  416. attr_accessor :night_time
  417.  
  418. alias :init_for_the_shit_of_it :initialize
  419. def initialize
  420. init_for_the_shit_of_it
  421. @night_time = false
  422. end
  423.  
  424. end
  425.  
  426. #==============================================================================
  427. class Game_Party < Game_Unit
  428. #==============================================================================
  429.  
  430. attr_accessor :fishing
  431. attr_accessor :diving
  432. attr_accessor :surfing
  433. attr_accessor :in_cave
  434.  
  435. alias fishinginitforpoek initialize
  436. def initialize
  437. fishinginitforpoek
  438. @fishing = false
  439. @diving = false
  440. @surfing = false
  441. @in_cave = false
  442. end
  443.  
  444. def add_pokemon(actor_id, level)
  445. new_actor = $data_actors[actor_id].clone
  446. new_actor.id = $data_actors.size
  447. $data_actors.push(new_actor)
  448. @actors.push(new_actor.id) unless @actors.include?(new_actor.id)
  449. $game_player.refresh
  450. $game_map.need_refresh = true
  451. get_initial_stats(new_actor.id, level)
  452. get_pokeball_aftermod(new_actor.id)
  453. end
  454.  
  455. def get_initial_stats(actor_id, level)
  456. _GA = $game_actors[actor_id]
  457. _GA.change_level(level, false)
  458. _GA.recover_all
  459. _GA.capt_inf[5] = _GA.level
  460. $game_party.members[0].add_pokemon_into_team(actor_id)
  461. end
  462.  
  463. def remove_pokemon(poke_id)
  464. $game_party.members[0].remove_pokemon_from_team(poke_id)
  465. end
  466.  
  467. end
  468.  
  469. #==============================================================================
  470. class Game_Interpreter
  471. #==============================================================================
  472.  
  473. def party_has_pokemon?(poke_id)
  474. istrue = 0
  475. $game_party.members.size.times{|i|
  476. istrue += 1 if $game_party.members[i].pokemon_database_id == poke_id
  477. }
  478. return true if istrue > 0
  479. return false
  480. end
  481.  
  482. end
  483.  
  484. #===============================================================================#
  485. # - SCRIPT END - #
  486. #===============================================================================#
  487. # http://dekitarpg.wordpress.com/ #
  488. #===============================================================================#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement