Event stop without turning

Edenstudent

Villager
Member
Joined
Sep 27, 2018
Messages
5
Reaction score
2
First Language
English
Primarily Uses
RMVXA
Hello,

I am looking for a way of causing an NPC event to stop moving on activation and talk to you, but not turn.
As it has a custom move route, using set move route on it will cause it to reset and mess up the current position (usually it just gets stuck on a wall). It normally turns in it's custom route so direction fix would not work.
I have this amazing script by Shaz (https://forums.rpgmakerweb.com/index.php?threads/disable-npc-lock.17721/) however it causes the events to continue moving, while I'm looking for them to stop, but still not turn.

If anyone knows of a script or some way to achieve this without one, I would be greatly appreciative.
Thank you very much.
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,125
Reaction score
10,639
First Language
Czech
Primarily Uses
RMMV
You need to set Direction to fixed on the event page and then you'll just set the turning explicitly via the custom move route.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Try this (not tested). Note, this overwrites the Game_Event.lock method, so if you are using the other script, put this one above it in the list.

Add <noturn> as a comment rather than <nolock> - if you have both scripts, best not to use both tags on the same event page.

Code:
class Game_Event
  alias shaz_noturn_clear_page_settings clear_page_settings
  alias shaz_noturn_setup_page_settings setup_page_settings
 
  #--------------------------------------------------------------------------
  # * Clear Event Page Settings
  #--------------------------------------------------------------------------
  def clear_page_settings
    shaz_noturn_clear_page_settings
    @noturn = false
  end
  #--------------------------------------------------------------------------
  # * Set Up Event Page Settings
  #--------------------------------------------------------------------------
  def setup_page_settings
    shaz_noturn_setup_page_settings
    list_index = 0
    while list_index < @list.size && [108,408].include?(@list[list_index].code)
      if @list[list_index].parameters[0] =~ /<noturn>/i
        @noturn = true
        break
      end
      list_index += 1
    end
  end
  #--------------------------------------------------------------------------
  # * Lock (Processing in Which Executing Events Stop)
  #--------------------------------------------------------------------------
  def lock
    unless @locked
      @prelock_direction = @direction
      turn_toward_player unless @noturn
      @locked = true
    end
  end
end
 

Edenstudent

Villager
Member
Joined
Sep 27, 2018
Messages
5
Reaction score
2
First Language
English
Primarily Uses
RMVXA
You need to set Direction to fixed on the event page and then you'll just set the turning explicitly via the custom move route.
Ah, thank you; yes it does work if I set direction fix on after each turn and off right before, though it is a bit tedious.
 

Edenstudent

Villager
Member
Joined
Sep 27, 2018
Messages
5
Reaction score
2
First Language
English
Primarily Uses
RMVXA
Try this (not tested). Note, this overwrites the Game_Event.lock method, so if you are using the other script, put this one above it in the list.

Add <noturn> as a comment rather than <nolock> - if you have both scripts, best not to use both tags on the same event page.

Code:
class Game_Event
  alias shaz_noturn_clear_page_settings clear_page_settings
  alias shaz_noturn_setup_page_settings setup_page_settings
 
  #--------------------------------------------------------------------------
  # * Clear Event Page Settings
  #--------------------------------------------------------------------------
  def clear_page_settings
    shaz_noturn_clear_page_settings
    @noturn = false
  end
  #--------------------------------------------------------------------------
  # * Set Up Event Page Settings
  #--------------------------------------------------------------------------
  def setup_page_settings
    shaz_noturn_setup_page_settings
    list_index = 0
    while list_index < @list.size && [108,408].include?(@list[list_index].code)
      if @list[list_index].parameters[0] =~ /<noturn>/i
        @noturn = true
        break
      end
      list_index += 1
    end
  end
  #--------------------------------------------------------------------------
  # * Lock (Processing in Which Executing Events Stop)
  #--------------------------------------------------------------------------
  def lock
    unless @locked
      @prelock_direction = @direction
      turn_toward_player unless @noturn
      @locked = true
    end
  end
end



Ah, thank you so much Shaz; the script works perfectly!
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,865
Messages
1,017,059
Members
137,575
Latest member
akekaphol101
Top