Author |
Topic: trigger dont work |
ukdjaj |
|
General Member Since: Jun 1, 2008 Posts: 2726 Last: Nov 15, 2020 [view latest posts] |
|
|
Category: CoD2 Scripting Posted: Sunday, Dec. 13, 2009 07:38 pm |
|
I Have my a map and in the floor there is a botton which u press it raise up 2 little squares then goes across, it does that fine but it is not letting the trigger open it. so when i start the map it already doing that like it isn't listen to the trigger
i have done it as a thread in mymap.gsc but i it works so i think its just somthing to do with the work its being called up?
Code:
main()
{
maps\mp\_load::main();
thread traindoor_traindoor();
thread traindoor_traindoor1();
game["allies"] = "british";
game["axis"] = "german";
game["british_soldiertype"] = "commando";
game["british_soldiervariation"] = "normal";
game["german_soldiertype"] = "wehrmacht";
game["german_soldiervariation"] = "normal";
game["attackers"] = "allies";
game["defenders"] = "axis";
}
traindoor_traindoor()
{
door=getent("traindoor","targetname");
wait (20);
trig=getent("trigger_traindoor","targetname");
while(1)
{
trig waittill ("trigger");
door movez (2,1,0.5,0.5);
door waittill ("movedone");
wait (1);
door movex (-36,1,0.5,0.5);
door waittill ("movedone");
wait (5);
door movex (36,1,0.5,0.5);
door waittill ("movedone");
wait (1);
door movez (-2,1,0.5,0.5);
door waittill ("movedone");
}
}
traindoor_traindoor1()
{
door=getent("traindoor1","targetname");
wait (20);
trig=getent("trigger_traindoor","targetname");
while(1)
{
trig waittill ("trigger");
door movez (2,1,0.5,0.5);
door waittill ("movedone");
wait (1);
door movex (36,1,0.5,0.5);
door waittill ("movedone");
wait (5);
door movex (-36,1,0.5,0.5);
door waittill ("movedone");
wait (1);
door movez (-2,1,0.5,0.5);
door waittill ("movedone");
}
}
|
|
|
|
COD4GRC |
General Member Since: Aug 12, 2007 Posts: 44 Last: Jan 30, 2010 [view latest posts] |
|
|
Category: CoD2 Scripting Posted: Sunday, Dec. 13, 2009 08:15 pm |
|
Your code seems fine.
Could you try to post if this function returns "1" (true)
Code: iprintlnbold(isdefined(getent("trigger_traindoor","targetname"));
(The function waittill("trigger"); may being skipped if the trigger is not defined)
edited on Dec. 13, 2009 03:15 pm by COD4GRC |
|
|
|
liltc64 |
General Member Since: Feb 12, 2007 Posts: 906 Last: Oct 22, 2012 [view latest posts] |
|
|
|
Category: CoD2 Scripting Posted: Sunday, Dec. 13, 2009 08:15 pm |
|
it means u dont have a trigger on ur map so its just gona run no matter what, try checking ur spelling and if ur spelling is fine then delete the current trigger u have and make another just like it and recompile, u can also try this to prove if there is a trigger on the map.
Code: traindoor_traindoor()
{
door=getent("traindoor","targetname");
wait (20);
trig=getent("trigger_traindoor","targetname");
if(!isdefined(trig))
{
iprintln("^3Cannot Find trig");
}
while(1)
{
trig waittill ("trigger");
door movez (2,1,0.5,0.5);
door waittill ("movedone");
wait (1);
door movex (-36,1,0.5,0.5);
door waittill ("movedone");
wait (5);
door movex (36,1,0.5,0.5);
door waittill ("movedone");
wait (1);
door movez (-2,1,0.5,0.5);
door waittill ("movedone");
}
}
traindoor_traindoor1()
{
door=getent("traindoor1","targetname");
wait (20);
trig=getent("trigger_traindoor","targetname");
if(!isdefined(trig))
{
iprintln("^3Cannot Find trig");
}
while(1)
{
trig waittill ("trigger");
door movez (2,1,0.5,0.5);
door waittill ("movedone");
wait (1);
door movex (36,1,0.5,0.5);
door waittill ("movedone");
wait (5);
door movex (-36,1,0.5,0.5);
door waittill ("movedone");
wait (1);
door movez (-2,1,0.5,0.5);
door waittill ("movedone");
}
} |
|
|
|
COD4GRC |
General Member Since: Aug 12, 2007 Posts: 44 Last: Jan 30, 2010 [view latest posts] |
|
|
|
ellard8 |
General Member Since: Aug 25, 2008 Posts: 80 Last: Oct 17, 2016 [view latest posts] |
|
|
|
ellard8 |
General Member Since: Aug 25, 2008 Posts: 80 Last: Oct 17, 2016 [view latest posts] |
|
|
|
COD4GRC |
General Member Since: Aug 12, 2007 Posts: 44 Last: Jan 30, 2010 [view latest posts] |
|
|
|
ellard8 |
General Member Since: Aug 25, 2008 Posts: 80 Last: Oct 17, 2016 [view latest posts] |
|
|
|