Page 1 of 1

detect multiple deaths

Posted: Wed Jul 04, 2007 7:45 pm
by erick
I am making an SP map and one of the objectives is to kill the guards outside of the hotel.
There are three guards and my script goes like this but it doesnt work

Code: Select all

objective1:
iprintln_noloc "An objective has been added!"
waitthread global/objectives.scr::current_objectives 1
if(isAlive $sentry_1 || $sentry_2 || $sentry_3)
$sentry_1 waittill death && $sentry_2 waittill death && $sentry_3 waittill death
waitthread global/objectives.scr::add_objectives 1 3 "Kill all of the guards outside the complex.(3)"
thread objective2
end
the console says that "&&" is a bad token operator or something
does anyone know how to do this without super complex scripting?

waittill death

Posted: Thu Jul 05, 2007 3:48 am
by tltrude
These two lines will loop, every .2 seconds, untill all three are dead. Then it will go on to the next line.

while (isAlive ($sentry_1 || $sentry_2 || $sentry_3))
wait .2

Posted: Thu Jul 05, 2007 7:56 am
by Condor
btw is there any need to use "wait x" instead "waitframe"?

Posted: Fri Jul 06, 2007 2:59 pm
by erick
t|trude i tried your code and it didnt work :(
here is my script:

Code: Select all

objective1:
iprintln_noloc "An objective has been added!"
iprintln_noloc "You can not go into the hotel until the guards have been killed."
waitthread global/objectives.scr::current_objectives 1
while (isAlive $sentry_1 || $sentry_2 || $sentry_3)
wait .2
$maindoor_in triggerable //(THESE ARE FOR THE FRONT DOOR)
$maindoor_out triggerable //(these comments are not really in the script)
waitthread global/objectives.scr::add_objectives 1 3 "Kill all of the guards outside the complex.(3)"
thread objective2
end
There are no errors in the console but when i kill all of the guards and noclip through the locked front doors then the objective is marked as complete

Posted: Fri Jul 06, 2007 3:02 pm
by erick
Or could I pull out the door lock trigger lines and put them after "waitthread global/objectives.scr::add_objectives 1 3"
and before "thread objective2" :?:

Posted: Fri Jul 06, 2007 3:39 pm
by erick
okay i took a quick glance at your script and missed the other two )'s
the problem now is that the objective is marked off as completed as soon as i start. It doesnt wait until all the bad guys are dead. Here's what it looks like now:

Code: Select all

objective1:
iprintln_noloc "An objective has been added!"
iprintln_noloc "You can not go into the hotel until the guards have been killed."
waitthread global/objectives.scr::current_objectives 1
while (isAlive ($sentry_1 || $sentry_2 || $sentry_3))
wait .2
waitthread global/objectives.scr::add_objectives 1 3 "Kill all of the guards outside the complex.(3)"
$maindoor_in triggerable
$maindoor_out triggerable
thread objective2
end
Do you need something like this "{" around the "while ..." "wait .2"
part of the script.
I wouldnt know because i suck a scripting

or could it be because of this

Posted: Fri Jul 06, 2007 3:50 pm
by erick
this also appeared in the console and i dont know how to fix it.
Image
the $list.origin is a list that you have to steal. It is from a script origin
with model: animate/clipboard_nopulse.tik