- Joined
- Jul 6, 2014
- Messages
- 3
- Reaction score
- 2
- First Language
- English
- Primarily Uses
I'm trying to get a hookshot for my game and have got it kinda working. I have an invisible event that I call with a common event using Yanfly's button common events. Originally I used move route to move it forward 5 paces and back 5 paces, but I ran into the problem that if it hit a wall before the 5 paces were up it would still move back 5 paces, going further than the firing point. So I'm trying to script it. This is what I have so far:
def vis_hook
for event in $game_map.events.values
if event.name.include?("Hookshot") and !event.erased
@hookstep = 0
def fmove
move_forward
@hookstep += 1
if @hookstep = 5 or !@move_suceed
$game_self_switches[[@map_id, @event_id, 'A']] = true
end
end
def bmove
move_backward
@hookstep - 1
if @hookstep = 0
$game_self_switches[[@map_id, @event_id, 'B']] = true
end
fmove
end
end
end
with the idea being that it adds 1 to the @hookstep for every step it takes, then once it can't move it or it hits 5 moves the event switches the A self switch on, and the hookshot moves back as many steps are in @hookstep then switches on the B self switch to end the hookshot use. So far the event moves forward but won't trigger the self switch :/ What am I messing up?
def vis_hook
for event in $game_map.events.values
if event.name.include?("Hookshot") and !event.erased
@hookstep = 0
def fmove
move_forward
@hookstep += 1
if @hookstep = 5 or !@move_suceed
$game_self_switches[[@map_id, @event_id, 'A']] = true
end
end
def bmove
move_backward
@hookstep - 1
if @hookstep = 0
$game_self_switches[[@map_id, @event_id, 'B']] = true
end
fmove
end
end
end
with the idea being that it adds 1 to the @hookstep for every step it takes, then once it can't move it or it hits 5 moves the event switches the A self switch on, and the hookshot moves back as many steps are in @hookstep then switches on the B self switch to end the hookshot use. So far the event moves forward but won't trigger the self switch :/ What am I messing up?

