[RESOLVED] Backward controls

Started by darklight, March 14, 2008, 01:40:52 pm

Previous topic - Next topic

darklight

March 14, 2008, 01:40:52 pm Last Edit: March 14, 2008, 01:52:07 pm by darklight
OK, so for one of the dungeons I'm working on, the controls are reversed using an event. So if you press up, the character heads down, etc. While the direction part works, the player takes two steps instead of just one, and after trying to figure it out for a while, I am stumped.

If I add a wait for event completion command, the character will just go back and forth in two directions for as long as the button is pressed. A wait x frames command will correct the direction, which I don't want. Any clue how I can fix this, guys?

For reference, this is how the event is set up:

Spoiler: ShowHide

The demo release has been pushed back. In the meantime, you can check out my resources thread.
I'm also working on the project site - stay tuned for a launch very soon!

fugibo

March 15, 2008, 11:27:31 am #1 Last Edit: March 15, 2008, 12:31:43 pm by WcW
Give me a sec and I'll just write you a script for this...

EDIT:

After having Blizz explain to me how to make it compatible with BlizzABS, here it is:

#============================================================================
# Backwards Character Movement
# v 1.00
#
# by WcW
#
# Credits: Blizzard, for optimizing the code when I didn't ask :P
#
# This script lets you make the player go reverse of the buttons. For example,
# when your unsuspecting user press up, they go down, and vice-versa.
# To activate this script, in an event have the call script command
#   $game_temp.going_backwards = true
# To turn it off, change the "true" in the call script to "false".
#
# WARNING: If you use this with Blizz's caterpillar script, be ready --
#          you're in for a nasty surprise.
#============================================================================

#----------------------------------------------------------------------------
# * Game Temp
#----------------------------------------------------------------------------
class Game_Temp
  attr_accessor :going_backwards
  #--------------------------------------------------------------------------
  # * Initialize
  #--------------------------------------------------------------------------
  alias init_backwards_people_later initialize
  def initialize
    @going_backwards = false
    init_backwards_people_later
  end
end

#----------------------------------------------------------------------------
# * Game Character
#----------------------------------------------------------------------------
class Game_Character
  alias move_down_backwards_later move_down
  alias move_left_backwards_later move_left
  alias move_right_backwards_later move_right
  #--------------------------------------------------------------------------
  # * Inverted?
  #--------------------------------------------------------------------------
  def inverted?
    return $game_temp.going_backwards && self == $game_player
  end
  #--------------------------------------------------------------------------
  # * Move Up
  #--------------------------------------------------------------------------
  alias move_up_backwards_later move_up
  def move_up(arg = true)
    return (inverted? ? move_down_backwards_later : move_up_backwards_later)
  end
  #--------------------------------------------------------------------------
  # * Move Down
  #--------------------------------------------------------------------------
  def move_down(arg = true)
    return (inverted? ? move_up_backwards_later : move_down_backwards_later)
  end
  #--------------------------------------------------------------------------
  # * Move Left
  #--------------------------------------------------------------------------
  def move_left(arg = true)
    return (inverted? ? move_right_backwards_later : move_left_backwards_later)
  end
  #--------------------------------------------------------------------------
  # * Move Right
  #--------------------------------------------------------------------------
  def move_right(arg = true)
    return (inverted? ? move_left_backwards_later : move_right_backwards_later)
  end
end

darklight

March 15, 2008, 01:48:43 pm #2 Last Edit: March 15, 2008, 01:54:10 pm by darklight
+1 for you!

Thanks, WcW. Scripters really do rock. I could barely keep up w/ ActionScript 3, so I have mad respect for any scripters and programmers out there. Thanks again!  ;D

I have one question though. Is there a way to specify each directional pair between U/D and L/R, or to even re-assign buttons completely? I hope you get this:

in Room A:
U=D
D=U
L=L
R=R

in Room B:
U=U
D=D
L=R
R=L

in Room C:
U=L
R=D
L=U
D=R

And yes, I aim to make this dungeon very frustrating :P

The demo release has been pushed back. In the meantime, you can check out my resources thread.
I'm also working on the project site - stay tuned for a launch very soon!

fugibo

Welcome. Sorry I couldn't get it to work with Caterpillar, trust me it has some wierd effects.

darklight

Don't worry about it, I ended up not using Blizz-ABS in favor of a side-view CBS [Rye.jp's] instead.

The demo release has been pushed back. In the meantime, you can check out my resources thread.
I'm also working on the project site - stay tuned for a launch very soon!

fugibo

Here's v1.10, for TA:

#============================================================================
# Backwards Character Movement
# v 1.00
#
# by WcW
#
# Credits: Blizzard, for optimizing the code when I didn't ask :P
#
# This script lets you make the player go reverse of the buttons. For example,
# when your unsuspecting user press up, they go down, and vice-versa.
# To activate this script, in an event have the call script command
#   $game_temp.going_backwards = true
# To turn it off, change the "true" in the call script to "false".
#
# WARNING: If you use this with Blizz's caterpillar script, be ready --
#          you're in for a nasty surprise.
#============================================================================

#----------------------------------------------------------------------------
# * Game Temp
#----------------------------------------------------------------------------
class Game_Temp
  attr_accessor :going_backwards
  #--------------------------------------------------------------------------
  # * Initialize
  #--------------------------------------------------------------------------
  alias init_backwards_people_later initialize
  def initialize
    @going_backwards = false
    init_backwards_people_later
  end
end

#----------------------------------------------------------------------------
# * Game Character
#----------------------------------------------------------------------------
class Game_Character
  alias move_down_backwards_later move_down
  alias move_left_backwards_later move_left
  alias move_right_backwards_later move_right
  #--------------------------------------------------------------------------
  # * Inverted?
  #--------------------------------------------------------------------------
  def inverted?
    if self == $game_player
      return $game_temp.going_backwards
    elsif $BlizzABS && BlizzABS::VERSION >= 1.09
      return $game_temp.going_backwards &&
          BlizzABS.player.members.include?(self)
    elsif $tons_version != nil && $tons_version >= 3.8
      return $game_temp.going_backwards && $game_player.members.include?(self)
    end
    return false
  end
  #--------------------------------------------------------------------------
  # * Move Up
  #--------------------------------------------------------------------------
  alias move_up_backwards_later move_up
  def move_up(arg = true)
    return (inverted? ? move_down_backwards_later : move_up_backwards_later)
  end
  #--------------------------------------------------------------------------
  # * Move Down
  #--------------------------------------------------------------------------
  def move_down(arg = true)
    return (inverted? ? move_up_backwards_later : move_down_backwards_later)
  end
  #--------------------------------------------------------------------------
  # * Move Left
  #--------------------------------------------------------------------------
  def move_left(arg = true)
    return (inverted? ? move_right_backwards_later : move_left_backwards_later)
  end
  #--------------------------------------------------------------------------
  # * Move Right
  #--------------------------------------------------------------------------
  def move_right(arg = true)
    return (inverted? ? move_left_backwards_later : move_right_backwards_later)
  end
end

fugibo

Crap, I'll have to re-do the system. I should have this ready today or tomorrow, sorry about the wait =(

Aqua

Take your time about it; I'm in no rush.

darklight

lol, TerreAqua took the words outta my mouth.

The demo release has been pushed back. In the meantime, you can check out my resources thread.
I'm also working on the project site - stay tuned for a launch very soon!

Calintz

Yeah, this would be easy to make...Good job WcW...

darklight

Hey WCW, how's the script coming along?  ;)

The demo release has been pushed back. In the meantime, you can check out my resources thread.
I'm also working on the project site - stay tuned for a launch very soon!