Rogue-Like Movement / Chase Mode / Surprise Attack

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
182
First Language
Meowish
Primarily Uses
Saw a request here, and thought of putting up a script for it.

In case anyone needs it, i have it reposted here.

This script allows the rogue-like dungeon movement for events.

This means the event will move only when the player is moving. (can be turned on/off with switch)

Events can "hide" until player is close up in range, allowing surprise attack/chase.

Features:

  [1] Have the event move only when the player is moving
      (Controlled by switch)
  [2] Enemy remain half/fully hidden until the player is in range
      (Surprise attack anyone?)
  [3] Chase Mode, events will start chasing the player in range
      (Or runs away, you can even set your own AI)
  [4] Puts an exclamation mark on the event when chase starts
      (You get to choose the balloon)
  [5] Extra ENFORCED moveroute toward the player during chase
      (Go striaght for player when in chase range, do normal chase when not in range, do random move 
       when player is 10 mas away)
  [6] Chase Mode works for both rogue move/normal move
      (So you get to choose which one you like most, rogue or normal)

       


How to use:

  [1] Paste this script above Main and below Material

  [2] Add <enemy> tag in the event's name

      


  [3] Change the event's Autonomous Movement type to Approach

      


  [4] Turn the Switch on for rogue like move, off for normal move.

  
  = Run Away Enemy =
  ** If you set the move type to "custom" you can setup your own AI
  ** Use "Move away from Player" x 3, "Random move" x 1, "Move one step forward" x 1
  ** Check both repeat and ignore when unable to move tick boxes
  ** You should be able to make an event that runs away from the player this way

  = Hidden Enemy =

  ** If you wish to have your event enemies hidden until the player is close enough.

  ** In the script's setting area, set HIDE_OPACITY to 0

Compatiblity:

Should work with all scripts out there because everything is properly aliased.

Shouldn't be an issue unless someone creates a new method using the same name as this script does.

Terms of Use:

Have fun for both free and commercial use as long as credit is given. ;)

Update:

06-Oct: Added screenshot to show how transparent & "!" mark works

06-Sept: Added a switch control for chase mode

05-Sept: Just updated the script, forgot to remove a line during testing when i posted this, so chase isn't working properly for normal mode. Please use the new one.

04-Sept: Released

Code:
#==============================================================================# ■ Meow Face Rogue Chase System#------------------------------------------------------------------------------# Allow event to move only when the player is moving, Chase Mode, Hide Mode etc#==============================================================================# How to Use:# [1] Paste this script below Material and above Main# [2] Add <enemy> tag in the event's name# [3] Change the event's movement type to Approach# [4] Config the script to your likings at the configuration area# [5] Turn the Switch on for rogue like move, off for normal move in game# [6] Chase mode is now controlled by a switch as well#==============================================================================module MF_RogueMove #DO NOT REMOVE!#==============================================================================# START OF CONFIGURATION#==============================================================================    SW_ROGUE = 1 #Switch number for turning the rogue move on/off (0 to turn it off)  SW_CHASE = 2 #Switch number for turning the chase mode on/off (0 to turn it off)    DISTANCE = 5 #Distance for chase activation (1-10, 10 is about 640x640 pixels in screen size)    HIDE_OPACITY = 128 #Opacity of the enemy when player is not in range (0-255)    BALLOON = 1 # Pop-up Balloon type (1-10, 0 to turn it Off)    CHASE_SPEED = 4 # Enemy Speed when chasing the player (0-6)    CHASE_FREQUENCY = 6 # Enemy Move Frequency when chasing the player (0-6)    DEFAULT_SPEED = 4 # Enemy Move Speed when not chasing the player (0-6)    DEFAULT_FREQUENCY = 3 # Enemy Move Frequency when not chasing the player (0-6)  #==============================================================================# END OF CONFIGURATION# Edit anything pass this line at your own risk!#==============================================================================end #DO NOT REMOVE!#==============================================================================class Game_Event < Game_Character  #--------------------------------------------------------------------------  # ◎ Alias Move Type: Move Toward Player  #--------------------------------------------------------------------------  alias meowface_mttp move_type_toward_player  def move_type_toward_player    if @event.name.include?('<enemy>') && distance_from_player <= MF_RogueMove::DISTANCE      move_toward_player      else      meowface_mttp    end  end  #--------------------------------------------------------------------------  # ◎ Alias update movement  #--------------------------------------------------------------------------  alias meowface_stop update_stop  def update_stop    if $game_switches[MF_RogueMove::SW_ROGUE] && @event.name.include?('<enemy>')      super      return update_self_movement if $game_player.moving?    else      meowface_stop    end  end  #--------------------------------------------------------------------------  # ○ New method: Get the Distance between Event and Player  #--------------------------------------------------------------------------  def distance_from_player    distance_x_from($game_player.x).abs + distance_y_from($game_player.y).abs  end    #--------------------------------------------------------------------------  # ○ New method: Start Chasing the Player  #--------------------------------------------------------------------------  def chase_player      if distance_from_player <= MF_RogueMove::DISTANCE        self.balloon_id = MF_RogueMove::BALLOON        @opacity = 255         @move_speed = MF_RogueMove::CHASE_SPEED        @move_frequency = MF_RogueMove::CHASE_FREQUENCY      else        @opacity = MF_RogueMove::HIDE_OPACITY        @move_speed = MF_RogueMove::DEFAULT_SPEED        @move_frequency = MF_RogueMove::DEFAULT_FREQUENCY      end  end  #--------------------------------------------------------------------------  # ◎ Alias Update Method  #--------------------------------------------------------------------------  alias meowface_rg_update update  def update    if @event.name.include?('<enemy>') && !$game_map.interpreter.running?      chase_player if $game_switches[MF_RogueMove::SW_CHASE]    end    meowface_rg_update  endend
 
