Notice: fwrite(): Write of 483 bytes failed with errno=28 No space left on device in /home/rmrk/domains/rmrk.net/public_html/Sources/Cache/APIs/FileBased.php on line 96

Notice: fwrite(): Write of 59 bytes failed with errno=28 No space left on device in /home/rmrk/domains/rmrk.net/public_html/Sources/Cache/APIs/FileBased.php on line 96

Notice: fwrite(): Write of 1714 bytes failed with errno=28 No space left on device in /home/rmrk/domains/rmrk.net/public_html/Sources/Cache/APIs/FileBased.php on line 96

Notice: fwrite(): Write of 44 bytes failed with errno=28 No space left on device in /home/rmrk/domains/rmrk.net/public_html/Sources/Cache/APIs/FileBased.php on line 96

Notice: fwrite(): Write of 8192 bytes failed with errno=28 No space left on device in /home/rmrk/domains/rmrk.net/public_html/Sources/Cache/APIs/FileBased.php on line 96
Print Page - [XP] Script - How do I make a scripted move event to "Wait for Move's Completion

The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Scripting => Topic started by: Heretic86 on March 01, 2012, 12:41:15 PM

Title: [XP] Script - How do I make a scripted move event to "Wait for Move's Completion
Post by: Heretic86 on March 01, 2012, 12:41:15 PM
I'll keep it short.  Got a script I wrote.  Messing directly with @event.move_route, the stuff I am sending to it works fine, dynamic moves.  Called from an Event Script.  After that, I try to put in a "Wait for Move's Completion" (remember XP not VX), and it immediatly recoginzes as that event has completed its move.  I figure a simple flag @move_route_forcing = true, but that makes the event stop moving around.

...huh?
Title: Re: [XP] Script - How do I make a scripted move event to "Wait for Move's Completion
Post by: modern algebra on March 02, 2012, 12:43:45 AM
Well, I don't know why you would need to force a move route through a script in a call event instead of just using the set move route event command, but you might find it helpful to take a look at the Interpreter class. In Interpreter 5, you will see:



  #--------------------------------------------------------------------------
  # * Set Move Route
  #--------------------------------------------------------------------------
  def command_209
    # Get character
    character = get_character(@parameters[0])
    # If no character exists
    if character == nil
      # Continue
      return true
    end
    # Force move route
    character.force_move_route(@parameters[1])
    # Continue
    return true
  end
  #--------------------------------------------------------------------------
  # * Wait for Move's Completion
  #--------------------------------------------------------------------------
  def command_210
    # If not in battle
    unless $game_temp.in_battle
      # Set move route completion waiting flag
      @move_route_waiting = true
    end
    # Continue
    return true
  end


Once you understand that and what that all does in Game_Character and in other parts of Interpreter, I think you will see where you are going wrong. Consider your basic event - you can set the event's autonomous movement for each page of an event, and then you can force the event to deviate from that autonomous movement with a Set Move Route command. If you use the "Wait for Move's Completion" event command, then it waits for move routes you set through Set Move Route event commands, but it doesn't wait for every event to complete their autonomous move routes. Therefore, if you want to make use of the "Wait for Move's Completion" code, then you want to use the event's force_move_route method, not edit their autonomous move route directly. (The force_move_route method essentially just saves the original move route and executes the forced move route, and then there are other methods which restore the original move route once the forced move route is executed).
Title: Re: [XP] Script - How do I make a scripted move event to "Wait for Move's Completion
Post by: Heretic86 on March 02, 2012, 09:40:55 AM
Thank you!  That is exactly what I am going to do. 

And it worked!  To explain why, working with a Caterpillar, and only want the events in the Caterpillar to do something.  The Caterpillar isnt dependant on Event.ID, so map 1 could have the Caterpillar Event.ID's different than map 2.  The thing I was working on moves only the Events in the Caterpillar (which can vary) the way I wanted to make them move.

I am having a little trouble with Command_29 (Set Speed), cant seem to get it to work...
route_to_force.list.unshift(RPG::MoveCommand.new(29, speed)) if code != 0 and speed != nil

Speed is just an Int apparetly, not a Speed.new, well, I think

Could someone explain why that appears to set the speed to the lowest possible setting regardless of what the speed is?