Page 1 of 1

How do I escort someone/something important?

Posted: Tue Nov 12, 2002 5:37 am
by mohaa_rox
How do I script up something that wants you to escort someone/something important, like protecting Major Grillo? Then how do I script up something that will fail the mission once he/it is killed/destroyed?

Posted: Tue Nov 12, 2002 7:54 am
by jv_map
Ok, that's one of the most complicated things that are possible with the scripting language. It's very difficult to make a friendly lead the way. Bear in mind he has to follow a certain path and meanwhile has to attack enemies. If you really want to try, take a look at global/friendly.scr.

Making a mission fail as soon as the person is dead, is easy. You just have to start a thread (a separate scripting process) that waits till the character is killed. Then that thread will execute the lose code.

Posted: Fri Nov 15, 2002 3:27 am
by mohaa_rox
Thanks a lot. I'll try it.

Posted: Sat Nov 16, 2002 4:20 am
by mohaa_rox
So does it also mean like this script?

Let's say my VIP is called Grillo.:

If(IsAlive $Grillo)
$Grillo waittill death
thread missionfail
///////////////
missionfail:
iprintIn "Mission failed. Grillo has been killed."
wait 1
exec global/klled.scr (can't find right texture :( )
end

Posted: Sat Nov 16, 2002 6:57 am
by jv_map
I personally thought of something like this:

Code: Select all

main:
	// setup code here
	
	level waittill spawn
	
	// any code here
	
	if(isAlive $grillo)
		$grillo thread grillo_killed
	
	// any more code here
end

grillo_killed:
	$grillo waittill death
	iprintlnbold_noloc "Mission failed. Grillo has been killed."
	wait 3 
	missionfailed
end