Yanfly Event Chase Script

Daniel B

Hidden Kitten
Veteran
Joined
Dec 8, 2012
Messages
64
Reaction score
14
First Language
Swedish
Primarily Uses
Hi.

I've been playing around a little with Yanfly's Event Chase Script (https://raw.githubusercontent.com/Archeia/YEARepo/master/Field/Event_Chase_Player.rb) and I have 2 concerns that I hope someone might help me with.

The first is that I can't seem to get the alert_sound to work. I think I've tried everything, making a new project with only the yanfly script, adding "" or '', but nothing seems to help. If I have @alert_sound = Blow1, the game crashes (Game_Character, Line 180) and I think that is how you are suppose to write it, but I couldn't even find help elsewhere, so it seems like I'm the only one with this problem(?)

This is how I've made the chasing event, if it helps.

Chaser.png

The second part is a bit trickier. Is it possible to add to the script so that a self-switch activates/deactives when the event sees/loses sight of the player? This is more of an optional thing, but it would help a lot, cause then I could event the chaser to walk back to it's original position and possibly other things.

Thanks for reading.
 

EatYourBeetS

The Abysswalker
Veteran
Joined
Feb 23, 2015
Messages
96
Reaction score
30
First Language
Italian
Primarily Uses
For the first question, have you tried writing @alert_sound = "Blow1" under apostrophes? It needs to be a string.

As for the second question I'll look into the script later, if you'll still need a solution.
 

Daniel B

Hidden Kitten
Veteran
Joined
Dec 8, 2012
Messages
64
Reaction score
14
First Language
Swedish
Primarily Uses
For the first question, have you tried writing @alert_sound = "Blow1" under apostrophes? It needs to be a string.

As for the second question I'll look into the script later, if you'll still need a solution.
Yes, I have tried using " " and ' '. When I do, no sound plays but the script doesn't crash. This is why I thought maybe it collided with another script, but like I said, I got the same results in a NEW project, so I don't know what I'm doing wrong.
 

EatYourBeetS

The Abysswalker
Veteran
Joined
Feb 23, 2015
Messages
96
Reaction score
30
First Language
Italian
Primarily Uses
You need to activate also @alert_balloon because in that script the sound is played only in this method

#-------------------------------------------------------------------------- # new method: update_alert_balloon #-------------------------------------------------------------------------- def update_alert_balloon return if @erased @alert_timer = 0 if @alert_timer.nil? @alert_lock = 0 if @alert_lock.nil? @alert_lock -= 1 if @alert_lock >= 0 return if @alert_balloon == nil || @alert_balloon == 0 if (@chase_player || @flee_player) && !@alert_player @balloon_id = @alert_balloon @alert_player = true @alert_timer = YEA::EVENT_CHASE::ALERT_TIMER RPG::SE.new(@alert_sound, 100, 100).play unless @alert_sound.nil? end @alert_timer -= 1 if @alert_player end
This way it should work, if you want to play the sound without showing the balloon icon you can try to cut and paste 

RPG::SE.new(@alert_sound, 100, 100).play unless @alert_sound.nil?  before 

Code:
 return if @alert_balloon == nil || @alert_balloon == 0
 
Last edited by a moderator:

Daniel B

Hidden Kitten
Veteran
Joined
Dec 8, 2012
Messages
64
Reaction score
14
First Language
Swedish
Primarily Uses
You need to activate also @alert_balloon because in that script the sound is played only in this method

#-------------------------------------------------------------------------- # new method: update_alert_balloon #-------------------------------------------------------------------------- def update_alert_balloon return if @erased @alert_timer = 0 if @alert_timer.nil? @alert_lock = 0 if @alert_lock.nil? @alert_lock -= 1 if @alert_lock >= 0 return if @alert_balloon == nil || @alert_balloon == 0 if (@chase_player || @flee_player) && !@alert_player @balloon_id = @alert_balloon @alert_player = true @alert_timer = YEA::EVENT_CHASE::ALERT_TIMER RPG::SE.new(@alert_sound, 100, 100).play unless @alert_sound.nil? end @alert_timer -= 1 if @alert_player end
This way it should work, if you want to play the sound without showing the balloon icon you can try to cut and paste 

RPG::SE.new(@alert_sound, 100, 100).play unless @alert_sound.nil?  before 

return if @alert_balloon == nil || @alert_balloon == 0
Omg, I can't believe I didn't think about that... The line you gave me made it so that the sound kept playing over and over again nonstop, even through walls etc. but that is OK, I can fix this by just making my own balloon icon that is just nothing, then the sound plays like it should. Thank you so much. Get back to me about the other thing if you have the time for it. :)
 

EatYourBeetS

The Abysswalker
Veteran
Joined
Feb 23, 2015
Messages
96
Reaction score
30
First Language
Italian
Primarily Uses
Try this

#-------------------------------------------------------------------------- # alias method: update_self_movement #-------------------------------------------------------------------------- alias game_event_update_self_movement_ecp update_self_movement def update_self_movement return if $imported["YEA-StopAllMovement"] && Switch.stop_npc_movement update_chase_distance update_flee_distance if @stop_count > 0 && @chase_player $game_self_switches[[$game_map.map_id,@chase_ev_id,'A']] = true #<----ADD THIS move_type_toward_player elsif @stop_count > 0 && @flee_player move_type_away_player else game_event_update_self_movement_ecp $game_self_switches[[$game_map.map_id,@chase_ev_id,'A']] = false #<----ADD THIS end update_alert_balloon end
and in the custom move route of each event you have to add @chase_ev_id = n , with n the actual ID of the event(a number), if you don't want the self switch to change you can simply omit that line, hope it helps!  :)
 

Daniel B

Hidden Kitten
Veteran
Joined
Dec 8, 2012
Messages
64
Reaction score
14
First Language
Swedish
Primarily Uses
Try this

#-------------------------------------------------------------------------- # alias method: update_self_movement #-------------------------------------------------------------------------- alias game_event_update_self_movement_ecp update_self_movement def update_self_movement return if $imported["YEA-StopAllMovement"] && Switch.stop_npc_movement update_chase_distance update_flee_distance if @stop_count > 0 && @chase_player $game_self_switches[[$game_map.map_id,@chase_ev_id,'A']] = true #<----ADD THIS move_type_toward_player elsif @stop_count > 0 && @flee_player move_type_away_player else game_event_update_self_movement_ecp $game_self_switches[[$game_map.map_id,@chase_ev_id,'A']] = false #<----ADD THIS end update_alert_balloon end
and in the custom move route of each event you have to add @chase_ev_id = n , with n the actual ID of the event(a number), if you don't want the self switch to change you can simply omit that line, hope it helps!  :)
Thank you, I don't see any problems with it and it works so far :)
 

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

Latest Threads

Latest Posts

Latest Profile Posts

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
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

Forum statistics

Threads
105,868
Messages
1,017,074
Members
137,578
Latest member
JamesLightning
Top