• Welcome Guest, The new Modme forums are here! Please visit here for all recommended information.

Answered Easter egg

iamKxcper

Member
I'm making a zombies map and i'm not really that good in scripting, does anyone know how i can make multiple triggers where i have to press my interaction button and when I've pressed all of them a door opens/disappears?

Also is it possible to make it that when i press the button it plays a sound?
 

Spiki

Well-known member
Didn't test but should work.
Something like this:
button_trig is the targetname of the triggers
button_door -targetname of the doors (!!!script models/brushmodels!!!)

Code:
thread buttons();

function buttons()
{
buttons = GetEntArray("button_trig","targetname");
doors = GetEntArray("button_door","targetname");

level.door_buttons = 0;

foreach(but in buttons)
    but thread button_logic();

while(level.door_buttons < buttons.size) //wait untill all buttons are pressed
    {
    wait 1;
    }

foreach(door in doors)
    {
    //what to do to all doors
    door ConnectPaths(); //for zombie pathing
    door Delete();
    }
}


function button_logic() //self = trigger
{
self SetHintString("Press &&1 to activate");
self SetCursorHint("HINT_NOICON");

self waittill("trigger");

level.door_buttons++;
}
 

iamKxcper

Member
Didn't test but should work.
Something like this:
button_trig is the targetname of the triggers
button_door -targetname of the doors (!!!script models/brushmodels!!!)

Code:
thread buttons();

function buttons()
{
buttons = GetEntArray("button_trig","targetname");
doors = GetEntArray("button_door","targetname");

level.door_buttons = 0;

foreach(but in buttons)
    but thread button_logic();

while(level.door_buttons < buttons.size) //wait untill all buttons are pressed
    {
    wait 1;
    }

foreach(door in doors)
    {
    //what to do to all doors
    door ConnectPaths(); //for zombie pathing
    door Delete();
    }
}


function button_logic() //self = trigger
{
self SetHintString("Press &&1 to activate");
self SetCursorHint("HINT_NOICON");

self waittill("trigger");

level.door_buttons++;
}
thanks! i'll try it out right now :)
 

iamKxcper

Member
okay so.. i had a problem for a second but i fixed the problem finally, after that i press the button the trigger is still there, do you know how i can make it disappear ? let's say that if button is pressed it deletes itself.
 
Last edited:

Spiki

Well-known member
okay so.. i had a problem for a second but i fixed the problem finally, after that i press the button the trigger is still there, do you know how i can make it disappear ? let's say that if button is pressed it deletes itself.
Code:
function button_logic() //self = trigger
{
self SetHintString("Press &&1 to activate");
self SetCursorHint("HINT_NOICON");

self waittill("trigger");
self delete();
level.door_buttons++;
}
 

iamKxcper

Member
Code:
function button_logic() //self = trigger
{
self SetHintString("Press &&1 to activate");
self SetCursorHint("HINT_NOICON");

self waittill("trigger");
self delete();
level.door_buttons++;
}
Thank you so much for the help, this means a lot! :)
 
Top