Jump to content
Sign in to follow this  
-RIP-Tyson

A flaw in my mission

Recommended Posts

can anyone help me as this is driving me mad.... as always I have searched (for over 2 hours) and cannot find an answer this time.....

Basically my (first ever real) MP coop mission involves a patrol searching and destroying ammo caches and eventually killing an enemy leader ( I know its not massively original but I'm trying to learn this first).

I want the patrol to have air cover and I want the objectives to be completed in a set order and this is where the problem lays..

How do I prevent a stray bomb killing the enemy leader whilst the ground troops complete objectives 1 and 2?

I've thought about spawning him in after the 2nd objective is complete but cant find a way of spawning in a named unit with an !alive trigger attached to him...

I also thought about making him invulnerable until obj2 is complete but cant work out how to do it.

So can anyone help me please?

Share this post


Link to post
Share on other sites

When you spawn the unit you can just place that unit into a global variable and then in the mission ending script have a waitUntil {!isNil leaderName}; waitUntil {!alive leaderName}; instead of using a trigger. Or of course you could use setVehicleVarName.

For invulnerability: http://community.bistudio.com/wiki/allowDamage (needs to run on all machines to take effect properly)

Share this post


Link to post
Share on other sites

Thanks for answering although being honest your answer is beyond me as I'm still very new to this...

The killing of the enemy leader isn't the last objective as the mission ends when the squad return to base so I'm not sure if your way will work....and in any case I'm not really sure how to do it.

Is there a simple script which will spawn in my target with the name and if so could you show me? Also will the !alive trigger fire if the enemy is not present or just when he is and he has been killed?

Sorry to be a pain but this is my first real attempt at doing anything more complicated than a simple mission...

Share this post


Link to post
Share on other sites

westgroup = createGroup WEST;
leadername = westgroup createUnit ["USMC_Soldier_Pilot",getpos glogic, [], 0, "FORM"];

that should let you spawn a unit. place it in a trigger or script.

as for the trigger you can set it up as normal as it doesn't throw up any problems.

Oh glogic is the name of a game logic placed where you want him to spawn

If you don't use a trigger this would work placed in a script, just add the code for what you want it to do after the leader is dead.

waitUntil {!isNil "leaderName"}; 
waitUntil {!alive leaderName};
// rest of code here

Edited by F2k Sel

Share this post


Link to post
Share on other sites

If you want things to happen in a certain order, just place in a script executed from your init.sqf:

if (!isServer) then
{
"end1" addPublicVariableEventHandler
{
	if (dialog) then
	{
		closeDialog 0;
	};
	endMission "END1";
};
};

backToBase=false;
cache2 allowDamage false;
cache3 allowDamage false;
waitUntil {!alive cache1};
cache2 allowDamage true;
waitUntil {!alive cache2};
cache3 allowDamage true;
waitUntil {!alive cache3};

if (isServer) then
{
_westgroup = createGroup WEST;
_leader = _westgroup createUnit ["USMC_Soldier_Pilot",getpos glogic, [], 0, "FORM"];
waituntil {!alive _leader};
waitUntil {backToBase}; // this is set to true by the trigger in the base area

end1=true;
publicVariable "end1";
sleep 5;
endMission "END1";
};

Of course proper hints/messages can be added accordingly.

Edited by galzohar

Share this post


Link to post
Share on other sites

Brilliant advice from both of you thanks very much... Flaw sorted & mission development back in progress again.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×