MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
186
First Language
Meowish
Primarily Uses
Made for a request here.

This allows an event with a name tag <eet> to trigger another event with name tag <eer> it came into collision with.

Features:

[1] Event triggering another Event

[2] Able to check who triggered the event

[3] Able to set up conditional branches to have different trigger actions depending on who triggered the event.

[IMG]http://s9.postimg.org/cm76nik5r/npcvsnpcbattlefield.png[/IMG]

(possible usage example: npc vs npc battle field)

[IMG]http://s22.postimg.org/js6vzrh2p/randomkillerevent.png[/IMG]

(possible usage example: random killer)

[IMG]http://s15.postimg.org/mwk9bjftj/flipswitchevent.png[/IMG]

(possible usage example: randomly flip switches)

How to Use:
[1] Paste this below Material and above Main
[2] Add <eet> in the event's name to enable it to trigger another event.
[3] Set trigger type to [event trigger] on the event with <eet> name tag
[4] Add <eer> in the target event's name to enable it to be trigger-able by another event

Note:

Event with <eet> name tag will still be able to trigger itself when it comes into collide with the player.

It will be counted as triggered by player.

[5] To check if it's a player/event that triggers the event, use the script calls below in your conditional branches script box.

Script calls for Conditional Branches:

Check if triggered by Player:

$game_map.events[@event_id].triggered_by == 0Check if triggered by Any Event:

$game_map.events[@event_id].triggered_by != 0Check if triggered by Event ID N:

$game_map.events[@event_id].triggered_by == N(where N is the event id number)



Compatibility:

This script overwrites the event trigger method, there might be a chance of conflict if you have another custom script overwriting the event triggers.

Terms of Use:

Free for both commercial and non-commercial

Sample Map:

Simply make a new project, add this script and extract the Map001.rvdata2 file into your Data Folder

NPC vs NPC Battle Field with 3rd Party Medic: Map001.rar

Demo Game:

http://forums.rpgmakerweb.com/index.php?/topic/53887-medic-medic/

Script:

#==============================================================================# ■ Meow Face Event - Event Trigger#------------------------------------------------------------------------------# Allow Event with name tag to trigger other events with name tag on collision#==============================================================================# How to Use:# [1] Paste this below Material and above Main# [2] Add <eet> in the event's name to enable it to trigger another event.# [3] Set trigger type to [event tigger] on the event with <eet> name tag# [4] Add <eer> in the target event's name to enable it to be trigger-able by another event## Script calls for Conditional Branches:#   Check If triggered by player:#     $game_map.events[@event_id].triggered_by == 0#   Check If triggered by event:#     $game_map.events[@event_id].triggered_by != 0#   Check If triggered by event id N:#     $game_map.events[@event_id].triggered_by == N (where N = event id number)#==============================================================================class Game_Player < Game_Character  def start_map_event(x, y, triggers, normal) #overwrite return if $game_map.interpreter.running?    $game_map.events_xy(x, y).each do |event|      if event.trigger_in?(triggers) && event.normal_priority? == normal        event.triggered_by = 0        event.start      end    end  endendclass Game_Event < Game_Character  attr_reader   :meowname  attr_accessor :triggered_by  alias meow_ee_name initialize  def initialize(map_id, event)    meow_ee_name(map_id, event)    @meowname = event.name    @lock_timer = 0    @triggered_by = 0  end  def meow_lock    @locked = true    @lock_timer = 60  end  def meow_start    return if empty?    @starting = true    meow_lock if trigger_in?([2])  end  def check_event_trigger_touch(x, y) #overwrite    return if $game_map.interpreter.running?    if @trigger == 2 && $game_player.pos?(x, y)      @triggered_by = 0      start if !jumping? && normal_priority?    end    $game_map.events_xy(x, y).each do |event|      if @trigger == 2 && @event.name.include?('<eet>')        if !jumping? && normal_priority? && $game_map.events[event.id].meowname.include?('<eer>')          event.triggered_by = @event.id          event.meow_start          $game_map.events[event.id].turn_toward_character($game_map.events[@event.id]) if !@direction_fix          meow_lock        end      end    end  end  alias meow_ee_update update  def update    meow_ee_update    if @lock_timer > 0      @lock_timer -= 1      @locked = false if @lock_timer <= 0    end  endend
Update:

