Jump to content
Sign in to follow this  
miraoister

Static gunner killed replacement gunner

Recommended Posts

Hi,

I haven't scripted for a few years, I would like to describe the scenario first,

Static gun. Gun1

Gunner. Gunner a

AnOther soldier. Gunner b,

I used a script in OFP years ago which activated a trigger if gunner a died, then gunner b would take over,

Check if gunner A alive, false, gunner b getingunner gun1, if someone could help me word that for arma2 I would be grateful.

This other link talks about a similar situation with spawns, but I don't want to spawn...

http://forums.bistudio.com/showthread.php?167938-createUnit-tell-to-get-in-as-gunner-if-gunner-of-static-gun-dies

Edited by miraoister
Grammar

Share this post


Link to post
Share on other sites

you pretty much have it already ;)

Put down empty static called gun_1

Put down unit called gunner_A

Put down unit called gunner_B

In A's init field:

gunner_A assignAsGunner gun_1; gunner_A moveInGunner gun_1;

Create trigger

- condition

!alive gunner_A

- onAct

gunner_B assignAsGunner gun_1; gunner_B moveInGunner gun_1;

Be advised the gunners will 'teleport' to the gun not move to it and enter.

Share this post


Link to post
Share on other sites

An additional way would be to use eventhandlers.

Editor placed static init line

(gunner this) addEventHandler ["killed", {call TAG_fnc_gunner}];

init.sqf (or w/e)

TAG_fnc_gunner = {
_static = (getPosATL (_this select 0)) nearestObject "O_HMG_01_high_F"; 
_unit = (group (_this select 0)) createUnit ["O_Soldier_F", getPosATL (_this select 0), [], 0, "NONE"]; 
_unit addEventHandler ["killed", {call TAG_fnc_gunner}];
_unit moveInGunner _static;
deleteVehicle (_this select 0);
};

Instead of teleporting the unit into the static you could have them manually go to the static and get in. Anyhow, just some more ideas to ponder.

Share this post


Link to post
Share on other sites
An additional way would be to use eventhandlers.

Editor placed static init line

(gunner this) addEventHandler ["killed", {call TAG_fnc_gunner}];

init.sqf (or w/e)

TAG_fnc_gunner = {
_static = (getPosATL (_this select 0)) nearestObject "O_HMG_01_high_F"; 
_unit = (group (_this select 0)) createUnit ["O_Soldier_F", getPosATL (_this select 0), [], 0, "NONE"]; 
_unit addEventHandler ["killed", {call TAG_fnc_gunner}];
_unit moveInGunner _static;
deleteVehicle (_this select 0);
};

Instead of teleporting the unit into the static you could have them manually go to the static and get in. Anyhow, just some more ideas to ponder.

ok, the teleportation problem, i remember this from years ago!

however wont the above script spawn a new soldier to teleport into the machine gun? i would rather have another solder be ordered to run over to the position and take the gun.

my plan after that was to have another solder drag the wounded solder back to the base but thats for later...

---------- Post added at 09:36 ---------- Previous post was at 09:32 ----------

you pretty much have it already ;)

Put down empty static called gun_1

Put down unit called gunner_A

Put down unit called gunner_B

In A's init field:

gunner_A assignAsGunner gun_1; gunner_A moveInGunner gun_1;

Create trigger

- condition

!alive gunner_A

- onAct

gunner_B assignAsGunner gun_1; gunner_B moveInGunner gun_1;

Be advised the gunners will 'teleport' to the gun not move to it and enter.

So how do we avoid the teleportation?

Share this post


Link to post
Share on other sites
I would rather have another solder be ordered to run over to the position and take the gun.

my plan after that was to have another solder drag the wounded solder back to the base but thats for later...

Give the soldier whom you want to man the gun a get In or get In Nearest waypoint onto the static gun. This could be done a number of ways. Quick and dirty would be to use a !alive trigger on the gunner of the static gun, sync'd with a (usually the first) waypoint of the guy on standby. This will hold him there until the gunner is killed, he will then run and man the static weapon.

To be clear; The unit on standby would have 2 waypoints. The initial (sync'd) move waypoint at his feet and the get in waypoint.

note: If the guy on standby is in a cycle patrol, you'll need to break the cycle by setting the !alive trigger's type to switch. This will break his patrol and have him go to the next waypoint(s) created after the cycle waypoint. In this case, the get in waypoint.

Edited by Iceman77

Share this post


Link to post
Share on other sites

Just have a small group and then give the leader a get in waypoint over an empty MG he will mount it and when he dies the next is ordered in and so on until the group is dead, it works with multiple machine guns as well and no scripting.

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  

×