Advertisement
ProClifo

Untitled

Jun 25th, 2015
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.18 KB | None | 0 0
  1. /*
  2. FOSSIL SCRIPT
  3. by aaaaaa123456789, 2015-06-25
  4. This script is hereby released to the public domain.
  5.  
  6. This script controls the NPC that revives fossils in Devon Corporation. It
  7. is meant as a replacement for the current script at 0x082118f1.
  8.  
  9. Variables used:
  10. 0x4001: parameter to an external call
  11. 0x40c4: fossil revival status (0: ready, 1: waiting, 2: done)
  12. [this variable is changed externally from 1 to 2]
  13. 0x40c5: species that is waiting for revival
  14. 0x8000: parameter 1
  15. 0x8001: parameter 2, temporary
  16. 0x8002: pure temporary
  17. 0x800d: (alias: LASTRESULT) result of the last call
  18.  
  19. Flags affected:
  20. 0x10b: something was revived (write-only)
  21.  
  22. Externals referenced:
  23. 0x08273374: string: rename this Pokemon (parameters: [buffer1]: species)
  24. 0x082723dd: procedure: rename Pokemon in party (parameters: 0x8004: ID)
  25. 0x0827378b: procedure: get last ID in party (return value in 0x8004)
  26. 0x08273797: procedure: rename last deposited Pokemon
  27. 0x082737a0: procedure: show deposit message (shows a message indicating
  28. that the recently received Pokemon was deposited) (parameters:
  29. 0x4001: species)
  30. 0x08273811: procedure: no room for Pokemon (shows an error message stating
  31. there is no room for an extra Pokemon in the party and exits)
  32.  
  33. Notes:
  34. 1) This script requires a #dynamic directive to be placed before it.
  35. 2) The instructions to modify the script to allow for new or different
  36. fossils and Pokemon are placed at the end, where the corresponding
  37. primitives are located.
  38. */
  39.  
  40. #include stdpoke2.rbh
  41. #include stditems.rbh
  42. #freespace 0xFF
  43. #dynamic 0xF00000
  44.  
  45. #org @fossil_main
  46. lock
  47. faceplayer
  48. compare 0x40c4 2
  49. if 1 goto @fossil_revival_done
  50. compare 0x40c4 1
  51. if 1 goto @fossil_revival_waiting
  52. msgbox @fossil_str0 4
  53. call @fossil_count_fossils
  54. compare LASTRESULT 1
  55. if 2 goto @fossil_many_fossils
  56. compare LASTRESULT 1
  57. if 1 goto @fossil_one_fossil
  58. release
  59. end
  60.  
  61. #org @fossil_revival_done
  62. compare 0x40c5 0
  63. if 1 goto @fossil_revival_nothing
  64. bufferpokemon 1 0x40c5
  65. msgbox @fossil_str8 4
  66. givepokemon 0x40c5 20 0 0 0 0
  67. bufferpokemon 0 0x40c5
  68. copyvar 0x4001 0x40c5
  69. compare LASTRESULT 0
  70. if 1 goto @fossil_done_no_deposit
  71. compare LASTRESULT 1
  72. if 1 goto @fossil_done_with_deposit
  73. goto 0x8273811
  74.  
  75. #org @fossil_done_no_deposit
  76. call @fossil_show_received
  77. msgbox 0x8273374 5
  78. compare LASTRESULT 0
  79. if 1 goto @fossil_done_end
  80. call 0x827378b
  81. call 0x82723dd
  82. goto @fossil_done_end
  83.  
  84. #org @fossil_done_with_deposit
  85. call @fossil_show_received
  86. msgbox 0x8273374 5
  87. compare LASTRESULT 0
  88. if 1 goto @fossil_show_deposit
  89. call 0x8273797
  90. goto @fossil_show_deposit
  91.  
  92. #org @fossil_show_deposit
  93. call 0x82737a0
  94. goto @fossil_done_end
  95.  
  96. #org @fossil_done_end
  97. setvar 0x40c4 0
  98. setflag 0x10b
  99. release
  100. end
  101.  
  102. #org @fossil_show_received
  103. fanfare 0x172
  104. preparemsg @fossil_str10
  105. waitmsg
  106. waitfanfare
  107. return
  108.  
  109. #org @fossil_revival_nothing
  110. msgbox @fossil_str9 4
  111. setvar 0x40c4 0
  112. release
  113. end
  114.  
  115. #org @fossil_revival_waiting
  116. msgbox @fossil_str7 4
  117. release
  118. end
  119.  
  120. #org @fossil_count_fossils
  121. setvar 0x8002 0
  122. setvar 0x8000 0
  123. call @fossil_add_next_fossil
  124. copyvar LASTRESULT 0x8002
  125. return
  126.  
  127. #org @fossil_add_next_fossil
  128. call @fossil_get_fossil_by_ID
  129. copyvar 0x8001 LASTRESULT
  130. compare 0x8001 0
  131. if 1 goto @fossil_return
  132. addvar 0x8000 1
  133. checkitem 0x8001 1
  134. compare LASTRESULT 1
  135. if 0 goto @fossil_add_next_fossil
  136. addvar 0x8002 1
  137. goto @fossil_add_next_fossil
  138.  
  139. #org @fossil_many_fossils
  140. call @fossil_found_fossil
  141. compare LASTRESULT 0
  142. if 1 goto @fossil_turned_down
  143. msgbox @fossil_str4 4
  144. setvar 0x8000 0
  145. call @fossil_find_next_fossil
  146. copyvar 0x8000 LASTRESULT
  147. call @fossil_get_fossil_by_ID
  148. copyvar 0x8001 LASTRESULT
  149. compare 0x8001 0
  150. if 1 goto @fossil_close
  151. call @fossil_ask_fossil_1
  152. compare LASTRESULT 1
  153. if 1 goto @fossil_revival_chosen
  154. addvar 0x8000 1
  155. goto @fossil_try_next_fossil
  156.  
  157. #org @fossil_try_next_fossil
  158. call @fossil_find_next_fossil
  159. copyvar 0x8000 LASTRESULT
  160. call @fossil_get_fossil_by_ID
  161. copyvar 0x8001 LASTRESULT
  162. compare 0x8001 0
  163. if 1 goto @fossil_turned_down
  164. call @fossil_ask_fossil_2
  165. compare LASTRESULT 1
  166. if 1 goto @fossil_revival_chosen
  167. addvar 0x8000 1
  168. goto @fossil_try_next_fossil
  169.  
  170. #org @fossil_ask_fossil_1
  171. bufferitem 0 0x8001
  172. msgbox @fossil_str5 5
  173. return
  174.  
  175. #org @fossil_ask_fossil_2
  176. bufferitem 0 0x8001
  177. msgbox @fossil_str6 5
  178. return
  179.  
  180. #org @fossil_one_fossil
  181. setvar 0x8000 0
  182. call @fossil_find_next_fossil
  183. copyvar 0x8000 LASTRESULT
  184. call @fossil_get_fossil_by_ID
  185. copyvar 0x8001 LASTRESULT
  186. compare 0x8001 0
  187. if 1 goto @fossil_close
  188. call @fossil_found_fossil
  189. compare LASTRESULT 0
  190. if 1 goto @fossil_turned_down
  191. goto @fossil_revival_chosen
  192.  
  193. #org @fossil_revival_chosen
  194. bufferitem 0 0x8001
  195. msgbox @fossil_str3 4
  196. removeitem 0x8001 1
  197. call @fossil_get_pokemon_by_ID
  198. copyvar 0x40c5 LASTRESULT
  199. setvar 0x40c4 1
  200. release
  201. end
  202.  
  203. #org @fossil_find_next_fossil
  204. call @fossil_get_fossil_by_ID
  205. copyvar 0x8002 LASTRESULT
  206. compare 0x8002 0
  207. if 1 goto @fossil_return_current_fossil
  208. checkitem 0x8002 1
  209. compare LASTRESULT 1
  210. if 1 goto @fossil_return_current_fossil
  211. addvar 0x8000 1
  212. goto @fossil_find_next_fossil
  213.  
  214. #org @fossil_return_current_fossil
  215. copyvar LASTRESULT 0x8000
  216. return
  217.  
  218. #org @fossil_return
  219. return
  220.  
  221. #org @fossil_close
  222. release
  223. end
  224.  
  225. #org @fossil_found_fossil
  226. closeonkeypress
  227. sound 0x15
  228. applymovement 5 @fossil_move0
  229. waitmovement 0
  230. applymovement 5 @fossil_move1
  231. waitmovement 0
  232. msgbox @fossil_str1 5
  233. return
  234.  
  235. #org @fossil_turned_down
  236. msgbox @fossil_str2 4
  237. release
  238. end
  239.  
  240.  
  241. // Strings
  242. #org @fossil_str0
  243. = I've been trying to develop a device\nthat resurrects POKéMON from fossils[.]\pAnd, it's working!
  244. #org @fossil_str1
  245. = Wait! That thing you have there[.]\nIs that a POKéMON fossil?\pWould you like to bring that POKéMON\nback to life?\pI can with my newly developed\nFOSSIL REGENERATOR.
  246. #org @fossil_str2
  247. = Oh, is that so?\pDEVON's technological expertise\nis outstanding, I tell you.
  248. #org @fossil_str3
  249. = Excellent!\nLet's do this right away.\p[player] handed the [buffer1] to\nthe DEVON RESEARCHER.
  250. #org @fossil_str4
  251. = Oh, now that's a surprise!\nYou have not one, but many, fossils?\pUnfortunately, my machine can only\nregenerate one POKéMON at a time.
  252. #org @fossil_str5
  253. = You will have to pick one of your\nfossils. Should we begin with the\l[buffer1]?
  254. #org @fossil_str6
  255. = How about the [buffer1]?
  256. #org @fossil_str7
  257. = The FOSSIL REGENERATOR, which I made,\nis incredible.\pBut it has one drawback--it takes\na long time to work.\pSo, uh[.] How about you go for a stroll\nand look around for a while?
  258. #org @fossil_str8
  259. = Thanks for waiting!\pYour fossilized POKéMON has been\nbrought back to life!\pThe fossil was an ancient POKéMON.\n[buffer2], it was!
  260. #org @fossil_str9
  261. = Thanks for waiting!\pUnfortunately, your fossil turned\nout to be just a bunch of old\lrocks. Nothing came out of it.\pIf you find any more fossils,\nbring them to me and I'll try to\lrevive them.
  262. #org @fossil_str10
  263. = [player] received [buffer1] from\nthe DEVON RESEARCHER.
  264.  
  265.  
  266. // Movements
  267. #org @fossil_move0
  268. #raw 0x56 0xfe
  269. #org @fossil_move1
  270. #raw 0x14 0x14 0x14 0xfe
  271.  
  272.  
  273. // Modifiable primitives
  274. #org @fossil_get_fossil_by_ID
  275. /*
  276. This primitive returns the various items that are acknowledged as fossils.
  277. For each one of them, add the following lines of code:
  278. setvar LASTRESULT <item number>
  279. compare 0x8000 0x0
  280. if 1 goto @fossil_return
  281. where <item number> is the fossil's item number, and <ID> is an incrementing
  282. ID (0 for the first one, 1 for the second one, and so on). There must be at
  283. least two fossils for the script to work properly.
  284. */
  285. setvar LASTRESULT 0x11e
  286. compare 0x8000 0
  287. if 1 goto @fossil_return
  288. setvar LASTRESULT 0x11f
  289. compare 0x8000 1
  290. if 1 goto @fossil_return
  291. setvar LASTRESULT HELIXFOSSIL
  292. compare 0x8000 2
  293. if 1 goto @fossil_return
  294. setvar LASTRESULT DOMEFOSSIL
  295. compare 0x8000 3
  296. if 1 goto @fossil_return
  297. setvar LASTRESULT OLDAMBER
  298. compare 0x8000 4
  299. if 1 goto @fossil_return
  300. // fossil list ends here. Do not modify the following lines.
  301. setvar LASTRESULT 0
  302. return
  303.  
  304. #org @fossil_get_pokemon_by_ID
  305. /*
  306. This primitive returns the Pokemon that are revived by each fossil. For each
  307. one of them, add the following lines of code:
  308. setvar LASTRESULT <pokemon number>
  309. compare 0x8000 <ID>
  310. if 1 goto @fossil_return
  311. where <pokemon number> is the internal number for the Pokemon, and <ID> is
  312. the same ID number that was set for the corresponding fossil in the previous
  313. primitive. The IDs for the fossils and the Pokemon must match.
  314. If a Pokemon number is set to 0, the fossil will be a dud/fake fossil (i.e.,
  315. will not contain a Pokemon when revived).
  316. */
  317. setvar LASTRESULT 0x184
  318. compare 0x8000 0
  319. if 1 goto @fossil_return
  320. setvar LASTRESULT 0x186
  321. compare 0x8000 1
  322. if 1 goto @fossil_return
  323. setvar LASTRESULT OMANYTE
  324. compare 0x8000 2
  325. if 1 goto @fossil_return
  326. setvar LASTRESULT KABUTO
  327. compare 0x8000 3
  328. if 1 goto @fossil_return
  329. setvar LASTRESULT AERODACTYL
  330. compare 0x8000 4
  331. if 1 goto @fossil_return
  332. // Pokemon list ends here. Do not modify the following lines.
  333. setvar LASTRESULT 0
  334. return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement