How do I escort someone/something important?
Moderator: Moderators
How do I escort someone/something important?
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?
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.
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.
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