What I am trying to achieve is when an Actor's TP reaches 100 it will call a common event. How would I achieve this effect with VisuStella's State and Skill Core?
MZ - Have State call Common Event
RPG Maker MZ SupportI'm presuming you only want this event to run one time when the actor hits 100 TP, then not again until they've spent some TP and gotten back up to 100.
Use Skills and States to give the actor a passive state.
In the passive state, put the Battle Core notetag:
Replace instances of switchId and eventId with appropriate IDs from your database, no leading zeros.
Use Skills and States to give the actor a passive state.
In the passive state, put the Battle Core notetag:
Code:
<JS Post-End Action>
if (user.tp==100 && !$gameSwitches.value(switchId))
{
$gameTemp.reserveCommonEvent(eventId);
$gameSwitches.setValue(switchId, true);
}
else if (user.tp<100 && $gameSwitches.value(switchId))
$gameSwitches.setValue(switchId, false);
</JS Post-End Action>
Replace instances of switchId and eventId with appropriate IDs from your database, no leading zeros.
Thanks it worked like a charm.
I know this is unrelated to the thread but it's similar, but how do run a common event once a state expires.
I know this is unrelated to the thread but it's similar, but how do run a common event once a state expires.
If you read the instructions for the Skills and States Core, you'll find a notetag for that. You use the exact reserveCommonEvent() to call the event that I posted above.
So I would set the code up like this. (Note: I am not using TP to run this second common event.
*Edit* this method worked.
<JS On Expire State>
if (!$gameSwitches.value(7))
{
$gameTemp.reserveCommonEvent(42);
$gameSwitches.setValue(7, true);
}
else if ($gameSwitches.value(7))
$gameSwitches.setValue(7, false);
</JS On Expire State>
if (!$gameSwitches.value(7))
{
$gameTemp.reserveCommonEvent(42);
$gameSwitches.setValue(7, true);
}
else if ($gameSwitches.value(7))
$gameSwitches.setValue(7, false);
</JS On Expire State>
*Edit* this method worked.
Original thread: https://forums.rpgmakerweb.com/threads/mz-have-state-call-common-event.157017/