• Respawning glass for roleplay map
    8 replies, posted
Hi everybody. I am currently making a RP map that I'll use as a base to both learn LUA and experience working with DarkRP and eventually my own RP mod. Anyway: I am making this map, and I'd like glass to respawn after xx minutes, so the map doesn't need to be restarted every now and then. How do I do this? I thought about naming each glass pane and make it respawn after 3 mins using onBreak, but I can't find a respawn-command. Please help me :) Thanks a lot!
If you want to do this via map entities, it can get expensive because you'll need a point_template entity per every glass window. That is unless you want to do glass replacements in groups of 16, which is the max number of entities a single point_template can support. You'd have to kill all 16 windows when one breaks and then respawn all of them.
[QUOTE=GiGaBiTe;51899515]If you want to do this via map entities, it can get expensive because you'll need a point_template entity per every glass window. That is unless you want to do glass replacements in groups of 16, which is the max number of entities a single point_template can support. You'd have to kill all 16 windows when one breaks and then respawn all of them.[/QUOTE] You could use the same name for all the glass panes on one building. Not the ideal practice but it works. e.g. when you break a window Window: onBreak -> reset logic_timer Timer: onTimer -> spawn point_template That way the panes won't spawn until you've stopped breaking them. Edit: also remember to kill the windows before spawning them again to avoid duplicates.
you know the first result of searching "respawnable glass hammer" is a tutorial which will work
I think DarkRP has built in code to respawn windows althought it respawns them all at the same time after a specified time even if they weren't broken at the same time.
[QUOTE=Rehukotsa;52098190]You could use the same name for all the glass panes on one building. Not the ideal practice but it works. e.g. when you break a window Window: onBreak -> reset logic_timer Timer: onTimer -> spawn point_template That way the panes won't spawn until you've stopped breaking them.[/QUOTE] The problem with this method is that you'll end up spawning windows inside of windows since they all have the same name. If you break one window and trigger a respawn, there will now be a new window where the broken one was, and two windows inside each other where none were broken. Leaking entities like this can cause a server crash if too many are spawned, which is very possible if the map is running for many hours.
point_template support wildcard. So if your glass are named glass1, glass2, etc... You put: Template01 glass* Like other said, the best would be to kill all glass, and then spawn the template again.
[QUOTE=GiGaBiTe;52111478]The problem with this method is that you'll end up spawning windows inside of windows since they all have the same name. If you break one window and trigger a respawn, there will now be a new window where the broken one was, and two windows inside each other where none were broken. Leaking entities like this can cause a server crash if too many are spawned, which is very possible if the map is running for many hours.[/QUOTE] You could always kill the windows just before spawning them again, right? If not so, I have a problem in my map too :P
[QUOTE=Rehukotsa;52111831]You could always kill the windows just before spawning them again, right? If not so, I have a problem in my map too :P[/QUOTE] Yeah, you need to kill all of the entities in the point_template before respawning or you're going to leak entities.
Sorry, you need to Log In to post a reply to this thread.