PDA

View Full Version : Door with trigger



kolafresh
9th January 2015, 14:09
Hey everyone I try to make a door with a touch trigger next to it to make the door rotate, i've tryed to do like this script


main()
{
door = getent ("Secret","targetname");
trig = getent ("open","targetname");
while (1)
{
trig waittill ("trigger");
door rotateyaw (-80,3,1,1);
door waittill ("rotatedone");
wait (2.5);
door rotateyaw (80,3,1,1);
door waittill ("rotatedone");
wait (2);
}
}


and put this in my main gsc file



main()
{
maps\mp\_load::main();
thread door1();
setExpFog(0.0001, 0.55, 0.6, 0.55, 0);
// setCullFog(0, 16500, 0.55, 0.6, 0.55, 0);
ambientPlay("ambient_france");
game["allies"] = "american";
game["axis"] = "german";
game["attackers"] = "allies";
game["defenders"] = "axis";
game["american_soldiertype"] = "normandy";
game["german_soldiertype"] = "normandy";
setCvar("r_glowbloomintensity0", ".25");
setCvar("r_glowbloomintensity1", ".25");
setcvar("r_glowskybleedintensity0",".3");

maps\mp\mp_door::main();
}


... idk if im a noob or what but please help =)

kung foo man
9th January 2015, 14:29
I don't see a door1() function, remove this line:

thread door1();

kolafresh
9th January 2015, 14:47
still got this error ******* script runtime error *******
undefined is not an object: (file 'maps/mp/mp_door.gsc', line 7)
trig waittill ("trigger");
*
called from:
(file 'maps/mp/mp_4rooms.gsc', line 17)
maps\mp\mp_door::main();
*
started from:
(file 'maps/mp/mp_4rooms.gsc', line 1)
main()
* After i removed the thread door1();

Kantin
9th January 2015, 14:58
Seems that the trig variable is undefined and you cant call the waittill func on it. Try to check it so


main()
{
door = getent ("Secret","targetname");
trig = getent ("open","targetname");
while (1)
{
if(isDefined(trig) && isDefined(door))
{
trig waittill ("trigger");
door rotateyaw (-80,3,1,1);
door waittill ("rotatedone");
wait (2.5);
door rotateyaw (80,3,1,1);
door waittill ("rotatedone");
wait (2);
}
else
{
iprintlnbold("undefined object(s)");
wait 1;
}
}
}

and if u can see the error msg thats the problem

Mitch
9th January 2015, 15:17
still got this error

******* script runtime error *******
undefined is not an object: (file 'maps/mp/mp_door.gsc', line 7)
trig waittill ("trigger");
*

Can you verify that there is a trigger_*** with the targetname 'open' in your map? If there isn't one then getent will return undefined.

kolafresh
9th January 2015, 15:20
made it work with this script but my trigger semms not connected with the door...


main()
{
maps\mp\_load::main();

thread doors();
}


doors()
{
door = getent ("something","targetname");
trig = getent ("something","targetname");
while (1)
{
trig waittill ("trigger");
door rotateyaw (-80,3,1,1);
door waittill ("rotatedone");
wait (2.5);
door rotateyaw (80,3,1,1);
door waittill ("rotatedone");
}
}

YuriJurek
9th January 2015, 16:13
Just to see if you are doing it correctly in radiant, did you make your door script_burshmodel?

816

Then press 'n' on your keyboard and type 'targetname' in the Key field and your desired value, lets say 'door' and press enter:

817

Create your trigger by doing this:

818

And make sure your trigger looks something like this:

819

And then again enter 'targetname' and your desired value in the appropriate fields under 'n' key.