[29-Dec-2015]

Updated to add a demo game.

[19-Dec-2015]

Updated the script so it can now checks who triggered the event.

Also added a sample map for those who wish to see how the battle field is done.

[18-Dec-2015]

Fixed the facing problem with the triggered event <eer> so that it will be facing the triggering event <eet> properly.

Also added a 1 second cool down timer to prevent the triggering event <eet> to spam the trigger continuously.
 

Attachments

  • Map001.rar
    1.6 KB · Views: 31
Last edited by a moderator:

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
186
First Language
Meowish
Primarily Uses
Found a small bug(typo?) in the default game engine's random move.


It doesn't allows turning, causing events to "stop moving" in corners for a long time.


This somehow effect the triggering event.


When it can't turn around in corners, there will be problems if it's surrounded by other events,


because it won't be able turn around to trigger them.


[IMG]http://s15.postimg.org/mwk9bjftj/flipswitchevent.png[/IMG]


Since it's not related to the E-E Trigger script. I am posting it here as a separate add on.


Here's the hot fix for random move as a standalone script.



Note that this snippet is overwriting the default random move to enable turning.


Instead of doing nothing in a fixed direction, now the event will turn and face the wall/edges/another event when it can't move.

Code:
#==============================================================================
# ■ Meow Face Random Move Fix
#------------------------------------------------------------------------------
# Fix the random move so events are able to turn when cornered
#==============================================================================
# How to Use:
# [1] Paste this below Material and above Main
#==============================================================================
class Game_Character < Game_CharacterBase
  def move_random #overwrite
    move_straight(2 + rand(4) * 2, true)
  end
end
 
Last edited by a moderator:

Sausage_Boi

Game Dev. "Artist."
Veteran
Joined
Sep 10, 2014
Messages
1,744
Reaction score
703
First Language
Americanese
Primarily Uses
RMVXA
This is an awesome script, and it just keeps getting deeper and more amazing! I have been using the first iteration to very good effect, but I might move over to this one. I really like the NPC vs. NPC idea and the soldier that triggers random switches... I can think of a few good puzzles to go along with that. (Probably for another game, though.)
 

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
186
First Language
Meowish
Primarily Uses
Thanks! Glad you like it!

I find the switch idea fun here, made it trigger-able only by the soldier and have the soldier shout at the player if the player tries to touch the buttons. lol!

Player need to wait for the soldier to open the doors/bridges so it makes the maze solving a little more fun. :D
 

Sausage_Boi

Game Dev. "Artist."
Veteran
Joined
Sep 10, 2014
Messages
1,744
Reaction score
703
First Language
Americanese
Primarily Uses
RMVXA
I have been dreaming up a lot of things to do with this. It will certainly make for some more fun gameplay elements in other games I will be working on. 
 

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
186
First Language
Meowish
Primarily Uses
I have been dreaming up a lot of things to do with this. It will certainly make for some more fun gameplay elements in other games I will be working on. 
I was trying it out in a demo and ended up making a small stimulation game with it.

Turns out it just need the script and the rest is using eventing only.

This script really fires up the inspirations and makes life easy.. lol!

I am glad you asked for it and lucky enough to take up the challenge. :p
 

Sausage_Boi

Game Dev. "Artist."
Veteran
Joined
Sep 10, 2014
Messages
1,744
Reaction score
703
First Language
Americanese
Primarily Uses
RMVXA
The biggest problem I have with this script right now is, I am already working on multiple games (5), and this just makes me want to start on another one. If I keep starting projects, I will never finish one, even if they are short!

