Advertisement
Dekita

pokemon CORE 1.1

Jan 1st, 2013
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.35 KB | None | 0 0
  1. =begin =========================================================================
  2. Dekita's v1.1
  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. 29/12/2o12 - updated some things, information ect..
  48. 24/12/2o12 - released beta version,
  49. 13/11/2012 - started,
  50.  
  51. ================================================================================
  52. Known Bugs:
  53. ============
  54. N/A
  55.  
  56. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  57. If a new bug is found please contact me at
  58. http://dekitarpg.wordpress.com/
  59.  
  60. ================================================================================
  61. INSTRUCTIONS:
  62. ==============
  63. Place this script UNDER "▼ Materials" and ABOVE "▼ Main" in your script editor.
  64. Place this above other pokemon scripts i have written
  65.  
  66. ================================================================================
  67. NOTETAGS:
  68. ==========
  69. <weight: X>
  70. Where X is the weight for an actor/enemy. (can and SHOULD be a float value)
  71.  
  72.  
  73. <gender: X>
  74. Where X is the percentage chance for a male actor. (can be a float value)
  75.  
  76. <species: X>
  77. Where X is the ID number for the species, defined below.
  78.  
  79. <legendary>
  80. just give this notetag to a legendary actor / enemy.
  81. this will make it a legendary "pokemon"
  82.  
  83. <gen id: X>
  84. X = 1 - 5
  85. this determines the generation id
  86.  
  87.  
  88. These are the id tags for each type, use the notetag like this...
  89. <type: TYPE_ONE, TYPE_TWO>
  90. replace TYPE_ONE and TYPE_TWO with the id number for the type you want..
  91. e.g if you want water and dark type it would be
  92. <type: 3, 16>
  93. if you only want one type put "nil" in place of the id number... like so...
  94. <type: 3, nil>
  95. This notetag is for actors && enemies. Types are defined below.
  96.  
  97. <type: TYPE_ID>
  98. use this notetag for skills, ( they can have only one type )
  99.  
  100. ================================================================================
  101. SCRIPT CALLS:
  102. ==============
  103. $game_party.add_pokemon(actor_id, level)
  104. actor_id = the id of the actor in the database,
  105. level = the level of the actor.
  106. This gives you a pokemon (cloned actor)...
  107.  
  108. $game_party.ACTIVITY = B00L
  109. replace "ACTIVITY" with " fishing " OR " diving " OR " surfing " OR " in_cave "
  110. replace "B00L" with true or false
  111. eg. $game_party.fishing = true , $game_party.in_cave = false
  112. This is for certain pokeball effects.
  113.  
  114. there is also
  115. $game_system.night_time = B00L
  116. this obviously determines "night time" for certain scripts, e.g pokeball effects
  117. only use this if you are NOT using my realtime effects script.
  118.  
  119.  
  120. party_has_pokemon?(poke_id)
  121. poke_id = the id of the actor you are checking for.
  122. you must use this because each time a new "pokemon"(actor) is added into the
  123. party it is cloned, therefor the standard method for checking if an actor is in
  124. the party does not work. use this for things like conditional branch checks.
  125.  
  126. change_desc(text)
  127. This will change the description for $game_party.members[0] (i count them as
  128. the main trainer). this is only visible in certain scripts i write.
  129.  
  130. =end #==========================================================================#
  131.  
  132. module Dekita__Pokémon_CORE
  133.  
  134. Main_Pokeball_Item_id = 1 # The id of your main pokeball item
  135. # this can be found in the database.
  136. # this is so that the game know's what a basic pokeball is, this determines
  137. # the initial pokeball that each pokemon is "stored" in.
  138.  
  139. p "Loaded : Pokemon Core"
  140. end ; module PkMn_Types
  141.  
  142. Types = []
  143. # DO NOT USE "Types[0]"
  144. Types[1] = "Normal"
  145. Types[2] = "Fire"
  146. Types[3] = "Water"
  147. Types[4] = "Electric"
  148. Types[5] = "Grass"
  149. Types[6] = "Ice"
  150. Types[7] = "Fighting"
  151. Types[8] = "Poison"
  152. Types[9] = "Ground"
  153. Types[10]= "Flying"
  154. Types[11]= "Psychic"
  155. Types[12]= "Bug"
  156. Types[13]= "Rock"
  157. Types[14]= "Ghost"
  158. Types[15]= "Dragon"
  159. Types[16]= "Dark"
  160. Types[17]= "Steel"
  161. # Add more lines like this .. Types[ID] = ["INFO"]
  162.  
  163. Species = []
  164. Species[0] = ["Mouse"]
  165. Species[1] = ["Bird"]
  166. Species[2] = ["Dinosaur"]
  167. Species[3] = ["Jelly"]
  168. Species[4] = ["Fish thing ^_^"]
  169. # Add more lines like this .. Species[ID] = ["INFO"]
  170. # i obviously havent finished the pokemon species yet, feel free to not use
  171. # this feature until i do :p
  172.  
  173. end #####################
  174. # CUSTOMISATION END #
  175. #####################
  176. #===============================================================================#
  177. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  178. # #
  179. # http://dekitarpg.wordpress.com/ #
  180. # #
  181. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  182. #===============================================================================#
  183. # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
  184. # YES?\.\. #
  185. # OMG, REALLY? \| #
  186. # WELL SLAP MY FACE AND CALL ME A DITTO.\..\.. #
  187. # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
  188. #===============================================================================#
  189.  
  190. $imported = {} if $imported.nil?
  191. $imported[:Dekita__Pokémon_CORE] = true
  192.  
  193. #==============================================================================
  194. module DataManager
  195. #==============================================================================
  196.  
  197. class <<self; alias load_database_Poké_CORE load_database; end
  198. def self.load_database
  199. load_database_Poké_CORE
  200. load_Poké_CORE
  201. end
  202.  
  203. def self.load_Poké_CORE
  204. groups = [$data_actors, $data_enemies, $data_skills]
  205. for group in groups
  206. for obj in group
  207. next if obj.nil?
  208. obj.load_Poké_CORE
  209. end
  210. end
  211. end
  212.  
  213. end # DataManager
  214.  
  215. #==============================================================================
  216. class RPG::UsableItem < RPG::BaseItem
  217. #==============================================================================
  218.  
  219. attr_accessor :type
  220.  
  221. def load_Poké_CORE
  222. @type = [nil , nil]
  223. load_Poké_CORE_Notes
  224. end
  225.  
  226. def load_Poké_CORE_Notes
  227. self.note.split(/[\r\n]+/).each { |line|
  228. case line
  229. when /<type: (.*)>/i
  230. @type = [PkMn_Types::Types[$1.to_i], nil]
  231. #---
  232. when /<type: (.*), (.*)>/i
  233. @type = [PkMn_Types::Types[$1.to_i], PkMn_Types::Types[$2.to_i]]
  234. #---
  235. end
  236. } # self.note.split
  237. #---
  238. end
  239.  
  240. end
  241.  
  242. #==============================================================================
  243. class RPG::Actor < RPG::BaseItem
  244. #==============================================================================
  245.  
  246. attr_accessor :pokemon_database_id
  247. attr_accessor :gender_ratio
  248. attr_accessor :type
  249. attr_accessor :species
  250. attr_accessor :weight
  251. attr_accessor :legendary
  252. attr_accessor :generation_id
  253.  
  254. def load_Poké_CORE
  255. @pokemon_database_id = @id
  256. @type = [nil , nil]
  257. @gender_ratio = [nil]
  258. @species = 0
  259. @weight = 0.0
  260. @legendary = false
  261. @generation_id = nil
  262. load_Poké_CORE_Notes
  263. end
  264.  
  265. def load_Poké_CORE_Notes
  266. self.note.split(/[\r\n]+/).each { |line|
  267. case line
  268. when /<gender: (.*)>/i
  269. @gender_ratio[0] = $1.to_f
  270. #---
  271. when /<weight: (.*)>/i
  272. @weight = $1.to_f
  273. #---
  274. when /<species: (.*)>/i
  275. @species = PkMn_Types::Species[$1.to_i]
  276. #---
  277. when /<legendary>/i
  278. @legendary = true
  279. #---
  280. when /<gen id: (.*)>/i
  281. @generation_id = $1.to_i
  282. #---
  283. when /<type: (.*), (.*)>/i
  284. @type = [PkMn_Types::Types[$1.to_i], PkMn_Types::Types[$2.to_i]]
  285. #---
  286. end
  287. } # self.note.split
  288. #---
  289. end
  290.  
  291. end # RPG::Actor
  292.  
  293. #==============================================================================
  294. class RPG::Enemy < RPG::BaseItem
  295. #==============================================================================
  296.  
  297. attr_accessor :gender
  298. attr_accessor :type
  299. attr_accessor :species
  300. attr_accessor :weight
  301. attr_accessor :legendary
  302. attr_accessor :generation_id
  303.  
  304. def load_Poké_CORE
  305. @pokemon_database_id = @id
  306. @type = [nil , nil]
  307. @gender = [nil]
  308. @species = 0
  309. @weight = 0.0
  310. @legendary = false
  311. @generation_id = nil
  312. load_Poké_CORE_Notes
  313. end
  314.  
  315. def load_Poké_CORE_Notes
  316. self.note.split(/[\r\n]+/).each { |line|
  317. case line
  318. when /<gender: (.*)>/i
  319. @gender_ratio[0] = $1.to_f
  320. #---
  321. when /<weight: (.*)>/i
  322. @weight = $1.to_f
  323. #---
  324. when /<species: (.*)>/i
  325. @species = PkMn_Types::Species[$1.to_i]
  326. #---
  327. when /<legendary>/i
  328. @legendary = true
  329. #---
  330. when /<gen id: (.*)>/i
  331. @generation_id = $1.to_i
  332. #---
  333. when /<type: (.*), (.*)>/i
  334. @type = [PkMn_Types::Types[$1.to_i], PkMn_Types::Types[$2.to_i]]
  335. #---
  336. end
  337. } # self.note.split
  338. #---
  339. end
  340.  
  341. end # RPG::Enemy
  342.  
  343. #==============================================================================
  344. class Game_Actor < Game_Battler
  345. #==============================================================================
  346.  
  347. attr_accessor :pokemons_pokeball
  348. attr_accessor :pokemon_captured
  349. attr_accessor :pokemon_team
  350. attr_accessor :capt_inf
  351. attr_reader :pokemon_database_id # origional db id
  352. attr_reader :real_game_id # new game id
  353. attr_reader :gender
  354. attr_reader :type
  355. attr_reader :species
  356. attr_reader :weight
  357. attr_reader :legendary
  358. attr_reader :generation_id
  359. attr_reader :trainer_id
  360. attr_reader :t_desc
  361.  
  362. alias Poké_CORE_A_GO_GO setup
  363. def setup(actor_id)
  364. Poké_CORE_A_GO_GO(actor_id)
  365. setup_pokemon_system_by_Dekita_RPG
  366. end
  367.  
  368. def setup_pokemon_system_by_Dekita_RPG
  369. @pokemon_database_id = actor.pokemon_database_id
  370. @gender = get_unique_gender
  371. @species = actor.species
  372. @weight = actor.weight
  373. @type = actor.type
  374. @legendary = actor.legendary
  375. @generation_id = actor.generation_id
  376. @trainer_id = rand(999_99)
  377. @pokemons_pokeball = $data_items[Dekita__Pokémon_CORE::Main_Pokeball_Item_id]
  378. @real_game_id = actor.id
  379. @pokemon_captured = 0
  380. init_poketeam
  381. setup_capture_data
  382. @t_desc = actor.description
  383. end
  384.  
  385. def get_unique_gender
  386. sex = rand(100+1)
  387. g = actor.gender_ratio
  388. return "" if g[0].nil?
  389. sex <= g[0] ? @gender = "male" : @gender = "female"
  390. end
  391.  
  392. def init_poketeam
  393. @pokemon_team = []# * 6
  394. end
  395.  
  396. def add_pokemon_into_team(pokemon)
  397. if @pokemon_team.size <= 5
  398. @pokemon_team.push($game_actors[pokemon])
  399. else
  400. end
  401. new_poke = gained_new_pokemon?($game_actors[pokemon].pokemon_database_id)
  402. @pokemon_captured += 1 if new_poke
  403. end
  404.  
  405. def remove_pokemon_from_team(pokemon)
  406. @pokemon_team.delete_at(pokemon)
  407. end
  408.  
  409. def gained_new_pokemon?(poke_id)
  410. istrue = 0
  411. $game_party.members.size.times{|i|
  412. istrue += 1 if $game_party.members[i].pokemon_database_id == poke_id
  413. }
  414. return false if istrue > 1
  415. return true
  416. end
  417.  
  418. def setup_capture_data
  419. day = Time.now.strftime("%d")
  420. month = Time.now.strftime("%B")
  421. year = Time.now.strftime("%Y")
  422. time = "#{Time.now.strftime("%H")}:#{Time.now.strftime("%M")}"
  423. map = $BTEST ? "" : $game_map.display_name
  424. lv = @level
  425. ot = ""
  426. id_no = 0
  427. @capt_inf = [day, month, year, time, map, lv, ot, id_no]
  428. end
  429.  
  430. end
  431. #===============================================================================#
  432. class Game_Enemy < Game_Battler
  433. #===============================================================================#
  434.  
  435. attr_reader :gender
  436. attr_reader :species
  437. attr_reader :weight
  438. attr_reader :type
  439. attr_reader :legendary
  440. attr_reader :generation_id
  441. alias genderinitfoene initialize
  442. def initialize(index, enemy_id)
  443. genderinitfoene(index, enemy_id)
  444. dekita_pokemon_core_script_enemy_init(enemy_id)
  445. end
  446.  
  447. def dekita_pokemon_core_script_enemy_init(enemy_id)
  448. @gender = get_unique_gender
  449. @species = $data_enemies[enemy_id].species
  450. @weight = $data_enemies[enemy_id].weight
  451. @type = $data_enemies[enemy_id].type
  452. @legendary = $data_enemies[enemy_id].legendary
  453. @generation_id = $data_enemies[enemy_id].generation_id
  454. end
  455.  
  456. def get_unique_gender
  457. sex = rand(100+1)
  458. g = $data_enemies[enemy_id].gender
  459. return "" if g[0].nil?
  460. sex <= g[0] ? @gender = "male" : @gender = "female"
  461. end
  462.  
  463. end
  464.  
  465. #==============================================================================
  466. class Game_System
  467. #==============================================================================
  468.  
  469. attr_accessor :night_time
  470.  
  471. alias :init_for_the_shit_of_it :initialize
  472. def initialize
  473. init_for_the_shit_of_it
  474. @night_time = false
  475. end
  476.  
  477. end
  478.  
  479. #==============================================================================
  480. class Game_Party < Game_Unit
  481. #==============================================================================
  482.  
  483. attr_accessor :fishing
  484. attr_accessor :diving
  485. attr_accessor :surfing
  486. attr_accessor :in_cave
  487.  
  488. alias fishinginitforpoek initialize
  489. def initialize
  490. fishinginitforpoek
  491. @fishing = false
  492. @diving = false
  493. @surfing = false
  494. @in_cave = false
  495. end
  496.  
  497. def add_pokemon(actor_id, level)
  498. new_actor = $data_actors[actor_id].clone
  499. new_actor.id = $data_actors.size
  500. $data_actors.push(new_actor)
  501. @actors.push(new_actor.id) unless @actors.include?(new_actor.id)
  502. $game_player.refresh
  503. $game_map.need_refresh = true
  504. get_initial_stats(new_actor.id, level)
  505. get_pokeball_aftermod(new_actor.id)
  506. end
  507.  
  508. def get_initial_stats(actor_id, level)
  509. _GA = $game_actors[actor_id]
  510. _GA.change_level(level, false)
  511. _GA.recover_all
  512. _GA.capt_inf[5] = _GA.level
  513. _GA.capt_inf[6] = $game_party.members[0].name
  514. _GA.capt_inf[7] = $game_party.members[0].trainer_id
  515. $game_party.members[0].add_pokemon_into_team(actor_id)
  516. end
  517.  
  518. def remove_pokemon(poke_id)
  519. $game_party.members[0].remove_pokemon_from_team(poke_id)
  520. end
  521.  
  522. def get_pokeball_aftermod(actor_id)
  523. end
  524.  
  525. end
  526.  
  527. #==============================================================================
  528. class Game_Interpreter
  529. #==============================================================================
  530.  
  531. def party_has_pokemon?(poke_id)
  532. istrue = 0
  533. $game_party.members.size.times{|i|
  534. istrue += 1 if $game_party.members[i].pokemon_database_id == poke_id
  535. }
  536. return true if istrue > 0
  537. return false
  538. end
  539.  
  540. def change_desc(text)
  541. $game_party.members[0].t_desc = text
  542. end
  543.  
  544. end
  545.  
  546. #==============================================================================
  547. class Window_Base < Window
  548. #==============================================================================
  549.  
  550. # Method to Draw a Gauge with height
  551. def draw_gauge_DPBz(dx, dy, dw, dh, rate, color1, color2)
  552. empty_gauge_color = Color.new(111,111,111,0)
  553. fill_w = [(dw * rate).to_i, dw].min
  554. gauge_h = dh
  555. gauge_y = dy + line_height - 2 - gauge_h
  556. contents.fill_rect(dx, gauge_y, dw, gauge_h, empty_gauge_color)
  557. contents.gradient_fill_rect(dx, gauge_y, fill_w, gauge_h, color1, color2)
  558. end
  559.  
  560. end # Window_Base < Window
  561. #===============================================================================#
  562. # - SCRIPT END - #
  563. #===============================================================================#
  564. # http://dekitarpg.wordpress.com/ #
  565. #===============================================================================#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement