Hi CP,
is there any script to delete an Event completely? I don't mean that the event should be deactivated with self switchtes or the "Erase event" command, I mean literally DELETED - REMOVED - DISPOSED from the map so that there is one event less on the map.
Can you give me any help?
Events are in the $game_map.events hash.
You will need this in your scripts:
class Game_Map
attr_accessor :events
end
And then use:
$game_map.events.delete(EVENT_ID)
If you want the event totally removed from the game, never to come back again, you need to remove it from the .rxdata file for the map, and re-save the data, otherwise it will still come back again the next time the map is loaded.
If you want to remove an event "permanently", you'd be better off using a switch. Otherwise it is not really recommended to actually delete an event from the map as it can cause problems. Image you have a move event command somewhere that would move your invisible event, but you actually deleted it. You get a game crash right there. The CPU overhead required to update an erased event is too small to bear any significance (except if you have hundreds of events running).
Thanks for those answers!
To make my situation clear: I use an event clone script which clones events from different maps and since this function is used almost constantly I want to make sure that those events don't pile up into an huge lag-monster. Is it enough to use switches?
@ForeverZer0
Where should I put that class? In every single script or what? Sorry, when it comes to RGSS I'm a dumbass..
Once you leave a map, all events are discarded and upon reentering the map, only the default events are loaded again. The cloned ones aren't there initially, except if you clone them again. So I don't think you will really need to delete anything.
Quote from: User #1 on March 11, 2012, 08:35:11 am
Once you leave a map, all events are discarded and upon reentering the map, only the default events are loaded again. The cloned ones aren't there initially, except if you clone them again. So I don't think you will really need to delete anything.
But the game takes place on one single map.. No teleports.
For those who use cloned events: is there a possibility of local variables? This would be a makers' dream right here..
Why not do what Blizz said and just flip a switch then.
And you can have events set as local variables and actually work normally without restructuring how the default scripts work. There should be no need to do this, and if there is, you likely need to think of a different way of going about it.
If you don't mind me asking, what are you trying to do?
Quote from: ForeverZer0 on March 11, 2012, 02:19:32 pm
Why not do what Blizz said and just flip a switch then.
And you can have events set as local variables and actually work normally without restructuring how the default scripts work. There should be no need to do this, and if there is, you likely need to think of a different way of going about it.
If you don't mind me asking, what are you trying to do?
I'm creating an highly ambitious tower-defense like game which copies enemies from one map to the main map where the action takes place.
The game has no problems with perfomance yet, but I want to prevent any lags by deleting those enemy events from the map when they are done.
I understand under "local variables" that I practically just need to create one enemy event so that every copy of it acts as an individual because it has local variables. This would be neat and save a lot of time.