aaaaaa123456789 icon

Pokemon ROM hacking - Fossil script

aaaaaa123456789 | PRO | 06/25/15 07:08:06 AM UTC | 0 ⭐ | 652 👁️ | Never ⏰ | []
text |

8.59 KB

|

None

|

0 👍

/

0 👎

/*
    FOSSIL SCRIPT
    by aaaaaa123456789, 2015-06-25
    This script is hereby released to the public domain.
     This script controls the NPC that revives fossils in Devon Corporation. It
    is meant as a replacement for the current script at 0x082118f1.
     Variables used:
    0x4001: parameter to an external call
    0x40c4: fossil revival status (0: ready, 1: waiting, 2: done)
            [this variable is changed externally from 1 to 2]
    0x40c5: species that is waiting for revival
    0x8000: parameter 1
    0x8001: parameter 2, temporary
    0x8002: pure temporary
    0x800d: (alias: LASTRESULT) result of the last call
     Flags affected:
     0x10b: something was revived (write-only)
     Externals referenced:
    0x08273374: string: rename this Pokemon (parameters: [buffer1]: species)
    0x082723dd: procedure: rename Pokemon in party (parameters: 0x8004: ID)
    0x0827378b: procedure: get last ID in party (return value in 0x8004)
    0x08273797: procedure: rename last deposited Pokemon
    0x082737a0: procedure: show deposit message (shows a message indicating
                that the recently received Pokemon was deposited) (parameters:
                0x4001: species)
    0x08273811: procedure: no room for Pokemon (shows an error message stating
                there is no room for an extra Pokemon in the party and exits)
     Notes:
    1) This script requires a #dynamic directive to be placed before it.
    2) The instructions to modify the script to allow for new or different
       fossils and Pokemon are placed at the end, where the corresponding
       primitives are located.
*/
 #org @fossil_main
lock
faceplayer
compare 0x40c4 2
if 1 goto @fossil_revival_done
compare 0x40c4 1
if 1 goto @fossil_revival_waiting
msgbox @fossil_str0 4
call @fossil_count_fossils
compare LASTRESULT 1
if 2 goto @fossil_many_fossils
compare LASTRESULT 1
if 1 goto @fossil_one_fossil
release
end
 #org @fossil_revival_done
compare 0x40c5 0
if 1 goto @fossil_revival_nothing
bufferpokemon 1 0x40c5
msgbox @fossil_str8 4
givepokemon 0x40c5 20 0 0 0 0
bufferpokemon 0 0x40c5
copyvar 0x4001 0x40c5
compare LASTRESULT 0
if 1 goto @fossil_done_no_deposit
compare LASTRESULT 1
if 1 goto @fossil_done_with_deposit
goto 0x8273811
 #org @fossil_done_no_deposit
call @fossil_show_received
msgbox 0x8273374 5
compare LASTRESULT 0
if 1 goto @fossil_done_end
call 0x827378b
call 0x82723dd
goto @fossil_done_end
 #org @fossil_done_with_deposit
call @fossil_show_received
msgbox 0x8273374 5
compare LASTRESULT 0
if 1 goto @fossil_show_deposit
call 0x8273797
goto @fossil_show_deposit
 #org @fossil_show_deposit
call 0x82737a0
goto @fossil_done_end
 #org @fossil_done_end
setvar 0x40c4 0
setflag 0x10b
release
end
 #org @fossil_show_received
fanfare 0x172
preparemsg @fossil_str10
waitmsg
waitfanfare
return
 #org @fossil_revival_nothing
msgbox @fossil_str9 4
setvar 0x40c4 0
release
end
 #org @fossil_revival_waiting
msgbox @fossil_str7 4
release
end
 #org @fossil_count_fossils
setvar 0x8002 0
setvar 0x8000 0
call @fossil_add_next_fossil
copyvar LASTRESULT 0x8002
return
 #org @fossil_add_next_fossil
call @fossil_get_fossil_by_ID
copyvar 0x8001 LASTRESULT
compare 0x8001 0
if 1 goto @fossil_return
addvar 0x8000 1
checkitem 0x8001 1
compare LASTRESULT 1
if 0 goto @fossil_add_next_fossil
addvar 0x8002 1
goto @fossil_add_next_fossil
 #org @fossil_many_fossils
call @fossil_found_fossil
compare LASTRESULT 0
if 1 goto @fossil_turned_down
msgbox @fossil_str4 4
setvar 0x8000 0
call @fossil_find_next_fossil
copyvar 0x8000 LASTRESULT
call @fossil_get_fossil_by_ID
copyvar 0x8001 LASTRESULT
compare 0x8001 0
if 1 goto @fossil_close
call @fossil_ask_fossil_1
compare LASTRESULT 1
if 1 goto @fossil_revival_chosen
addvar 0x8000 1
goto @fossil_try_next_fossil
 #org @fossil_try_next_fossil
