pokeemerald/data/scripts/obtain_item.inc

208 lines
5.0 KiB
PHP
Raw Normal View History

2021-07-20 21:18:31 +02:00
Std_ObtainItem::
additem VAR_0x8000, VAR_0x8001
copyvar VAR_0x8007, VAR_RESULT
2019-10-22 23:56:47 +02:00
call EventScript_ObtainItemMessage
return
2021-07-20 21:18:31 +02:00
EventScript_ObtainItemMessage::
bufferitemnameplural 1, VAR_0x8000, VAR_0x8001
checkitemtype VAR_0x8000
2019-10-22 23:56:47 +02:00
call EventScript_BufferPocketNameAndTryFanfare
compare VAR_0x8007, 1
2019-10-22 23:56:47 +02:00
call_if_eq EventScript_ObtainedItem
compare VAR_0x8007, 0
2019-10-22 23:56:47 +02:00
call_if_eq EventScript_NoRoomForItem
return
2021-07-20 21:18:31 +02:00
EventScript_BufferPocketNameAndTryFanfare::
switch VAR_RESULT
2019-10-22 23:56:47 +02:00
case POCKET_ITEMS, EventScript_BufferItemsPocket
case POCKET_KEY_ITEMS, EventScript_BufferKeyItemsPocket
case POCKET_POKE_BALLS, EventScript_BufferPokeballsPocket
case POCKET_TM_HM, EventScript_BufferTMHMsPocket
case POCKET_BERRIES, EventScript_BufferBerriesPocket
end
2021-07-20 21:18:31 +02:00
EventScript_BufferItemsPocket::
bufferstdstring 2, STDSTRING_ITEMS
compare VAR_0x8007, 1
call_if_eq EventScript_PlayFanfareObtainedItem
return
2021-07-20 21:18:31 +02:00
EventScript_BufferKeyItemsPocket::
bufferstdstring 2, STDSTRING_KEYITEMS
compare VAR_0x8007, 1
call_if_eq EventScript_PlayFanfareObtainedItem
return
2021-07-20 21:18:31 +02:00
EventScript_BufferPokeballsPocket::
bufferstdstring 2, STDSTRING_POKEBALLS
compare VAR_0x8007, 1
call_if_eq EventScript_PlayFanfareObtainedItem
return
2021-07-20 21:18:31 +02:00
EventScript_BufferTMHMsPocket::
bufferstdstring 2, STDSTRING_TMHMS
compare VAR_0x8007, 1
call_if_eq EventScript_PlayFanfareObtainedTMHM
return
2021-07-20 21:18:31 +02:00
EventScript_BufferBerriesPocket::
bufferstdstring 2, STDSTRING_BERRIES
compare VAR_0x8007, 1
call_if_eq EventScript_PlayFanfareObtainedItem
return
2021-07-20 21:18:31 +02:00
EventScript_ObtainedItem::
message gText_ObtainedTheItem
waitfanfare
msgbox gText_PutItemInPocket, MSGBOX_DEFAULT
setvar VAR_RESULT, 1
return
2021-07-20 21:18:31 +02:00
EventScript_NoRoomForItem::
setvar VAR_RESULT, 0
return
2021-07-20 21:18:31 +02:00
EventScript_PlayFanfareObtainedItem::
2020-08-21 00:02:00 +02:00
playfanfare MUS_OBTAIN_ITEM
return
2021-07-20 21:18:31 +02:00
EventScript_PlayFanfareObtainedTMHM::
2020-08-21 00:02:00 +02:00
playfanfare MUS_OBTAIN_TMHM
return
2021-07-20 21:18:31 +02:00
Std_ObtainDecoration::
adddecoration VAR_0x8000
copyvar VAR_0x8007, VAR_RESULT
2019-10-22 23:56:47 +02:00
call EventScript_ObtainDecorationMessage
return
2021-07-20 21:18:31 +02:00
EventScript_ObtainDecorationMessage::
bufferdecorationname 1, VAR_0x8000
compare VAR_0x8007, 1
2019-10-22 23:56:47 +02:00
call_if_eq EventScript_ObtainedDecor
compare VAR_0x8007, 0
2019-10-22 23:56:47 +02:00
call_if_eq EventScript_NoRoomForDecor
return
2021-07-20 21:18:31 +02:00
EventScript_ObtainedDecor::
2020-08-21 00:02:00 +02:00
playfanfare MUS_OBTAIN_ITEM
message gText_ObtainedTheDecor
waitfanfare
msgbox gText_TheDecorWasTransferredToThePC, MSGBOX_DEFAULT
setvar VAR_RESULT, 1
return
2021-07-20 21:18:31 +02:00
EventScript_NoRoomForDecor::
setvar VAR_RESULT, 0
return
2021-07-20 21:18:31 +02:00
Std_FindItem::
lock
faceplayer
waitse
copyvar VAR_0x8004, VAR_0x8000
copyvar VAR_0x8005, VAR_0x8001
checkitemspace VAR_0x8000, VAR_0x8001
copyvar VAR_0x8007, VAR_RESULT
bufferitemnameplural 1, VAR_0x8000, VAR_0x8001
checkitemtype VAR_0x8000
2019-10-22 23:56:47 +02:00
call EventScript_BufferPocketNameAndTryFanfare
compare VAR_0x8007, 1
2019-10-22 23:56:47 +02:00
call_if_eq EventScript_PickUpItem
compare VAR_0x8007, 0
2019-10-22 23:56:47 +02:00
call_if_eq EventScript_NoRoomToPickUpItem
release
return
2021-07-20 21:18:31 +02:00
EventScript_PickUpItem::
removeobject VAR_LAST_TALKED
additem VAR_0x8004, VAR_0x8005
specialvar VAR_RESULT, BufferTMHMMoveName
copyvar VAR_0x8008, VAR_RESULT
compare VAR_0x8008, 1
2019-10-22 23:56:47 +02:00
call_if_eq EventScript_FoundTMHM
compare VAR_0x8008, 0
2019-10-22 23:56:47 +02:00
call_if_eq EventScript_FoundItem
waitfanfare
waitmessage
bufferitemnameplural 1, VAR_0x8004, VAR_0x8005
2019-12-02 15:52:16 +01:00
pyramid_inchallenge
compare VAR_RESULT, 1
2019-10-22 23:56:47 +02:00
goto_if_eq EventScript_PutBattlePyramidItemInBag
msgbox gText_PutItemInPocket, MSGBOX_DEFAULT
return
2021-07-20 21:18:31 +02:00
EventScript_PutBattlePyramidItemInBag::
msgbox gText_PlayerPutItemInBag, MSGBOX_DEFAULT
return
2021-07-20 21:18:31 +02:00
EventScript_FoundTMHM::
bufferitemnameplural 0, VAR_0x8004, VAR_0x8005
2019-10-22 23:56:47 +02:00
message gText_PlayerFoundOneTMHM
return
2021-07-20 21:18:31 +02:00
EventScript_FoundItem::
message gText_PlayerFoundOneItem
return
2021-07-20 21:18:31 +02:00
EventScript_NoRoomToPickUpItem::
msgbox gText_ObtainedTheItem, MSGBOX_DEFAULT
msgbox gText_TooBadBagIsFull, MSGBOX_DEFAULT
setvar VAR_RESULT, 0
return
2021-07-20 21:18:31 +02:00
EventScript_HiddenItemScript::
lockall
waitse
additem VAR_0x8005
copyvar VAR_0x8007, VAR_RESULT
bufferitemnameplural 1, VAR_0x8005, 1
checkitemtype VAR_0x8005
2019-10-22 23:56:47 +02:00
call EventScript_BufferPocketNameAndTryFanfare
compare VAR_0x8007, 1
2019-10-22 23:56:47 +02:00
goto_if_eq EventScript_PickUpHiddenItem
compare VAR_0x8007, 0
2019-10-22 23:56:47 +02:00
goto_if_eq EventScript_NoRoomForHiddenItem
end
2021-07-20 21:18:31 +02:00
EventScript_PickUpHiddenItem::
copyvar VAR_0x8008, VAR_0x8004
copyvar VAR_0x8004, VAR_0x8005
specialvar VAR_RESULT, BufferTMHMMoveName
compare VAR_RESULT, 1
2019-10-22 23:56:47 +02:00
goto_if_eq EventScript_FoundHiddenTMHM
compare VAR_RESULT, 0
2019-10-22 23:56:47 +02:00
goto_if_eq EventScript_FoundHiddenItem
end
2021-07-20 21:18:31 +02:00
EventScript_FoundHiddenTMHM::
bufferitemnameplural 0, VAR_0x8004, 1
2019-10-22 23:56:47 +02:00
message gText_PlayerFoundOneTMHM
goto EventScript_PutHiddenItemInPocket
end
2021-07-20 21:18:31 +02:00
EventScript_FoundHiddenItem::
message gText_PlayerFoundOneItem
2019-10-22 23:56:47 +02:00
goto EventScript_PutHiddenItemInPocket
end
2021-07-20 21:18:31 +02:00
EventScript_PutHiddenItemInPocket::
waitmessage
waitfanfare
bufferitemnameplural 1, VAR_0x8004, 1
copyvar VAR_0x8004, VAR_0x8008
msgbox gText_PutItemInPocket, MSGBOX_DEFAULT
2019-10-22 23:56:47 +02:00
special TryPutTreasureInvestigatorsOnAir
special SetHiddenItemFlag
releaseall
end
2021-07-20 21:18:31 +02:00
EventScript_NoRoomForHiddenItem::
msgbox gText_PlayerFoundOneItem, MSGBOX_DEFAULT
msgbox gText_TooBadBagIsFull, MSGBOX_DEFAULT
setvar VAR_RESULT, 0
releaseall
end