Hallo, es gibt ja den Move befehl: Move to Player, lässt sich sowas auch zu einem bestimmten Event machen, also, dass das Event nicht zum Spieler sondern zu einem bestimmten Event geht?
Druckbare Version
Hallo, es gibt ja den Move befehl: Move to Player, lässt sich sowas auch zu einem bestimmten Event machen, also, dass das Event nicht zum Spieler sondern zu einem bestimmten Event geht?
du kannst die koordinaten des events einfach in einer variable speichern und diese dann als ziel koordinaten des teleports benutzen.
edit:
ah sry wohl nen bisl falsch verstanden
dachte du meintest set event location
Ich denke OneEyeShadow meint eher "Move toward player" für ein beliebiges Event. Hab mal die "Move toward player"-Methode adaptiert. Vielleicht geht es aber noch besser.
Aufgerufen wird sie durch:Code:class Game_Character
def move_to_event(event_id)
# Get difference in event coordinates
sx = @x - $game_map.events[event_id].x
sy = @y - $game_map.events[event_id].y
# If coordinates are equal
if sx == 0 and sy == 0
return
end
# Get absolute value of difference
abs_sx = sx.abs
abs_sy = sy.abs
# If horizontal and vertical distances are equal
if abs_sx == abs_sy
# Increase one of them randomly by 1
rand(2) == 0 ? abs_sx += 1 : abs_sy += 1
end
# If horizontal distance is longer
if abs_sx > abs_sy
# Move towards event, prioritize left and right directions
sx > 0 ? move_left : move_right
if not moving? and sy != 0
sy > 0 ? move_up : move_down
end
# If vertical distance is longer
else
# Move towards event, prioritize up and down directions
sy > 0 ? move_up : move_down
if not moving? and sx != 0
sx > 0 ? move_left : move_right
end
end
end
end
$game_map.events[Nr. des Events].move_to_event(Nr. des Zieles)
Hey, danke für das Skript, werds gleich mal ausprobieren.