collapse collapse

 Community


 User Info




Willkommen Gast. Bitte einloggen oder registrieren.

 Partnerseiten

rpgvx.net

Das Forum ist offline

Autor Thema: +[Improved & Special Move Commands]+  (Gelesen 2034 mal)

woratana

  • Gast
+[Improved & Special Move Commands]+
« am: März 25, 2008, 07:07:52 »
Improved & Special Move Commands
Version 1.0
by Woratana
Release Date: 20/03/2008


Introduction
This script will edit old move commands and add new move commands.
http://www.rpgrevolution.com/forums/?showt...792#entry130388
+[Improved & Special Move Commands]+ - RPG RPG Revolution Forums
It script will be good for minigame, ABS (for enemy's move route), or any system to do with move thing~ :)


Features
Version 1.0
- Here's the edited and new commands list~
Translated by OceanBlue
Sicherer Sprung: es wird nicht gesprungen, wenn der Zielpunkt außerhalb des Bildschirms oder ein nicht passierbares tile ist. (Der alte Sprung überprüft dies vor dem Sprung nicht.)
Verbesserte zufällige Bewegung: Bei zufälliger Bewegung wird die Richtung gefunden, die nicht geblockt wird. (Alte Bewegung: Ein Schritt in eine geblockte Richtung wird einfach übersprungen.)
Verbesserte Charakter-Kollisions-Abfrage: Events, die auf "Same as Characters" stehen, können nun über "Below characters"-events gehen.

Um neue Move-Commands zu verwenden, gehst du auf "Set mover route" und dann "script". Und dann eben:
? MOVE TOWARD POSITION X/Y (=In Richtung X/Y-Koordinate Bewegen)
move_toward_pos(x,y)

? MOVE AWAY FROM POSITION X/Y (=Von X/Y-Koordinate Wegbewegen)
move_away_from_pos(x,y)

? MOVE TOWARD EVENT ID (=In Richtung Event-ID bewegen)
move_toward_event(id)

? MOVE AWAY FROM EVENT ID (=Von Event-ID wegbewegen)
move_away_from_event(id)

? TURN TOWARD POSITION X/Y (=In Richtung X/Y drehen)
turn_toward_pos(x,y)

? TURN AWAY FROM POSITION X/Y (Von X/Y wegdrehen)
turn_away_from_pos(x,y)

? TURN TOWARD EVENT ID (Zu Event-ID drehen)
turn_toward_event(id)

? TURN AWAY FROM EVENT ID (Von Event-ID wegdrehen)
turn_away_from_event(id)

?=====?=====?=====?=====?=====?=====?=====?=====?=====?
                   + COMMANDS LIST +
?=====?=====?=====?=====?=====?=====?=====?=====?=====?
################################
? IMPROVED MOVE COMMANDS ?

? SAFE JUMP:
Don't Jump if its destination is OUT OF THE SCREEN (or) NOT PASSABLE.
(Old jump will not check before jump)

? IMPROVED RANDOM MOVE
Find the movable direction before move.
(Old random move will just skip to move in that frame, if its destination is not passable.)

? IMPROVED COLLIDE_WITH_CHARACTERS CHECK
'Same as Characters' events are able to walk on other 'Below Characters' events.

? Note: If you don't want one of this improved command, just delete its part.
(I put all of their command name above their script part)
################################

################################
? SPECIAL(NEW) MOVE COMMANDS ?

++[HOW TO USE]++
? Open 'Move Route' window, (or event command 'Set Move Route')
Click 'Script...' and type the move command you want...

? MOVE TOWARD POSITION X/Y
move_toward_pos(x,y)

? MOVE AWAY FROM POSITION X/Y
move_away_from_pos(x,y)

? MOVE TOWARD EVENT ID
move_toward_event(id)

? MOVE AWAY FROM EVENT ID
move_away_from_event(id)

? TURN TOWARD POSITION X/Y
turn_toward_pos(x,y)

? TURN AWAY FROM POSITION X/Y
turn_away_from_pos(x,y)

? TURN TOWARD EVENT ID
turn_toward_event(id)

? TURN AWAY FROM EVENT ID
turn_away_from_event(id)
################################


Script
Place it above main
Spoiler for Hiden:
#===============================================================
# ? [VX] ? Improved & Special Move Commands ? ?
#--------------------------------------------------------------
# ? by Woratana [woratana@hotmail.com]
# ? Released on: 20/03/2008
# ? Version: 1.0
#--------------------------------------------------------------
=begin
?=====?=====?=====?=====?=====?=====?=====?=====?=====?
                   + COMMANDS LIST +
?=====?=====?=====?=====?=====?=====?=====?=====?=====?
################################
? IMPROVED MOVE COMMANDS ?

? SAFE JUMP:
Don't Jump if its destination is OUT OF THE SCREEN (or) NOT PASSABLE.
(Old jump will not check before jump)

? IMPROVED RANDOM MOVE
Find the movable direction before move.
(Old random move will just skip to move in that frame, if its destination is not passable.)

? IMPROVED COLLIDE_WITH_CHARACTERS CHECK
'Same as Characters' events are able to walk on other 'Below Characters' events.

? Note: If you don't want one of this improved command, just delete its part.
(I put all of their command name above their script part)
################################

################################
? SPECIAL(NEW) MOVE COMMANDS ?

++[HOW TO USE]++
? Open 'Move Route' window, (or event command 'Set Move Route')
Click 'Script...' and type the move command you want...

? MOVE TOWARD POSITION X/Y
move_toward_pos(x,y)

? MOVE AWAY FROM POSITION X/Y
move_away_from_pos(x,y)

? MOVE TOWARD EVENT ID
move_toward_event(id)

? MOVE AWAY FROM EVENT ID
move_away_from_event(id)

? TURN TOWARD POSITION X/Y
turn_toward_pos(x,y)

? TURN AWAY FROM POSITION X/Y
turn_away_from_pos(x,y)

? TURN TOWARD EVENT ID
turn_toward_event(id)

? TURN AWAY FROM EVENT ID
turn_away_from_event(id)
################################
=end
class Game_Character
  ##################################################################
  # IMPROVED MOVE COMMANDS
  ##################################################################
  #-------------------------------------------------------------
  # SAFE JUMP
  #-------------------------------------------------------------
  def jump(x_plus, y_plus)
    if x_plus.abs > y_plus.abs            # ??????????
      x_plus < 0 ? turn_left : turn_right
    elsif x_plus.abs > y_plus.abs         # ??????????
      y_plus < 0 ? turn_up : turn_down
    end
    new_x = @x + x_plus
    new_y = @y + y_plus
    if (x_plus == 0 and y_plus == 0) or passable?(new_x, new_y)
      @x += x_plus
      @y += y_plus
      distance = Math.sqrt(x_plus * x_plus + y_plus * y_plus).round
      @jump_peak = 10 + distance - @move_speed
      @jump_count = @jump_peak * 2
      @stop_count = 0
      straighten
    end
  end
  
  #-------------------------------------------------------------
  # IMPROVED RANDOM MOVE
  #-------------------------------------------------------------
  def move_random
    safe = false
    checked = []
    while safe == false
      break if checked.include?(0) and checked.include?(1) and
      checked.include?(2) and checked.include?(3)
      case rand(4)
      when 0; return if checked.include?(0); checked.push 0
        if passable?(@x, @y + 1)
          safe = true; move_down(false)
        end
      when 1; return if checked.include?(1); checked.push 1
        if passable?(@x - 1, @y)
          safe = true; move_left(false)
        end
      when 2; return if checked.include?(2); checked.push 2
        if passable?(@x + 1, @y)
          safe = true; move_right(false)
        end
      when 3; return if checked.include?(3); checked.push 3
        if passable?(@x - 1, @y)
          safe = true; move_up(false)
        end
      end
    end
  end
  
  #----------------------------------------------------------------------
  # IMPROVED COLLIDE_WITH_CHARACTERS CHECK
  #----------------------------------------------------------------------
  def collide_with_characters?(x, y)
    for event in $game_map.events_xy(x, y)          # Matches event position
      unless event.through                          # Passage OFF?
        return true if event.priority_type == 1     # Target is normal char
      end
    end
    if @priority_type == 1                          # Self is normal char
      return true if $game_player.pos_nt?(x, y)     # Matches player position
      return true if $game_map.boat.pos_nt?(x, y)   # Matches boat position
      return true if $game_map.ship.pos_nt?(x, y)   # Matches ship position
    end
    return false
  end
  
  ##################################################################
  # SPECIAL(NEW) MOVE COMMANDS
  ##################################################################
  #--------------------------------------------------------------------------
  # * Move toward Position
  #--------------------------------------------------------------------------
  def move_toward_pos(x,y)
    sx = distance_x_from_pos(x)
    sy = distance_y_from_pos(y)
    if sx != 0 or sy != 0
      if sx.abs > sy.abs                  # Horizontal distance is longer
        sx > 0 ? move_left : move_right   # Prioritize left-right
        if @move_failed and sy != 0
          sy > 0 ? move_up : move_down
        end
      else                                # Vertical distance is longer
        sy > 0 ? move_up : move_down      # Prioritize up-down
        if @move_failed and sx != 0
          sx > 0 ? move_left : move_right
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Move away from Position
  #--------------------------------------------------------------------------
  def move_away_from_pos(x,y)
    sx = distance_x_from_pos(x)
    sy = distance_y_from_pos(y)
    if sx != 0 or sy != 0
      if sx.abs > sy.abs                  # Horizontal distance is longer
        sx > 0 ? move_right : move_left   # Prioritize left-right
        if @move_failed and sy != 0
          sy > 0 ? move_down : move_up
        end
      else                                # Vertical distance is longer
        sy > 0 ? move_down : move_up      # Prioritize up-down
        if @move_failed and sx != 0
          sx > 0 ? move_right : move_left
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Move toward Event
  #--------------------------------------------------------------------------
  def move_toward_event(id)
    move_toward_pos($game_map.events[id].x,$game_map.events[id].y)
  end
  #--------------------------------------------------------------------------
  # * Move away from Event
  #--------------------------------------------------------------------------
  def move_away_from_event(id)
    move_away_from_pos($game_map.events[id].x,$game_map.events[id].y)
  end
  #--------------------------------------------------------------------------
  # * Turn toward Position
  #--------------------------------------------------------------------------
  def turn_toward_pos(x,y)
    sx = distance_x_from_pos(x)
    sy = distance_y_from_pos(y)
    if sx.abs > sy.abs                    # Horizontal distance is longer
      sx > 0 ? turn_left : turn_right
    elsif sx.abs < sy.abs                 # Vertical distance is longer
      sy > 0 ? turn_up : turn_down
    end
  end
  #--------------------------------------------------------------------------
  # * Turn away from Position
  #--------------------------------------------------------------------------
  def turn_away_from_pos(x,y)
    sx = distance_x_from_pos(x)
    sy = distance_y_from_pos(y)
    if sx.abs > sy.abs                    # Horizontal distance is longer
      sx > 0 ? turn_right : turn_left
    elsif sx.abs < sy.abs                 # Vertical distance is longer
      sy > 0 ? turn_down : turn_up
    end
  end
  #--------------------------------------------------------------------------
  # * Turn toward Event
  #--------------------------------------------------------------------------
  def turn_toward_event(id)
    turn_toward_pos($game_map.events[id].x,$game_map.events[id].y)
  end
  #--------------------------------------------------------------------------
  # * Turn away from Event
  #--------------------------------------------------------------------------
  def turn_away_from_event(id)
    turn_away_from_pos($game_map.events[id].x,$game_map.events[id].y)
  end
  #--------------------------------------------------------------------------
  # * Calculate X Distance From Event
  #--------------------------------------------------------------------------
  def distance_x_from_pos(x)
    sx = @x - x
    if $game_map.loop_horizontal?         # When looping horizontally
      if sx.abs > $game_map.width / 2     # Larger than half the map width?
        sx -= $game_map.width             # Subtract map width
      end
    end
    return sx
  end
  #--------------------------------------------------------------------------
  # * Calculate Y Distance From Event
  #--------------------------------------------------------------------------
  def distance_y_from_pos(y)
    sy = @y - y
    if $game_map.loop_vertical?           # When looping vertically
      if sy.abs > $game_map.height / 2    # Larger than half the map height?
        sy -= $game_map.height            # Subtract map height
      end
    end
    return sy
  end
end


Instruction
You just need to place the script above main, for edited old commands.

For special/new commands,
? Open 'Move Route' window, (or event command 'Set Move Route')
Click 'Script...' and type the move command you want...


Author's Notes
Free for use in your non-commercial work if credit included. If your project is commercial, please contact me.

Please do not redistribute this script without permission. If you want to post it on any forum, please link to this topic.
« Letzte Änderung: März 26, 2008, 05:28:34 von woratana »

+[Improved & Special Move Commands]+

Dimidimadmitri

  • Gast
+[Improved & Special Move Commands]+
« Antwort #1 am: März 25, 2008, 11:21:09 »
kann mir jemand auf Deutsch sagen was genau man da machen kann??

+[Improved & Special Move Commands]+

Offline OceanBlue

  • Palmenfan
  • VX-Großmeister
  • *****
  • Beiträge: 822
  • Back from the Dead
+[Improved & Special Move Commands]+
« Antwort #2 am: März 25, 2008, 11:33:47 »
Also, dieses Script verbessert einige Bewegungsfunktionen, nämlich:
Sicherer Sprung: es wird nicht gesprungen, wenn der Zielpunkt außerhalb des Bildschirms oder ein nicht passierbares tile ist. (Der alte Sprung überprüft dies vor dem Sprung nicht.)
Verbesserte zufällige Bewegung: Bei zufälliger Bewegung wird die Richtung gefunden, die nicht geblockt wird. (Alte Bewegung: Ein Schritt in eine geblockte Richtung wird einfach übersprungen.)
Verbesserte Charakter-Kollisions-Abfrage: Events, die auf "Same as Characters" stehen, können nun über "Below characters"-events gehen.

Um neue Move-Commands zu verwenden, gehst du auf "Set mover route" und dann "script". Und dann eben:
? MOVE TOWARD POSITION X/Y    (=In Richtung X/Y-Koordinate Bewegen)
move_toward_pos(x,y)

? MOVE AWAY FROM POSITION X/Y  (=Von X/Y-Koordinate Wegbewegen)
move_away_from_pos(x,y)

? MOVE TOWARD EVENT ID  (=In Richtung Event-ID bewegen)
move_toward_event(id)

? MOVE AWAY FROM EVENT ID  (=Von Event-ID wegbewegen)
move_away_from_event(id)

? TURN TOWARD POSITION X/Y  (=In Richtung X/Y drehen)
turn_toward_pos(x,y)

? TURN AWAY FROM POSITION X/Y  (Von X/Y wegdrehen)
turn_away_from_pos(x,y)

? TURN TOWARD EVENT ID  (Zu Event-ID drehen)
turn_toward_event(id)

? TURN AWAY FROM EVENT ID  (Von Event-ID wegdrehen)
turn_away_from_event(id)
« Letzte Änderung: März 25, 2008, 11:35:00 von OceanBlue »


+[Improved & Special Move Commands]+

Dimidimadmitri

  • Gast
+[Improved & Special Move Commands]+
« Antwort #3 am: März 25, 2008, 12:31:20 »
thx für die schnelle antwort

+[Improved & Special Move Commands]+

Dainreth

  • Gast
+[Improved & Special Move Commands]+
« Antwort #4 am: März 25, 2008, 17:41:15 »
Heey wora, nice to see you..and nice to see your new script! It's really useful, thanks for your work on it!

+[Improved & Special Move Commands]+

woratana

  • Gast
+[Improved & Special Move Commands]+
« Antwort #5 am: März 26, 2008, 05:25:54 »
Thanks, OceanBlue for the translation :)

