[RMVXAce] Move Route Script Call Won't Toggle Self Switches

● ARCHIVED · READ-ONLY
Started by GreenBanana 9 posts View original ↗
  1. Issue:

    When using "Call Script" from within a "Set Move Route" or "Custom Move Route" function in an Event, Self Switches cannot be manipulated.

    Ordinarily, to set an event's self switch "A" to true using the scripting language, you use the following code:

    $game_self_switches[[@map_id, @event_id, "A"]] = trueIn the aforementioned case, this script is not called.

    Example:

    Upon interacting with an Event, there is a chance for it to become a treasure that's available for a limited time. If the player uses the Action button with the treasure in the given time, he receives the treasure. Otherwise, the treasure reverts to its previous Event state.

    In theory, by using the Custom Move Route for the treasure event, the event can be set to wait a certain number of frames in its route before turning its Self Switch "A" off.
  2. Are you using it exactly as you've posted it? That would not work outside of Game Interpreter. You need to replace @map_id and @event_id with calls that would work from Game_Event. I believe the calls would be $game_map.map_id and id.
  3. Yato said:
    Are you using it exactly as you've posted it? That would not work outside of Game Interpreter. You need to replace @map_id and @event_id with calls that would work from Game_Event. I believe the calls would be $game_map.map_id and id.
    Map is either @map_id (for the current map) or a number without leading zeros for a map other than the current one

    event is either @event_id (for the current event) or a number for an event other than the current one (EV001 would be 1)

    self_switch is 'A', 'B', 'C' or 'D' (must have the single or double quotes)

    value is either true or false
  4. That assumes you're using the script command from the third page of event commands. There is a difference between that one and one in a move route. The numbers thing does apply to this case though. I tested the $game_map.map_id and id, and it works fine.

    Code:
    $game_self_switches[[$game_map.map_id, id, "A"]] = true
    will work from a move route.
  5. The link you provided is for script calls that are the equivalent of event commands. There IS no event command to set self switches within a move route.


    When you use the Script command (third tab), it is Game_Interpreter that runs it. It knows about @map_id and @event_id.


    When you use the Script command within a move route, it is Game_Character that runs it. It does not know about @map_id and @event_id as those belong to a different class.


    Doing what Yato says will work within a move route.
  6. @map_id is than $game_map.map_id

    but what do we use for this?

    @event_id  ??? for this event event id?
  7. If it's a specific event, why not just use the map id and event id directly (since you know it anyway)?


    And yeah, try Yamato's, that might be working.
  8. Edit:

    I found a Solution for the self Event Id.

    $game_self_switches[[$game_map.map_id,self.id , "A"]] = true

    self.id works :) lucky me with trial and error.
  9. @id would work too