Im not very good in scripting, I know some basics, but I dont get it, whats wrong with this script?
BTW: this is the only script in the map (has the same name as the map, so it should work)
This is an objective script
Code: Select all
main()
{
thread objective()
objective()
trig_obj = getent ("smile1objectivestart","targetname");
trig_loc = getent ("smile1objectiveend","targetname");
obj = getent ("smile1knife","targetname");
while(1)
{
trig_obj waittill ("trigger",user);
user.holdobj = 1;
user thread watchobj();
obj hide();
trig_obj thread maps\mp\_utility::triggerOff();
user iprintln("Use the knife to get yourself through the shrubs!");
while(user.holdobj == 1)
{
if(user isTouching(trig_loc))
{
user iprintln("You have chopped all parts of the shrubs and you are able to walk through it");
user iprintln("Well done!");
wait 2;
smile1obstakel moveZ (-100, 1);
smile1obstakel waittill ("movedone");
wait 3;
smile1obstakel moveZ (100, 1);
smile1obstakel waittill ("movedone");
user.holdobj = 0;
obj show();
trig_obj thread maps\mp\_utility::triggerOn();
user notify("objective_dropped");
}
wait 0.5;
}
wait 0.05;
}
}
watchobj()
{
self endon("objective_dropped");
obj = getent("objective","targetname");
trig_obj = getent("trig_obj","targetname");
for(;;)
{
if(self.health < 1)
{
self.holdobj = 0;
obj show();
trig_obj thread maps\mp\_utility::triggerOn();
self iprintln("You have dropped the knife!");
break;
}
wait 1;
}
}
Please help me