detect multiple deaths

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
User avatar
erick
Major
Posts: 280
Joined: Wed May 30, 2007 1:14 am
Location: USA

detect multiple deaths

Post 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?
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

waittill death

Post 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
Tom Trude,

Image
Condor
Colour Sergeant
Posts: 82
Joined: Mon Apr 09, 2007 3:19 pm
Location: Bavaria (Germany)

Post by Condor »

btw is there any need to use "wait x" instead "waitframe"?
User avatar
erick
Major
Posts: 280
Joined: Wed May 30, 2007 1:14 am
Location: USA

Post 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
User avatar
erick
Major
Posts: 280
Joined: Wed May 30, 2007 1:14 am
Location: USA

Post 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" :?:
User avatar
erick
Major
Posts: 280
Joined: Wed May 30, 2007 1:14 am
Location: USA

Post 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
User avatar
erick
Major
Posts: 280
Joined: Wed May 30, 2007 1:14 am
Location: USA

or could it be because of this

Post 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
Post Reply