Make part of a map automatically triggered on server startup?

There’s two buttons that I want to be “pressed” automatically when the server starts, the interact with the map. I’m not sure how this would be done, I was thinking maybe through a server.cfg or something?

What do they do? you can get the MapCreationID() of entities like doors or whatever it is and call that function, like lock or unlock etc, in like “InitPostEntity” hook, like:

local doors = {};
doors[ 1 ] = true;
doors[ 23489 ] = true;

hook.Add( "InitPostEntity", "OpenDoors", function()
    for i, v in pairs( ents.GetAll() ) do
        if( doors[ v:MapCreationID() ] ) then
            v:Fire( "open", "", 0 );
end );

I mean all functions you can call with the button click I assume is also possible to call in lua, so you should be able to do exactly that, aslong as you get their map creation ID

You could mess with the flags in hammer for those buttons, or use Entity:Fire() on them in in it post entity. You can identify the entity using their map creation id

[editline]17th May 2015[/editline]


Thanks, how would I go about getting this map creation ID? Would I have to open the map in hammer?

with lua: entity:MapCreationID()

concommand.Add( "mapcreationid", function( ply )

    local tr = ply:GetEyeTrace();
    if( IsValid( tr.Entity ) && type( tr.Entity:MapCreationID() ) == "function" ) then
        ply:ChatPrint( "Entity creation id: " .. tr.Entity:MapCreationID() );

end );

By the way, thanks guys this worked!