Last edited by a moderator:

matthew30903

Veteran
Veteran
Joined
Jun 29, 2014
Messages
82
Reaction score
31
First Language
English
Primarily Uses
This is a nice script, but is there a way to disable the Chase Mode mode? For example, I have an event system that controls enemy chasing and running so the event Chase Mode interfers with it. This would allow for very interesting puzzles using enemy's behavior.

Thank you for shairing this script.
 

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
182
First Language
Meowish
Primarily Uses
Script updated to add switch control for chase.

Please try the new one above.

The <enemy> tag is still needed for both/either to work though.
 

matthew30903

Veteran
Veteran
Joined
Jun 29, 2014
Messages
82
Reaction score
31
First Language
English
Primarily Uses
I will need to test the system some more, but it seems to be working perfectly. Such a simple system, but it adds so many posibilities.

Thank you.
 

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
182
First Language
Meowish
Primarily Uses
I am glad you find it useful! ;)
 

Yangfly Master

Jack of All Trades, you know, the Lone Wolf.
Veteran
Joined
Sep 9, 2014
Messages
324
Reaction score
68
First Language
Portuguese
Primarily Uses
RMVXA
OMFG!

I was fockin needin this, dude!

Thanks u!
 

lostdragon

Veteran
Veteran
Joined
Dec 23, 2014
Messages
39
Reaction score
6
First Language
English
Primarily Uses
This is pretty interesting.

To simulate roguelike movement where 1 player movement is 1 monster movement I tried putting the creatures events at highest frequency and normal movement.  For some reason that allows them to immediately move 2 squares (before the player has even moved).

I was not able to find a combination that allowed for a one to one parity for movement.

(edit)  In further testing with multiple opponents I'm not sure it really matters.  A player is going to get caught at that frequency and speed unless they are careful.

(edit 2)  I forgot to turn on the chase switch.  Now the monsters are relentless.  Perfect!

I really like it.

Nice job.
 
Last edited by a moderator:

exel.exe

Veteran
Veteran
Joined
Feb 7, 2014
Messages
67
Reaction score
18
First Language
español
Primarily Uses
great script man!! i like to see if you gonna work it up more in the future, also i tested in falcao liquid v3 and it isn´t working properly

team members are not affected by the script and act as normally in the falcao system.

 well thats all i see so far once more great script. (sorry bad english) :D
 

lostdragon

Veteran
Veteran
Joined
Dec 23, 2014
Messages
39
Reaction score
6
First Language
English
Primarily Uses
Is there a way to give the player character a sort of turn-based feel movement?

I don't want them to have to press an arrow key for every step but it would be a neat look if the player character paused for 10 frames or something per tile.  
 

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
182
First Language
Meowish
Primarily Uses
great script man!! i like to see if you gonna work it up more in the future, also i tested in falcao liquid v3 and it isn´t working properly

team members are not affected by the script and act as normally in the falcao system.

 well thats all i see so far once more great script. (sorry bad english) :D
Glad you find it useful! :D

Is there a way to give the player character a sort of turn-based feel movement?

I don't want them to have to press an arrow key for every step but it would be a neat look if the player character paused for 10 frames or something per tile.  
This script only do something for the event side i am afraid, for the player side i'll need to go into a different class to do the job.

But what you want might be doable with eventing alone. Simply setup an event, then set up a move route to change the player's move frequency. Not sure if it will work but since the option is there, it should somehow force the player to move 1 mas and wait a bit before doing the 2nd move like an event.
 

lostdragon

Veteran
Veteran
Joined
Dec 23, 2014
Messages
39
Reaction score
6
First Language
English
Primarily Uses
I was trying to integrate the player pausing function of this script but I haven't gotten very far yet, if that is even the right direction to go.

https://github.com/Archeia/YEARepo/blob/master/Utility/Stop_All_Movement.rb
 

I'll try with events.

 

:D

 

Edit:  Yeah.  That was easy enough.  Just make a parallel event that sets a move route on the player to wait for 6 (or whatever).  Wait for completion must be ticked.  

 

That gives the player a turn-based roguelike look as he moves.  
 