I hope you don't mind if I put that in the first post.

+[Improved & Special Move Commands]+

Offline Goldenboss

  • Mr. MACK-Tile
  • ***
  • Beiträge: 251
    • http://www.goldenboss.de
+[Improved & Special Move Commands]+
« Antwort #6 am: März 26, 2008, 09:03:20 »
Hi woratana.

Thanks for your script.

But there is one big problem.
Events that are over the Player willnot move over non-passable tiles like e.g. water.


MfG Markus

+[Improved & Special Move Commands]+

ozzy2

  • Gast
+[Improved & Special Move Commands]+
« Antwort #7 am: März 26, 2008, 11:20:11 »
Thank you woratana for this script,
but events that are "over" cant walk through events that are "same as player" ...
i hope you fix it.

+[Improved & Special Move Commands]+

woratana

  • Gast
+[Improved & Special Move Commands]+
« Antwort #8 am: März 27, 2008, 07:07:03 »
It's not a bug, because the 'above character' events are normally cannot walk on 'same as character' events.

However, this is a good point and you can do that by:

Find this line:
return true if event.priority_type == 1     # Target is normal charChange it to:
return true if event.priority_type == 1 and @priority_type != 2

+[Improved & Special Move Commands]+

Offline Goldenboss

  • Mr. MACK-Tile
  • ***
  • Beiträge: 251
    • http://www.goldenboss.de
