so in basic English, what I am telling the engine to do is, Find every entity that has “myDoor” as it’s name. In hammer you can set the name of entities, and this is one of many links we have with hammer. This function ( ents.FindByName ) returns an array of entities that it has found ( if any ). the “” tells the engine to use the first one ( It’s a tad more complicated, its more about getting the entry of the table having 1 as it’s key, but that’s the more complicated explination).
Now that we have your door, we can use a function on it called Fire. In hammer you have inputs and outputs, in Lua, we have this function. We fire the input called “Open” with no flags.
If you were to call that, it would work, but you are asking for something with a delay. For delays, we have timers. the most simple timer is timer.Simple
timer.Simple has 2 arguments : Delay, and function. In other words, once the delay has passed, it is going to call the function. We can then do something like this:
you can see we have the previous code, inside the function argument. This function will be called after 5 seconds. Once you have worked out the delays you need for the doors to open when you need them too, this could look pretty awesome.
To close the doors afterwards, you would use ( I’m not sure ) “Close” instead of “Open” in the Fire function.