Last edited by a moderator:

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
182
First Language
Meowish
Primarily Uses
Edit:  Yeah.  That was easy enough.  Just make a parallel event that sets a move route on the player to wait for 6 (or whatever).  Wait for completion must be ticked.  

 

That gives the player a turn-based roguelike look as he moves.  
Congratulations on your progress! ;)
 

Pozinhofan

Villager
Member
Joined
Feb 19, 2014
Messages
21
Reaction score
2
First Language
Portuguese
Primarily Uses
I need something like when the event chaser finally "touch" the player, turn a switch on. With this i can do a lot of things, like fugitive scenes, and some stuffs like "run or nightmare monsters will catch you"

Can you do it? Or give me some ideas.
 

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
182
First Language
Meowish
Primarily Uses
Simply set the event to trigger on "event touch", and have it turn on a switch before you delete it.
 

lostdragon

Veteran
Veteran
Joined
Dec 23, 2014
Messages
39
Reaction score
6
First Language
English
Primarily Uses
I may work on extending this to see how well on map "bump-n-bash" style combat might function.  That would further solidify the roguelike feel.  An on-touch event that runs a little hit/miss formula seems like the easiest solution.  I'm not sure what to do about ranged weapons.  I grew up on Ultima and Rogue and Magic Candle so that style of combat is nostalgic to me. 

I wonder if line-of-sight per-tile lighting is possible in RPG Maker VX Ace.  
 
Last edited by a moderator:

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
182
First Language
Meowish
Primarily Uses
If i remember correctly, there's some tile highlight script out there, if that's what you mean.

As for the bump-n-bash.. you might need an action rpg script to make it work. But i am not sure if the rogue-like movement will do it any good since the mobs will be "waiting" in the same spot until you finished an enemy and only move when you move again. :p

But pin this with a random-generated dungeon or the first person view 3D dungeon, and go all retro style, is actually fun and addictive as it turns out. ;)

Because those dungeons path are narrow and your players will need to squeeze all their intelligence to calculate every steps they made. Especially if you limit the number of healing items they can carry. :p
 

lostdragon

Veteran
Veteran
Joined
Dec 23, 2014
Messages
39
Reaction score
6
First Language
English
Primarily Uses
I'll check into the highlight script.

I've written code that does a line of sight check per tile on the screen and then sets their opacity to 0 or 255 depending on whether the ray cast from the player was blocked (or not).  The roguelike forums are full of algorithms.  I just haven't written one for RPG Maker.  You can use a variant of that technique (along with a distance calculation) to make a retro lighting effect for night time.

Having mobs wait in line to get bashed is kind of classic roguelike behavior so that's ok.  

I'll see what I can do this weekend.  I haven't learned any Ruby.  I only know C# and BASIC.   If it's easy to pick up and there's good function documentation then I can probably do something.
 

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
182
First Language
Meowish
Primarily Uses
Well, it's pretty much off topic as it has nothing to do with this script, but.. i'll answer anyway :p

If you mean a "lighting" that lights up a dark area, the trick is simple, set the "tone/colour" of the game's screen to black, all 0s. (Event editor page 2)

Then place a picture(size of the screen) with a blur out white dot in the middle.

Use blending type 2 and you will get a "light up area" showing the player and a little of his surroundings.

And by toying with the opacity of the picture, you can set the light to be strong or weak.

All do-able using eventing only. So no script's needed. ;)
 

lostdragon

Veteran
Veteran
Joined
Dec 23, 2014
Messages
39
Reaction score
6
First Language
English
Primarily Uses
No, I mean per-tile FOV lighting like roguelikes have.




The algorithms for doing it are known, but when I search in RPGMaker communities many have started but none have succeeded.

Thanks though.  Sorry for diverting your thread.  I thought it was going to cover roguelike development.
 

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
182
First Language
Meowish
Primarily Uses
Do-able like i said before, since we can set tile colour using tile highlight, so i believe it's not hard to "darken"  tiles simply by using a black color.

You can even do that using tile swap. Simply swap those tiles area you want to "mask"  with a black/void tile. (using this method might not even require a script, a complex parallel eventing might just get it to work)

But for a constant tile swapping/highlighting might cause a huge drop in fps. But since you do it on every steps the player does, It's do-able i guess, just not practical.

That's why for rpg maker games, the simple lighting i mentioned above is easier and much preferred by developers since they don't require a script to get it working.

And like i mentioned earlier, if you want to set up a dungeon with limited "sight", a 3D dungeon with the rogue-like movement can just proves to be attractive if not addictive. ;)

 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Popular old italian singer be like: We will win against Coronavirus! Humanity was capable of destroying even the dinosaurs! *cry laughs*
MarioWidjaya123 wrote on kyonides's profile.


I thought they were dead, but I wanted to be certain. :kaoback:
Always kind of annoys me to see people complain about ads in their phone applications because people are too lazy to turn on airplane mode when using them.

Forum statistics

Threads
98,246
Messages
950,677
Members
129,546
Latest member
paojiangya
Top