CODE:class Game_Event
attr_reader :id
end
module CP
def self.first_event_comment(event, comment)
return (event.list.is_a?(Array) && event.list[0].code == 108 &&
event.list[0].parameters[0] == comment)
end
def self.find_first_event(dir = $game_player.direction, range = 1, string = '')
case dir
when 2
(1..range).each {|i| $game_map.events.each_value {|event|
if event.x == $game_player.x && event.y == $game_player.y + i &&
CP.first_event_comment(event, string)
return event.id
end}}
when 4
(1..range).each {|i| $game_map.events.each_value {|event|
if event.y == $game_player.y && event.x == $game_player.x - i &&
CP.first_event_comment(event, string)
return event.id
end}}
when 6
(1..range).each {|i| $game_map.events.each_value {|event|
if event.y == $game_player.y && event.x == $game_player.x + i &&
CP.first_event_comment(event, string)
return event.id
end}}
when 8
(1..range).each {|i| $game_map.events.each_value {|event|
if event.x == $game_player.x && event.y == $game_player.y - i &&
CP.first_event_comment(event, string)
return event.id
end}}
end
return 0
end
def self.trigger(string, range, switch)
event_id = self.find_first_event($game_player.direction, range, string)
return if event_id == 0
key = [$game_map.map_id, event_id, switch]
$game_self_switches[key] = true
end
end
Purpose The Above Code dose the fallowing. when called like this
CP.trigger('string', range, switch)
It checks in fount of the player and finds the first event that has comment 'string' in the first line on the currently running page that is within range then it takes that event and switches self switch switch (it can be 0, 1, 2, 3, for a, b, c, or d) to on
Problem heres the problem I made a common event that calls the script like this
I then made a skill that calls that common event and gave the skill menu use and gave the fighter class access to it at lv 1
then I made an event in the first page I made a comment on the first line that said hi and on the second page I Required self switch a to be on and set it to auto run and made it do several things like text and battle processing. but when you used the skill nothing happened. I used the 'p' command to print things to test if things were working and they were the problem lies in flipping the self switch
and neither I nor Blizzard knows what going wrong