03-18-2009, 03:52 AM
Okay, you could do something like this
and then call it with $scene.move_events_with_comments from an event.
Depending on how many events you want to use it for you could consider putting the values in variables, to be used after.
For example, if you know that only one event will have the comment, you could have:
Code:
class Scene_Map
def move_events_with_comments
for a in $game_map.events.values
next if a.list == nil
for i in 0...a.list.size
if a.list[i].code == 108 and a.list[i].parameters[0][0,4] == "MOVE"
# something happens here
substrings=a.list[i].parameters[0].split(' ')
x=substrings[1].to_i
y=substrings[2].to_i
a.moveto(x,y)
end
end
end
end
end
and then call it with $scene.move_events_with_comments from an event.
Depending on how many events you want to use it for you could consider putting the values in variables, to be used after.
For example, if you know that only one event will have the comment, you could have:
Code:
class Scene_Map
def move_events_with_comments
for a in $game_map.events.values
next if a.list == nil
for i in 0...a.list.size
if a.list[i].code == 108 and a.list[i].parameters[0][0,4] == "MOVE"
# something happens here
substrings=a.list[i].parameters[0].split(' ')
$game_variables[30]=substrings[1].to_i
$game_variables[31]=substrings[2].to_i
end
end
end
end
end