Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- # Big Push Events - By Vendily [v17]
- #===============================================================================
- # This script allows you to tether multiple events together to move as one.
- # Think strength rocks from gen 5, that size. Or bigger, or wide and thin rocks.
- #===============================================================================
- # Each event in the unit must contain the same script call:
- # pbPushManyEvents(width,height,[array of all the tethered event ids])
- # Mind, if you're using tiles from the Tileset and Player Touch, the tiles can't
- # have Passage (4 dir) set. It's all or nothing for Player Touch
- # Also includes pbPushBigBoulder, used the same way, that requires Strength.
- #===============================================================================
- module InterpreterFieldMixin
- def pbPushManyEvents(w,h,event_ids)
- events=[]
- for e in event_ids
- events.push(get_character(e))
- end
- d=w
- case $game_player.direction
- when 2
- d=w
- events.sort!{|a,b|
- next -(a.y<=>b.y) if a.y != b.y
- next (a.x<=>b.x)
- }
- when 4
- d=h
- events.sort!{|a,b|
- next (a.x<=>b.x) if a.x != b.x
- next (a.y<=>b.y)
- }
- when 6
- d=h
- events.sort!{|a,b|
- next -(a.x<=>b.x) if a.x != b.x
- next (a.y<=>b.y)
- }
- when 8
- d=w
- events.sort!{|a,b|
- next (a.y<=>b.y) if a.y != b.y
- next (a.x<=>b.x)
- }
- end
- pass=[]
- d.times do |i|
- ep=events[i].passableStrict?(events[i].x,events[i].y,$game_player.direction)
- pass.push(ep)
- end
- return if pass.any?{|p| p==false}
- oldx=events[0].x
- oldy=events[0].y
- for e in events
- e.through=true
- case $game_player.direction
- when 2; e.move_down # down
- when 4; e.move_left # left
- when 6; e.move_right # right
- when 8; e.move_up # up
- end
- e.through=false
- end
- $PokemonMap.addMovedEvent(@event_id) if $PokemonMap
- if oldx!=events[0].x || oldy!=events[0].y
- $game_player.lock
- begin
- Graphics.update
- Input.update
- pbUpdateSceneMap
- end until !events[0].moving?
- $game_player.unlock
- end
- end
- def pbPushBigBoulder(w,h,event_ids)
- pbPushManyEvents(w,h,event_ids) if $PokemonMap.strengthUsed
- return true
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement