is there a way to store the id of the event using the call script, like using
i need to know for my game as since i'm using Blizz-ABS, ABSEAL is messing with one of my maps, i can't disable it for the map cause there's over 50 enemies (plus other events such as objects, battle possessing) on it so i found a way to work around it, i have each enemy is actually a normal event with /eal in it's name with the first page being a parallel process which uses the rename event call script to rename the event into an enemy (removing the /eal also), after that it switches a local switch to true and the 2nd page which has the sprite and death event action takes over, it's so far worked for one enemy but like i said there's over 50 enemies on the map and there will be more maps like this and it'll be simpler and easier to manage if i could call upon the event's id in a cal script (cause if i use a variable but that's 50 events using the same variable storing their own event id and that will screw up or i could use 50 variables but that takes far more work than my current problem)
class Game_Map
attr_accessor: event_ids
alias stored_ids_setup setup
def setup(map_id)
@stored_ids = []
stored_ids_setup(map_id)
end
end
class Interpreter
def store_id
unless $game_map.stored_ids.include?(@event.id)
$game_map.stored_ids.push(@event.id)
end
end
end
In a script call, simply put:
This will add this events ID to an array, which can be referenced with $game_map.stored_ids
Quote from: ForeverZer0 on November 28, 2010, 07:49:10 pm
class Game_Map
attr_accessor: event_ids
alias stored_ids_setup setup
def setup(map_id)
@stored_ids = []
stored_ids_setup(map_id)
end
end
class Interpreter
def store_id
unless $game_map.stored_ids.include?(@event.id)
$game_map.stored_ids.push(@event.id)
end
end
end
In a script call, simply put:
This will add this events ID to an array, which can be referenced with $game_map.stored_ids
ok, but then how do i get the id back dynamically without having to change every event cause if it's getting stored in an array, that means each id is then associated with an position in the array so i would be using something like
store_id
num = $game_map.stored_ids[#]
where # is the position of the array and if this is the case, it's just adding a line that i don't need, this is what i have at the moment
id = 23
b1 = '\\e[8] \\g[5]
$game_map.rename_event(id,b1)
if i was to add what i have above it'll turn out to
store_id
id = $game_map.stored_ids[#]
b1 = '\\e[8] \\g[5]
$game_map.rename_event(id,b1)
plus how would i know what # is anyway?
If you just want a way of getting the idea for that moment, and don't care about storing them, try this:
class Interpreter
def get_id
return @event.id
end
end
You can get the index in the array if you need to this way:
index = $game_map.stored_ids.index(ID)
That will return the index in the array where that value is, though I don't think this what you need.
Can you use self.id? o-o
@ForeverZer0
Quote from: ForeverZer0 on November 28, 2010, 08:39:45 pm
If you just want a way of getting the idea for that moment, and don't care about storing them, try this:
class Interpreter
def get_id
return @event.id
end
end
i tried it, it kinda worked, thing is that it did the wrong event, it changed one of the events i use like the pot from Legend of Zelda (so when you destroy it it drops health) and transformed it into the enemy, i have now
id = get_id
b1 = '\\e[8] \\g[5]
$game_map.rename_event(id,b1)
if it worked to how i wanted it to work, id should equal to 23 which is the id of the event i'm changing the name of, but the event that actually change i think was either 4 or 14 (i was just running up to the map to see where the enemy is supposed to be to see if it worked then i saw a rock moving with a health bar, the one 2 rocks in that aprox place is the ones with the ids of 4 and 14), any ideas
@Aqua: nope, tried that, didn't rename the event cause it had no health bar (it should if it worked
In a script call within an event, you can use @event_id directly. The script call is evaluated within the Interpreter class so it gives you access to all of its instance variables.
Ah I knew it had something to do with referencing itself XD
Quote from: Blizzard on November 29, 2010, 02:14:43 am
In a script call within an event, you can use @event_id directly. The script call is evaluated within the Interpreter class so it gives you access to all of its instance variables.
yep, that worked, thanks, this will make things so much easier on the map and others like it, thanks for your help