Goal: Any enemy can trigger events that have tool hit. Tool hit means that when you hit the event with a weapon or other "tool" it will trigger a reaction on a page inside the event. Current behaviour only allows player to do such (unless the tool in question is set to a none friendly fire mode, but that also makes enemies hurt each other).
def action_effect_page(attacker, attack_id) return false unless self.is_a?(Game_Event)# return false if attacker.action.fake_id if attacker.action != nil check_auto_effect_page(attacker, attack_id) check_reflectable_skills(attacker, attack_id) end for page in @event.pages if page.condition.variable_valid #and #page.condition.variable_id == XAS_SYSTEM::HIT_ID #and #used to have nothing MirEdit #page.condition.variable_value == attack_id self.reaction_valid_attack_id = attack_id self.refresh @trigger = 0 self.start return true end end return false end
I assume this is the relevant line: if event.action_effect_page(self, self.action.attack_id
If that is truly where I shoud put my focus on I can't figure out how to make it work for other events than self (which is player right?)
Any help appreciated, hit me up if you see another reference so I can go get that part of the script for you. Don't mind the comments too much. I just roughly edited it so that events can be triggered by any weapon. Not by a specific one.
Cheers!
def action_effect_page(attacker, attack_id) return false unless self.is_a?(Game_Event)# return false if attacker.action.fake_id if attacker.action != nil check_auto_effect_page(attacker, attack_id) check_reflectable_skills(attacker, attack_id) end for page in @event.pages if page.condition.variable_valid #and #page.condition.variable_id == XAS_SYSTEM::HIT_ID #and #used to have nothing MirEdit #page.condition.variable_value == attack_id self.reaction_valid_attack_id = attack_id self.refresh @trigger = 0 self.start return true end end return false end
Code:
def check_event_trigger_attack() return unless can_impact_target? hit_check = false range = @action.attack_range hit = [] targets = [$game_player] + $game_map.events.values for event in targets next if event == self or @action.hit_events.include?(event) or event.erased body_size = event.body_size event_center_x = event.x event_center_y = event.y - body_size if @action.short_range dx = event_center_x - $game_player.x dy = event_center_y - $game_player.y else dx = event_center_x - self.x dy = event_center_y - self.y end dx = (dx >= 0 ? [dx - body_size, 0].max : [dx + body_size, 0].min) dy = (dy >= 0 ? [dy - body_size, 0].max : [dy + body_size, 0].min) hit_check = true if in_range?(dx,dy,event,range) hit.push(event) if hit_check hit_check = false end for event in hit if event.action_effect(self, self.action.attack_id) hit_check = true #MirEdit $game_switches[13] = true end if event.action_effect_page(self, self.action.attack_id) #used to return only self MirEdit hit_check = true end @action.hit_events.push(event) unless @action.multi_hit end if hit_check $game_temp.active_token = self end end
If that is truly where I shoud put my focus on I can't figure out how to make it work for other events than self (which is player right?)
Any help appreciated, hit me up if you see another reference so I can go get that part of the script for you. Don't mind the comments too much. I just roughly edited it so that events can be triggered by any weapon. Not by a specific one.
Cheers!