How do map scripts work? I can't really figure it out by looking at other maps and all my tests end in a black screen when i enter the map.
Thanks in advance
#define MAP_SCRIPT_ON_LOAD 1 // Stuff that player isn't supposed to see, like setmaptiles
#define MAP_SCRIPT_ON_FRAME_TABLE 2 // Runs after fadein finishes
#define MAP_SCRIPT_ON_TRANSITION 3
#define MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE 4 // Runs before fadein finishes
#define MAP_SCRIPT_ON_RESUME 5
#define MAP_SCRIPT_ON_DIVE_WARP 6
#define MAP_SCRIPT_ON_RETURN_TO_FIELD 7
You can try looking at this one as base, it has two types of scripts. One loading before transition and one after: https://pastebin.com/raw/YfS3twh3
Also this:
Code:#define MAP_SCRIPT_ON_LOAD 1 // Stuff that player isn't supposed to see, like setmaptiles #define MAP_SCRIPT_ON_FRAME_TABLE 2 // Runs after fadein finishes #define MAP_SCRIPT_ON_TRANSITION 3 #define MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE 4 // Runs before fadein finishes #define MAP_SCRIPT_ON_RESUME 5 #define MAP_SCRIPT_ON_DIVE_WARP 6 #define MAP_SCRIPT_ON_RETURN_TO_FIELD 7
Is givepcitem <item>, <quantity> still a valid command? I'm gettingwhen I compile.Code:Error: bad instruction `givepcitem 254,1'
addpcitem
now, based on asm/macros/event.inc
.It's probably calledaddpcitem
now, based onasm/macros/event.inc
.
takeitem
doesn't work, try removeitem
and vice-versa.Heres what my script looks like that has the drawmonpicdata/maps/LittlerootTown/scripts.inc:1082: Error: bad instruction `drawmonpic 147,10,3'
data/maps/LittlerootTown/scripts.inc:1087: Error: bad instruction `erasemonpic'
Script_OgSS_1::
lock
faceplayer
goto_if_set FLAG_UNUSED_0x2BB , Script_OgSS_Off
goto_if_set FLAG_UNUSED_0x2BA , Script_OgSS_Off
drawmonpic SPECIES_DRATINI, 10, 3
msgbox Text_OgSS_1_YN, MSGBOX_YESNO
compare VAR_RESULT, 0
goto_if_eq Script_TakePkmn_1_No
goto_if_ne Script_TakePkmn_1_Yes
erasemonpic
release
end
At some point after Avara wrote this tutorial, those commands were renamed. In Pokeemerald, they'reWhen i try to draw a sprite on screen i get a compiler error
data/maps/LittlerootTown/scripts.inc:1082: Error: bad instruction `drawmonpic 147,10,3'
data/maps/LittlerootTown/scripts.inc:1087: Error: bad instruction `erasemonpic'
Heres what my script looks like that has the drawmonpic
Script_OgSS_1::
lock
faceplayer
goto_if_set FLAG_UNUSED_0x2BB , Script_OgSS_Off
goto_if_set FLAG_UNUSED_0x2BA , Script_OgSS_Off
drawmonpic SPECIES_DRATINI, 10, 3
msgbox Text_OgSS_1_YN, MSGBOX_YESNO
compare VAR_RESULT, 0
goto_if_eq Script_TakePkmn_1_No
goto_if_ne Script_TakePkmn_1_Yes
erasemonpic
release
end
showmonpic
and hidemonpic
now.Route104_EventScript_ItemPokeBall:: @ 8290D0C
finditem ITEM_POKE_BALL
end
Actually, I just found where they are!
*\data\scripts\item_ball_scripts.inc
Do I need to define them here or is it okay for them to hang out in the map script files?
How do I tell the game to start a double battle when you're in sight of two trainers at once?
Script_HourDemonstration::
lock
faceplayer
gettime
compare VAR_0x8000, 4
goto_if_le Script_Night
compare VAR_0x8000, 12
goto_if_lt Script_Morning
compare VAR_0x8000, 18
goto_if_ge Script_Night
msgbox Text_Day, MSGBOX_DEFAULT
release
end
Script_Morning::
msgbox Text_Morning, MSGBOX_DEFAULT
release
end
Script_Night::
msgbox Text_Night, MSGBOX_DEFAULT
release
end
Text_Morning:
.string "Good morning.$"
Text_Day:
.string "Good day.$"
Text_Night:
.string "Good evening.$"
playfanfare [Label]
waitfanfare
playfanfare MUS_OBTAIN_BADGE
waitfanfare
playse [Label]
...
playse SE_PIN
applymovement OBJ_EVENT_ID_PLAYER, Movement_ResidenceHalls_Dorm_Exclamation
waitmovement 0
...
Movement_Exclamation:
emote_exclamation_mark
step_end