- 55
- Posts
- 2
- Years
- Seen yesterday
What would I have to change so that a trainer rematch will happen when the trainer sees you (like normal encounters) rather than having to go up and talk to the trainer?
What would I have to change so that a trainer rematch will happen when the trainer sees you (like normal encounters) rather than having to go up and talk to the trainer?
src/trainer_see.c
. Seems like a good file to look into for that sort of thing.I would suggest looking intosrc/trainer_see.c
. Seems like a good file to look into for that sort of thing.
My overall plan is to make it so that all Gym Trainers must be fought again when you reenter a Gym unless you have defeated the Gym Leader as normal. But that seems to be a completely different aspect again.
You don't need any kind of custom rematch through sight code to do that. Just add a map script in the gym that checks if you've defeated the leader, and if you haven't, clear the trainer flags of the trainers in the gym so that they can be fought again.
Yeah, you could do a loop that clears only the trainers you want to clear and that breaks out after the task has been accomplished.I didn't even know that was a thing, thanks for that. I got it working. Though is there a way to have it apply to all trainers at once or do I need to put a clearflag line for each individual trainer in the gym?
MapThatExists_MapScripts::
map_script MAP_SCRIPT_ON_TRANSITION, MapThatExists_OnTransition
.byte 0
MapThatExists_OnTransition:
setvar VAR_TEMP_1, TRAINER_NONE + 1
cleartrainerflag VAR_TEMP_1
call MapThatExists_OnTransition_TrainerFlagLoop
end
MapThatExists_OnTransition_TrainerFlagLoop:
addvar VAR_TEMP_1, 1
cleartrainerflag VAR_TEMP_1
goto_if_ne VAR_TEMP_1, TRAINERS_COUNT, MapThatExists_OnTransition_TrainerFlagLoop
return
VAR_TEMP_1
, a temporary variable, to host trainer flag values that are cleared thanks to the cleatrainerflag
scripting command through an ON_TRANSITION Map Script.cleartrainerflag
you clear the next trainer flag.special
to handle it though, depending on what usage you wanna give it.Rustborocity_Gym_OnTransition:
setvar VAR_TEMP_1, TRAINER_JOSH
call_if_unset FLAG_RECEIVED_TM39, RustboroCity_Gym_OnTransition_TrainerFlagLoop
end
RustboroCity_Gym_OnTransition_TrainerFlagLoop:
cleartrainerflag VAR_TEMP_1
addvar VAR_TEMP_1, 1
goto_if_ne VAR_TEMP_1, TRAINER_TOMMY + 1, RustboroCity_Gym_OnTransition_TrainerFlagLoop
return
It should. Modifying/replacing the values of theirAlso, how do I go about changing the order of trainers for this purpose? I noticed sometimes trainers in a gym will be at different points in a list. Hiker Marc is at the end of trainers.h but moving him between Josh and Tommy didn't seem to solve the issue.
TRAINER_
labels at include/constants/opponents.h
should absolutely modify their positions in memory.It should. Modifying/replacing the values of theirTRAINER_
labels atinclude/constants/opponents.h
should absolutely modify their positions in memory.
It should be perfectly safe, in theory.Before I start altering anything, will changing the order of Opponents affect anything else in the game or is it safe to move things around?