Jump to content
iacunited

Reinforcement help (Activate or Delete)

Recommended Posts

Very basic coding level.

The idea is if the player destroys a communication tower then the reinforcements in a vehicle are deleted however if the player continues on with the mission and gets detected then the reinforcements activate. Good news is I got both of those conditions met but during a test I discovered that if the reinforcements are activated and then the player destroys the tower the units are deleted. So in short I want three basic outcomes.

1) Tower destroyed = reinforcements deleted. (Works currently)

2) Tower not destroyed and player detected = activated reinforcements. (Works currently)

3) Tower not destroyed and player activated reinforcements then player destroys tower = no effect. (Not working)

 

Communication Tower = tower

Reinforcements and Vehicle = v1 (a vehicle carrying multiple enemies)

Target = hvt_1 

Trigger

-condition

!alive tower;

-activation

{deleteVehicle _x} forEach crew v1; deleteVehicle v1;

-deactivation [empty]

 

I have tried putting in this code for both condition and activation but it did not work.

if ((alive hvt_1) and (!alive tower) then ({deleteVehicle _x} forEach crew v1; deleteVehicle v1);

Any helpful tips?

 

Share this post


Link to post
Share on other sites
Guest

Hey,

You may give us more code because it's quite hard to understand but if I got what you are asking you need one more condition on 1) to act like 3)

I would check if v1 is alive in 1) so add a 

alive v1

to your 1) condition will do the trick.

 

EDIT : Actually you can also use IsNull

https://community.bistudio.com/wiki/alive

https://community.bistudio.com/wiki/isNull

 

Regards.

Share this post


Link to post
Share on other sites

You were almost there I think!

Easiest thing to do is to add in another condition to check whether reinforcements have been called, so your triggers would look like this:

 

Condition:

!alive tower && !reinforcements

On Activation can stay the same, the above means "If the tower is not alive (destroyed) and the reinforcements have not been called (reinforcements = false), then activate the trigger (delete the reinforcements)"

 

To make this work, edit the trigger used to call the reinforcements so it includes the simple statement:

[Your code to call the reinforcements];
reinforcements = true;

and add in the "init" section of your reinforcements' vehicle:

reinforcements = false;

 

This works as follows:

  • At the start of the mission, reinforcements = false
  • If the player then destroys the tower without being detected, !alive tower = true and !reinforcements = true (as the ! is the opposite of the current value), so the reinforcements are deleted
  • If the player is detected, reinforcements gets changed to true, so even if the tower is destroyed and !alive tower = true, !reinforcements will now be false, and the trigger will not delete the reinforcements.

Hope that helps!

  • Like 1

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

×