call @fossil_find_next_fossil
copyvar 0x8000 LASTRESULT
call @fossil_get_fossil_by_ID
copyvar 0x8001 LASTRESULT
compare 0x8001 0
if 1 goto @fossil_turned_down
call @fossil_ask_fossil_2
compare LASTRESULT 1
if 1 goto @fossil_revival_chosen
addvar 0x8000 1
goto @fossil_try_next_fossil
 #org @fossil_ask_fossil_1
bufferitem 0 0x8001
msgbox @fossil_str5 5
return
 #org @fossil_ask_fossil_2
bufferitem 0 0x8001
msgbox @fossil_str6 5
return
 #org @fossil_one_fossil
setvar 0x8000 0
call @fossil_find_next_fossil
copyvar 0x8000 LASTRESULT
call @fossil_get_fossil_by_ID
copyvar 0x8001 LASTRESULT
compare 0x8001 0
if 1 goto @fossil_close
call @fossil_found_fossil
compare LASTRESULT 0
if 1 goto @fossil_turned_down
goto @fossil_revival_chosen
 #org @fossil_revival_chosen
bufferitem 0 0x8001
msgbox @fossil_str3 4
removeitem 0x8001 1
call @fossil_get_pokemon_by_ID
copyvar 0x40c5 LASTRESULT
setvar 0x40c4 1
release
end
 #org @fossil_find_next_fossil
call @fossil_get_fossil_by_ID
copyvar 0x8002 LASTRESULT
compare 0x8002 0
if 1 goto @fossil_return_current_fossil
checkitem 0x8002 1
compare LASTRESULT 1
if 1 goto @fossil_return_current_fossil
addvar 0x8000 1
goto @fossil_find_next_fossil
 #org @fossil_return_current_fossil
copyvar LASTRESULT 0x8000
return
 #org @fossil_return
return
 #org @fossil_close
release
end
 #org @fossil_found_fossil
closeonkeypress
sound 0x15
applymovement 5 @fossil_move0
waitmovement 0
applymovement 5 @fossil_move1
waitmovement 0
msgbox @fossil_str1 5
return
 #org @fossil_turned_down
msgbox @fossil_str2 4
release
end
  // Strings
#org @fossil_str0
= I've been trying to develop a device\nthat resurrects POKéMON from fossils[.]\pAnd, it's working!
#org @fossil_str1
= 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.
#org @fossil_str2
= Oh, is that so?\pDEVON's technological expertise\nis outstanding, I tell you.
#org @fossil_str3
= Excellent!\nLet's do this right away.\p[player] handed the [buffer1] to\nthe DEVON RESEARCHER.
#org @fossil_str4
= 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.
#org @fossil_str5
= You will have to pick one of your\nfossils. Should we begin with the\l[buffer1]?
#org @fossil_str6
= How about the [buffer1]?
#org @fossil_str7
= 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?
#org @fossil_str8
= Thanks for waiting!\pYour fossilized POKéMON has been\nbrought back to life!\pThe fossil was an ancient POKéMON.\n[buffer2], it was!
#org @fossil_str9
= 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.
#org @fossil_str10
= [player] received [buffer1] from\nthe DEVON RESEARCHER.
  // Movements
#org @fossil_move0
#raw 0x56 0xfe
#org @fossil_move1
#raw 0x14 0x14 0x14 0xfe
  // Modifiable primitives
#org @fossil_get_fossil_by_ID
/*
   This primitive returns the various items that are acknowledged as fossils.
   For each one of them, add the following lines of code:
     setvar LASTRESULT <item number>
     compare 0x8000 <ID>
     if 1 goto @fossil_return
   where <item number> is the fossil's item number, and <ID> is an incrementing
   ID (0 for the first one, 1 for the second one, and so on). There must be at
   least two fossils for the script to work properly.
*/
setvar LASTRESULT 0x11e
compare 0x8000 0
if 1 goto @fossil_return
setvar LASTRESULT 0x11f
compare 0x8000 1
if 1 goto @fossil_return
// fossil list ends here. Do not modify the following lines.
setvar LASTRESULT 0
return
 #org @fossil_get_pokemon_by_ID
/*
   This primitive returns the Pokemon that are revived by each fossil. For each
   one of them, add the following lines of code:
     setvar LASTRESULT <pokemon number>
     compare 0x8000 <ID>
     if 1 goto @fossil_return
   where <pokemon number> is the internal number for the Pokemon, and <ID> is
   the same ID number that was set for the corresponding fossil in the previous
   primitive. The IDs for the fossils and the Pokemon must match.
   If a Pokemon number is set to 0, the fossil will be a dud/fake fossil (i.e.,
   will not contain a Pokemon when revived).
*/
setvar LASTRESULT 0x184
compare 0x8000 0
if 1 goto @fossil_return
setvar LASTRESULT 0x186
compare 0x8000 1
if 1 goto @fossil_return
// Pokemon list ends here. Do not modify the following lines.
setvar LASTRESULT 0
return

Comments