Jump to content

Recommended Posts

Hi everyone.

I wish to disable trigger activation if my unit is dead.

So that's my code on my trigger :

Condition :

if(! alive  SB ) then {west countSide (getPos SB nearEntities 10) >0};


Activation :

bombornullanyvariablename = "R_80mm_HE" createVehicle getPos SB;



But that dont work, when my Unit "SB" is dead, if i near of this, i explode.


thanks for your help




 

Share this post


Link to post
Share on other sites

Give the trigger a name. For example  trig2

 

Instead of disabling  the trigger, you delete the trigger with the command    deletevehicle  trig2

 

The trigger is now deleted so obviously it will never fire.

 

 

 

 

 

  • Like 2

Share this post


Link to post
Share on other sites

Its also possible to disable a trigger completly and enable it afterwards again. Both can be done with the enableSimulation command.

  • Like 2

Share this post


Link to post
Share on other sites

I try this and i can't valid this command, i have erreur message

 

Condition :
 

! alive SB

Activation :

I try this
:

 

deletevehicle  trig2


and this :
 

enableSimulation trig2

 

Share this post


Link to post
Share on other sites

What was the error message?

Is the trigger Variable Name set to trig2?

 

The enableSimulation statement should be:

trig2 enableSimulation false;

Did test this quickly wiht a player unit and Trigger setup:

Variable name: trig2

Type: None

Activation: Any Player

Activation type: Present

Repeatable: yes

Condition: this

On Activation:

hint "Activated";
deleteVehicle trig2

On Deactivation:

hint "De-activated"

Walk into the area and "Activated" hint is displayed.  Walk out and nothig happens because the trigger has been deleted.

Good luck,  S

Edited by strider42
Corrected enableSimulation example

Share this post


Link to post
Share on other sites

The space is incorrect. The command is:

(!alive SB)

 

You can test this by placing a box on the map and then delete the box with a trigger.

  • Confused 2

Share this post


Link to post
Share on other sites

I don't want area for activate my trigger

This video use the script
 



And i just want to add an condition : If the suicide bomber is alive, the bomb explode, if he's dead, the bomb not explode


 

Share this post


Link to post
Share on other sites

Maybe you can use:

 

if(!alive SB && alive NameOfYourUnit ) then {west countSide (getPos SB nearEntities 10) >0};

that way if your unit is dead the trigger will not be activated. And if you are looking for a whole script this will do: 

 

Share this post


Link to post
Share on other sites
42 minutes ago, Joe98 said:

The space is incorrect. The command is:

(!alive SB)

 

nonsense!

 

these lines all return false:

!true
! true
!                                      true
!                            (true)
not true
not              true
!    (true) or !true or ! true or not true 

there is just no difference...

  • Like 2

Share this post


Link to post
Share on other sites

Here is mine (adapted from my own civilian life module):

 

(_tgt is the target of your kamikaze, the player for example)

 

Let's say your kamikaze is named SB (I adapted for making things as simple as possible), you need a loop and a condition for exiting the loop:
 

_tgt spawn {
  _tgt = _this;
  private _kamikaze = SB;

  while {alive _kamikaze} do {
    sleep 0.2;

    if (_kamikaze distance _tgt < 20) exitWith {

      sleep 6;
      if (alive _kamikaze) then {
        "R_80mm_HE" createVehicle (getPosATL _kamikaze);
        sleep 0.1;
        deleteVehicle _kamikaze
      };
    };
  };
};


The sleep 6 is just a delay from my script, allowing the kamikaze shouting and players reaction. Of course, the whole script is far more complex, the kamikaze starts chasing  any player's unit  and run on updated position of the closest one, shouting (depending on faction of civilian)... you can even grab charges if you kill him... but that's not the purpose.

Share this post


Link to post
Share on other sites

Thanks All for your help !

I found the solution, i use this on my trigger :
 

Condition :

if( alive  SB ) then {west countSide (getPos SB nearEntities 10) >0};

Activation :

bombornullanyvariablename = "R_80mm_HE" createVehicle getPos SB;


And now it works !

Share this post


Link to post
Share on other sites

Excuse my pedantic side here is my last offer for the setup using and Eden placed trigger:

 

Variable name: trig2

Type: None

Activation: None

Activation type: ---

Repeatable: no

Condition:

( alive SB ) && ( west countSide ( SB nearEntities 10 ) > 0 )

On Activation:

"R_80mm_HE" createVehicle SB

 

But as they say.  "If it is not broke, don't fix it".  S

Share this post


Link to post
Share on other sites
11 hours ago, Mcjaggon said:

Condition :


if( alive  SB ) then {west countSide (getPos SB nearEntities 10) >0};

 

 

How are you expecting this to evaluate? A trigger condition must return a boolean, so an if/then statement won't work. Or rather, the "if" evaluates to either true or false, which works, but the "then" does not. See @strider42's post above.

 

 

  • Like 3

Share this post


Link to post
Share on other sites

 

alive SB  // will return FALSE or TRUE along with the state of the kamikaze. Say true before being killed.
west countSide ( SB nearEntities 10 ) > 0  // will return... TRUE if any west unit within 10m of SB...

 

If SB is WEST... useless. I suppose SB is not WEST.

so FALSE, FALSE (West are too far from SB),....   SB is now close to a WEST unit:  TRUE, TRUE....  FALSE, FALSE when SB is killed with other units.
 

IMHO, same as:

west countSide ( SB nearEntities 10 ) > 0

 

 

  • Like 3

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

×