+[Improved & Special Move Commands]+
« Antwort #9 am: März 27, 2008, 11:53:31 »
There is one more problem:
When an Event which is above player moves to an border of the Map, it will not move any more.

+[Improved & Special Move Commands]+

woratana

  • Gast
+[Improved & Special Move Commands]+
« Antwort #10 am: März 28, 2008, 06:46:15 »
@Goldenboss

I'm not sure what do you mean by that, can you give me more description?

and, when you removed this script, is this bug still show up?

Thanks :)

+[Improved & Special Move Commands]+

Offline Goldenboss

  • Mr. MACK-Tile
  • ***
  • Beiträge: 251
    • http://www.goldenboss.de
+[Improved & Special Move Commands]+
« Antwort #11 am: März 30, 2008, 10:43:08 »
Hi,

when an Event which ist above the player comes to an end of the map, it will stuck and cannot move any more.

This error exists only with turned on script.

Greetings, Markus.

+[Improved & Special Move Commands]+

woratana

  • Gast
+[Improved & Special Move Commands]+
« Antwort #12 am: März 31, 2008, 21:55:56 »
Sorry, Goldenboss

Can you give me demo or screenshot for that problem?

I will see that bug and can fix it easier.

Thanks :)

 


 Bild des Monats

rooftop party

Views: 3138
By: papilion

 Umfrage

  • Wer soll das BdM gewinnen?
  • Dot Kandidat 1
  • 3 (25%)
  • Dot Kandidat 2
  • 1 (8%)
  • Dot Kandidat 3
  • 2 (16%)
  • Dot Kandidat 4
  • 0 (0%)
  • Dot Kandidat 5
  • 6 (50%)
  • Stimmen insgesamt: 12
  • View Topic

 Schnellsuche





SimplePortal 2.3.3 © 2008-2010, SimplePortal