How do I escort someone/something important?

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
User avatar
mohaa_rox
Field Marshal
Posts: 2760
Joined: Mon Nov 11, 2002 7:05 am
Contact:

How do I escort someone/something important?

Post 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?
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post 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.
User avatar
mohaa_rox
Field Marshal
Posts: 2760
Joined: Mon Nov 11, 2002 7:05 am
Contact:

Post by mohaa_rox »

Thanks a lot. I'll try it.
User avatar
mohaa_rox
Field Marshal
Posts: 2760
Joined: Mon Nov 11, 2002 7:05 am
Contact:

Post 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
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

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