Call a common event when actor state wears off

Hello all.


So how do you call a common event after a certain state inflicted on actor wears off?


After googling I find this thread here which somewhat covers my answer. However I don't know how to use the script posted by TsukiHime, specifically the script tag to call common event when/after the inflicted state wears off.





I'll really appreciate any help 🙂
A combination of lunatic states by Yanfly and the proper script call would be my first approach.






Could also be evented, but it would become a headache if more than a few battlers are involved.
Thanks for replying to my question but I do not have any knowledge about scripts so writing scripts is beyond me. Can you give more specific instructions?


For this case the inflicted state wears off after the actor/main characters walks 1000 steps and I want to trigger a common event when the inflicted state ends. 
I wrote a quick add-on for lunatic states...

Spoiler
#==============================================================================
#
# ▼ Yanfly Engine Ace - Lunatic States Package - Custom Effects
#
# -- Requires: YEA - Lunatic States v1.00+
#
#==============================================================================

$imported = {} if $imported.nil?
$imported["LSP-Custom"] = true

#==============================================================================
# ▼ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
#
# Install this script under YEA - Lunatic States.
#
#==============================================================================
# ▼ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
#
# This script requires YEA - Lunatic States v1.00+ to work. It must be placed
# under YEA - Lunatic States v1.00+ in the script listing.
#
#==============================================================================

if $imported["YEA-LunaticStates"]
class Game_BattlerBase

#--------------------------------------------------------------------------
# ● Lunatic States Package Effects - LSP Custom Effects
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#--------------------------------------------------------------------------
alias lunatic_state_extension_lsp11 lunatic_state_extension
def lunatic_state_extension(effect, state, user, state_origin, log_window)
case effect.upcase
#----------------------------------------------------------------------
# Call Common Event
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
# Recommended Notetags:
# <leave effect: common_event x>
# <erase effect: common_event x>
#----------------------------------------------------------------------
when /COMMON_EVENT[ ](\d+)/i
$game_temp.reserve_common_event($1.to_i)
#----------------------------------------------------------------------
# Stop editting past this point.
#----------------------------------------------------------------------
else
so = state_origin
lw = log_window
lunatic_state_extension_lsp11(effect, state, user, so, lw)
end
end

end # Game_BattlerBase
end # $imported["YEA-LunaticStates"]

#==============================================================================
#
# ▼ End of File
#
#==============================================================================



Add one of those notetags to the note box of the desired state. Replace x with the id of the common event you want to be called.


If you're not sure what the differences are between leave effect and erase effect, check the header of the original Lunatic States script.
Install this script under YEA - Lunatic States.

So what do you mean by this? Paste the add on script into YEA - Lunatic States script itself or paste into a different slot under YEA - Lunatic States script?


I did the latter but it doesn't seem to work.

Spoiler
Untitled.png


Untitled.png


Untitled2.png
Sorry for bumping but can you please give my screenshots a look to see what I did wrong?
Went to sleep after my last reply... it's 5am.


Anyway, your setup isn't the issue. The script works in battle but not on the map.


Unfortunately, the reasoning behind this isn't obvious. I'll let you know if I figure it out.


In the meantime, I suggest exploring other options, just in case.
If anyones interested, I use Yanfly's <Custom Apply Effect>
and <Custom Remove Effect> for this.

It's in his plugin; YEP.50 – Buffs & States Core

cedr777, please refrain from necro-posting in a thread. Necro-posting is posting in a thread that has not had posting activity in over 30 days. You can review our forum rules here. Thank you.



Closing this.

Original thread: https://forums.rpgmakerweb.com/threads/call-a-common-event-when-actor-state-wears-off.68234/