Oh, I see! It is possible to make effects that are timed or based on a number of steps etc. I don't blame you for getting confused in the eventing, though. It might look a bit complicated, but it splits neatly into smaller concepts:
Spoiler: Event structure
- Parallel event
Code:
◆Comment:Do stuff here!
◆Comment:--------------------------------------------------
◆Comment:Wait 6 frames (i.e. do the stuff 10 times per second)
◆Wait:6 frames
- Have a Parallel event that does stuff once every X frames, using a Wait command.
- If it applies to all maps, make it a Common Event (defined in the database).
If it only applies to one map, make it a map event.
- Note that you can check multiple things in the same event~
- Long timers
Code:
◆Comment:Initialise time variable!
◆Control Variables:#0020 Time = 30
Code:
◆Comment:Is there time left on this timer?
◆If:Time > 0
◆Comment:-1 from timer value
◆Control Variables:#0020 Time -= 1
◆Comment:Has time expired?
◆If:Time ≤ 0
◆Comment:OK, do the timeout thing here!
◆
:End
◆
:End
- You could do "Wait 180 frames" or something. That's generally a bad idea, though: Parallel events reset when the player changes maps, plus you'd need separate events for each timer.
- Instead, I recommend using a variable, and ticking down that variable every X frames in a Parallel event. If X is small compared to the total wait time, the potential "reset error" time will be insignificant.
- Note: if X = 6 frames, a value of 1 in the timer variable represents 6 frames of wait time.
- Other checks, e.g. step count
Code:
◆Comment:Initialise step count!
◆Control Variables:#0014 Hit Recovery Steps = 30
Code:
◆Comment:Get difference between stored step count and current value
: :(Variables start with value 0 by default.)
◆Control Variables:#0015 Step Count -= Steps
◆Comment:Check difference...
◆If:Step Count ≠ 0
◆Comment:Step count has changed!
: :Do the things!
◆
:End
◆Comment:Reset value to current step count, ready for the next check!
◆Control Variables:#0015 Step Count = Steps
- You can check other things in a similar way, e.g. step count.
You can get the step count via Control Variables > Game Data > Other > Steps.
- If a value has changed: the stored value and the current value will be different. I.e. if you subtract the current value from the stored value, the result will not be 0.
- You can then use a similar approach to what I mentioned for "long timers", above: -1 to the step counter each step and do something when the counter hits zero. 😤
So...putting that all together, you can add something like this when the player gets hit:
Code:
◆Control Variables:#0014 Hit Recovery Steps = 30
Then have a Parallel event to decrease the hit count variable every 30 steps, e.g.
Spoiler: Example Parallel event
Code:
◆Comment:Check difference between current step count and stored value (it's 0 on new game)[/INDENT]
[INDENT]◆Control Variables:#0015 Step Count -= Steps[/INDENT]
[INDENT]◆If:Step Count ≠ 0[/INDENT]
[INDENT] ◆Comment:Step count has changed since last check![/INDENT]
[INDENT] ◆Comment:--------------------------------------------[/INDENT]
[INDENT] ◆Comment:Is recovering from a hit?[/INDENT]
[INDENT] ◆If:Hit Recovery Steps > 0[/INDENT]
[INDENT] ◆Comment:-1 to this step counter![/INDENT]
[INDENT] ◆Control Variables:#0014 Hit Recovery Steps -= 1[/INDENT]
[INDENT] ◆Comment:Reached 0 (recovered)?[/INDENT]
[INDENT] ◆If:Hit Recovery Steps = 0[/INDENT]
[INDENT] ◆Comment:-1 to hit count! (+ balloon for visible feedback)[/INDENT]
[INDENT] ◆Control Variables:#0007 Count -= 1[/INDENT]
[INDENT] ◆Show Balloon Icon:Player, Music Note[/INDENT]
[INDENT] ◆Comment:Change speed to match new hit count~[/INDENT]
[INDENT] ◆If:Count = 0[/INDENT]
[INDENT] ◆Set Movement Route:Player (Wait)[/INDENT]
[INDENT] : :◇Speed:4[/INDENT]
[INDENT] ◆[/INDENT]
[INDENT] :Else[/INDENT]
[INDENT] ◆If:Count = 1[/INDENT]
[INDENT] ◆Set Movement Route:Player (Wait)[/INDENT]
[INDENT] : :◇Speed:3[/INDENT]
[INDENT] ◆[/INDENT]
[INDENT] :Else[/INDENT]
[INDENT] ◆Set Movement Route:Player (Wait)[/INDENT]
[INDENT] : :◇Speed:2[/INDENT]
[INDENT] ◆[/INDENT]
[INDENT] :End[/INDENT]
[INDENT] ◆[/INDENT]
[INDENT] :End[/INDENT]
[INDENT] ◆Comment:Count is still more than 0?[/INDENT]
[INDENT] ◆If:Count > 0[/INDENT]
[INDENT] ◆Comment:Reset hit recovery step counter![/INDENT]
[INDENT] ◆Control Variables:#0014 Hit Recovery Steps = 30[/INDENT]
[INDENT] ◆[/INDENT]
[INDENT] :End[/INDENT]
[INDENT] ◆[/INDENT]
[INDENT] :End[/INDENT]
[INDENT] ◆[/INDENT]
[INDENT] :End[/INDENT]
[INDENT] ◆Comment:--------------------------------------------[/INDENT]
[INDENT] ◆Comment:Can check other "on step" stuff here, too~[/INDENT]
[INDENT] ◆[/INDENT]
[INDENT]:End[/INDENT]
[INDENT]◆Comment:Store current step count for next check![/INDENT]
[INDENT]◆Control Variables:#0015 Step Count = Steps[/INDENT]
[INDENT]◆Comment:Check again in 6 frames (10 times per second)[/INDENT]
[INDENT]◆Wait:6 frames
Obviously you can replace the values as you like. Hope that made some sense!
🙏
If this seems like a lot of trouble to go to for "do stuff on step", there are plugins that let you cut corners here. E.g. I have a plugin called
Cae_StepSwitch that lets you automatically turn on a switch every step. You can bind this switch to a Parallel event, then make the event switch itself off at the end.
Lastly: states are typically for "per person" stuff, but this sounds like a "per party" idea, right? You could use states, but things might get awkward if, for example, the player can change the party leader or swap members in/out. That's why I suggested variables~
👋