I can't tell you how excited this script makes me, mostly because I don't really make RPGs. :p ! Thank you again for making it!
 
Last edited by a moderator:

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
186
First Language
Meowish
Primarily Uses
lol, glad you like it! and happy game making with all those new ideas! ;)
 

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
186
First Language
Meowish
Primarily Uses
Scripts in top post is being messed up due to the recent V3 to V4 migration.


Please use this alternative version instead until the web staff is able to fix the format in the top post:

Code:
#==============================================================================
# ■ Meow Face Event - Event Trigger
#------------------------------------------------------------------------------
# Allow Event with name tag to trigger other events with name tag on collision
#==============================================================================
# How to Use:
# [1] Paste this below Material and above Main
# [2] Add <eet> in the event's name to enable it to trigger another event.
# [3] Set trigger type to [event tigger] on the event with <eet> name tag
# [4] Add <eer> in the target event's name to enable it to be trigger-able by another event
#
# Script calls for Conditional Branches:
#   Check If triggered by player:
#     $game_map.events[@event_id].triggered_by == 0
#   Check If triggered by event:
#     $game_map.events[@event_id].triggered_by != 0
#   Check If triggered by event id N:
#     $game_map.events[@event_id].triggered_by == N (where N = event id number)
#==============================================================================
class Game_Player < Game_Character
  def start_map_event(x, y, triggers, normal) #overwrite
    return if $game_map.interpreter.running?
    $game_map.events_xy(x, y).each do |event|
      if event.trigger_in?(triggers) && event.normal_priority? == normal
        event.triggered_by = 0
        event.start
      end
    end
  end
end
class Game_Event < Game_Character
  attr_reader   :meowname
  attr_accessor :triggered_by
  alias meow_ee_name initialize
  def initialize(map_id, event)
    meow_ee_name(map_id, event)
    @meowname = event.name
    @lock_timer = 0
    @triggered_by = 0
  end
  def meow_lock
    @locked = true
    @lock_timer = 60
  end
  def meow_start
    return if empty?
    @starting = true
    meow_lock if trigger_in?([2])
  end
  def check_event_trigger_touch(x, y) #overwrite
    return if $game_map.interpreter.running?
    if @trigger == 2 && $game_player.pos?(x, y)
      @triggered_by = 0
      start if !jumping? && normal_priority?
    end
    $game_map.events_xy(x, y).each do |event|
      if @trigger == 2 && @event.name.include?('<eet>')
        if !jumping? && normal_priority? && $game_map.events[event.id].meowname.include?('<eer>')
          event.triggered_by = @event.id
          event.meow_start
          $game_map.events[event.id].turn_toward_character($game_map.events[@event.id]) if !@direction_fix
          meow_lock
        end
      end
    end
  end
  alias meow_ee_update update
  def update
    meow_ee_update
    if @lock_timer > 0
      @lock_timer -= 1
      @locked = false if @lock_timer <= 0
    end
  end
end
 

saviliana

Warper
Member
Joined
Dec 25, 2015
Messages
3
Reaction score
0
First Language
chinese
Um, I would like to know that do we have to define the NPC before it reacts with other NPC/objects?
Since the Sample game have defined the NPC with script name, but the top post didn't said anything about it.
 

Latest Threads

Latest Posts

Latest Profile Posts

I hate doing voice over videos but people said they like hearing about the details.
Modern Town Overworld, World of Solaria Dungeon, 80's Retro-Futuristic Font | RPG Maker News #73

I been slowing down and not focusing on project currently.
I had this idea for VTubers vs MOTHER and its a bunch of Vtubers finding eight melodies to fight a psychic alien and a fat kid. IDK, kinda find it hard to use RPG Maker for more than 15 minutes
Working on some wizard/magic bases:
TestChara-10-hover.gif

I mean, technically it's a flying base but I haven't made any wings yet, so magic hovering is it for now.

Forum statistics

Threads
112,300
Messages
1,067,191
Members
145,929
Latest member
longga1996
Top