- 3
- Posts
- 2
- Years
- Seen Mar 21, 2023
been using the pret disassembly of firered to make some changes to the game.
ive got to a point where i write a value into a temp variable and attempting to pass that variable to a function that is expecting a literal value.
for example, setwildbattle is normally used like this
and since setwildbattle is defined like this in c
it will try to use the variable index as the species id.
my question, is there any way to pass the value stored in a variable to a function from script that would not require writing a new function in c that calls VarGet with the variable index?
ive looked through the source and havent noticed anywhere this is actually done so i wouldnt be surprised if i have to keep my initial solution of just writing a new function, but still curious.
ive got to a point where i write a value into a temp variable and attempting to pass that variable to a function that is expecting a literal value.
for example, setwildbattle is normally used like this
but if you did something like thissetwildbattle SPECIES_SNORLAX, 30
Code:
setvar VAR_TEMP_0, SPECIES_SNORLAX
setwildbattle VAR_TEMP_0, 30
Code:
bool8 ScrCmd_setwildbattle(struct ScriptContext * ctx)
{
u16 species = ScriptReadHalfword(ctx);
u8 level = ScriptReadByte(ctx);
u16 item = ScriptReadHalfword(ctx);
CreateScriptedWildMon(species, level, item);
return FALSE;
}
my question, is there any way to pass the value stored in a variable to a function from script that would not require writing a new function in c that calls VarGet with the variable index?
ive looked through the source and havent noticed anywhere this is actually done so i wouldnt be surprised if i have to keep my initial solution of just writing a new function, but still curious.