Hey guys
I am trying to edit Yanfly Chase Event so I can change event page based on whether the event is chasing the player or not. Why would I need to do this? My project has a boatload of parallel process events on enemies to control their ai. Because of this, I had to create a way to put those parallel processes to sleep when they are not needed or when they are not chasing the player around. So, I made the event have two states, a sleep state and an a wake state. I thought if I could embed a way to change an event’s self-switch inside of the “Chase Event” methods I could then effectively swap to a separate page for the event doing the chasing. Of course, that is easy said than done.
This is what I came up with so far, (and right now it doesn’t really do anything). This I just a fragment of the whole script. Also, I am by no means a scripter so I probably did it wrong anyway xD.
I am trying to edit Yanfly Chase Event so I can change event page based on whether the event is chasing the player or not. Why would I need to do this? My project has a boatload of parallel process events on enemies to control their ai. Because of this, I had to create a way to put those parallel processes to sleep when they are not needed or when they are not chasing the player around. So, I made the event have two states, a sleep state and an a wake state. I thought if I could embed a way to change an event’s self-switch inside of the “Chase Event” methods I could then effectively swap to a separate page for the event doing the chasing. Of course, that is easy said than done.
This is what I came up with so far, (and right now it doesn’t really do anything). This I just a fragment of the whole script. Also, I am by no means a scripter so I probably did it wrong anyway xD.
Code:
▼ Yanfly Engine Ace - Event Chase Player v1.00$imported = {} if $imported.nil?$imported["YEA-EventChasePlayer"] = truemodule YEA module EVENT_CHASE #Stuff that is not relevant…. end # EVENT_CHASEend # YEAclass Game_Event < Game_Character #-------------------------------------------------------------------------- # alias method: update_self_movement #-------------------------------------------------------------------------- alias game_event_update_self_movement_ecp update_self_movement def update_self_movement return if $imported["YEA-StopAllMovement"] && Switch.stop_npc_movement update_chase_distance update_flee_distance if @stop_count > 0 && @chase_player move_type_toward_player $game_map.events[@event_id].instance_eval("@self_switches = 1") #The edit I am trying to make work. elsif @stop_count > 0 && @flee_player move_type_away_player else game_event_update_self_movement_ecp end update_alert_balloon endend # Game_Event