Advertisement
Dekita

poke core 1.2

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