-
Door with trigger
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
PHP Code:
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
PHP Code:
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 =)
-
I don't see a door1() function, remove this line:
PHP Code:
thread door1();
-
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();
-
Seems that the trig variable is undefined and you cant call the waittill func on it. Try to check it so
PHP Code:
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
-
Quote:
Originally Posted by
kolafresh
still got this error
PHP Code:
******* 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.
-
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");
}
}
-
4 Attachment(s)
Just to see if you are doing it correctly in radiant, did you make your door script_burshmodel?
Attachment 816
Then press 'n' on your keyboard and type 'targetname' in the Key field and your desired value, lets say 'door' and press enter:
Attachment 817
Create your trigger by doing this:
Attachment 818
And make sure your trigger looks something like this:
Attachment 819
And then again enter 'targetname' and your desired value in the appropriate fields under 'n' key.