I've created the Status Ailment, Homesick, in my game. I'm trying to make it so that after a certain amount of time (or alternatively after a battle if you think that would be easier), these three characters I've got can randomly get it. I'd like to know how to accomplish this.
Timing of Status Ailments
RPG Maker VXAce SupportIf you want it to be given after a certain ammount of time you could create a parallel process event that starts when a certain switch far_from_home is ON and you store the time played until then into a variable. After that the event keeps running and when the time played goes above a certain value you add that status aliment to the character you want to have it.
If you want a more random approach you can do it via event by giving a variable a random value and add it to the ammount of time needed to add the statu aliment. This way every time the player leaves his home the status aliment will occurr at after a different ammount of time.
If you want a more random approach you can do it via event by giving a variable a random value and add it to the ammount of time needed to add the statu aliment. This way every time the player leaves his home the status aliment will occurr at after a different ammount of time.
Storing playtime can be achieved via the Control Variable command.
Control Variable -> select variable, then check "Set" and select Game Data.
The window will look like this one and you can select Play Time like in the screenshot.
EDIT:
In the end your event when leaving home should look like this:
While your common event should be more like this one:
Take note that I used two different variables: one to store played time then the player leaves from home and one to store played time every time the parallel process runs.
EDIT 2:
I didn't notice you asked how it looks in the script. If you want to do it with a scriptcall then you can use a single variable.
Control Variable -> select variable, then check "Set" and select Game Data.
The window will look like this one and you can select Play Time like in the screenshot.
EDIT:
In the end your event when leaving home should look like this:
While your common event should be more like this one:
Take note that I used two different variables: one to store played time then the player leaves from home and one to store played time every time the parallel process runs.
EDIT 2:
I didn't notice you asked how it looks in the script. If you want to do it with a scriptcall then you can use a single variable.
Code:
#this is your event when leaving home
$game_variables[variable_number] = $game_system.playtime_s #variable_number is the variable you want to store playtime in
$game_switches[switch_number] = true #switch_number is the switch you want to use to trigger the parallel process
#this is your paralle process event
if (($game_system.playtime_s - $game_variables[variable_number]) > x)
$game_actors[id].add_state(state_number) #id is the actor id that should be affected by your state. state_number is your state number
end
If I am not wrong yes, they are seconds. And my 100 was a random value anyway. You can change it to fit your needs.
@metalmario991 please do not quote whole posts to indicate who you are replying to, this makes the page slow to load especially for those who are accessing this on their phones. If you want to make it clear who you are replying to use the @username convention as I have done with this post.
Original thread: https://forums.rpgmakerweb.com/threads/timing-of-status-ailments.69741/


