Hello,
I am looking for a Script that closes doors after 5 minutes can anyone help me with that?
I could be wrong but I think this is a map specific thing... like using hammer to handle opening/closing doors.
I thought so but i was hoping there was atleast 1 way
Entity/Fire
If you want somebody to make this for you then you should go to gmodstore, but if you're willing to make this yourself you can use Entity/Fire with "close" as the first argument to close doors.
Wouldn't you need to decompile the map to see how the doors are called before you tried to use this?
No you would just use that function on the door entity with Lua code.
but how would you call the door entity without know what it's called? or is there a way to do that in-game?
what? Just use GetEyeTrace().Entity to get the entity, if he wants the creation id of the door he'd use use: Entity/MapCreationID
If you want simple access to every door then you can just add each door to a table in a OnEntityCreated hook(so you don't have to iterate through ents.GetAll).
To check if the entity you're looking at is a door you can just check its class.
To check if a door is closed you need to get the a specific value from the Entity/GetSaveTable function, it comes with examples.
I haven't used eyetrace yet so I didn't know you could do that, thanks
On the topic, what's the difference between Entity:MapCreationID() and just Entity(index)?
Be careful if you use an Entity ID of the door on server start up though since depending on how many slots the server is set to the entity ID will change since each player slot is an extra entity that is reserved on the server. For example if you have the server player limit set to 64 and the id of the door is 164 if you then went and changed the player limit to 32 the new entity id of the same door will now become 132 since the player entities are created before all the map is setup on the server.
Another way would be looping through ents.GetAll(), checking if the entity class is a func_door, prop_door_rotating etc, I don't remember how many door classes Source has, and firing their Close input.
Sorry, you need to Log In to post a reply to this thread.