Home   Help Search Login Register  

Author Topic: Create Trigger Problem  (Read 1335 times)

0 Members and 1 Guest are viewing this topic.

Offline IGWedge

  • Members
  • *
  • Internal Coordinator @ www.ic-arma.com
    • International Conflict Armed Assault
Create Trigger Problem
« on: 24 May 2007, 21:33:31 »
Hi Again

Im trying to create a trigger via a script and im having a few problems....

It is in SQF format

At the beginning of the script i have this...
Code: [Select]
obj1=false

In the script i then create an enemy squad followed by the trigger.
I create the trigger like this...
Code: [Select]
_obj1trg = createTrigger["EmptyDetector",[7974,7282,0]];
_obj1trg setTriggerActivation ["EAST", "not present", false];
_obj1trg setTriggerArea [200, 200, 0, true];
_obj1trg setTriggerStatements ["this","obj1=true",""];
_obj1trg setTriggerTimeout [5, 10, 7, true ];

Then at the end of my script i have this
Code: [Select]
obj1=true;
hint "Mission Complete";
deleteVehicle _obj1trg;
deleteVehicle _bot1;
deleteVehicle _bot2;

The problem im having is that the second i execute the script "obj1" becomes true instantly even though there is still east enemys in the created trigger.
I tested making a trigger to have east present with a hint saying "Enemy  Present" this worked so im sure the trigger is being created.

I need the trigger to trigger obj1=true at the right time

Can someone help with this??

Many thanks

Wedge
« Last Edit: 24 May 2007, 21:35:13 by IGWedge »

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Create Trigger Problem
« Reply #1 on: 24 May 2007, 21:45:20 »
Try changing the order and adding a waitUntil:
Code: [Select]
_obj1 = false;

_obj1trg = createTrigger["EmptyDetector",[7974,7282,0]];
_obj1trg setTriggerArea [200, 200, 0, true];
_obj1trg setTriggerTimeout [5, 10, 7, true ];
_obj1trg setTriggerActivation ["EAST", "not present", false];
_obj1trg setTriggerStatements ["this","obj1=true",""];

waitUntil {obj1};
hint "Mission Complete";
deleteVehicle _obj1trg;
deleteVehicle _bot1;
deleteVehicle _bot2;

Offline IGWedge

  • Members
  • *
  • Internal Coordinator @ www.ic-arma.com
    • International Conflict Armed Assault
Re: Create Trigger Problem
« Reply #2 on: 24 May 2007, 23:54:27 »
Okey Doke

I have one more question.

If i have , say, two bots and i need to trigger a trigger if either one is dead
What is the best way to do this.

In the script within the trigger or seperatly..and how should this look??

I have tried

Code: [Select]
_bots = (units _grpbots);

if (not alive (_bots select 0)) exitwith {[] call mission_end};

mission_end =
{
deleteVehicle _obj1trg;
        hint "Mission Failed\nBots dead";
{deleteVehicle _x} foreach (units _guard);
{deleteVehicle _x} foreach (units _guardb);
{deleteVehicle _x} foreach (units _guardc);

};

No joy


« Last Edit: 24 May 2007, 23:57:24 by IGWedge »

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Create Trigger Problem
« Reply #3 on: 25 May 2007, 01:57:01 »
Code: [Select]
_bots = (units _grpbots);
_endnow = false;
while {!_endnow} do
{
   Sleep 2;
   _count = {damage _x > 0.9} count _bots;
   if (_count > 0) then
   {
      _endnow = true;
   };
};

deleteVehicle _obj1trg;
hint "Mission Failed\nBots dead";
{deleteVehicle _x} foreach (units _guard);
{deleteVehicle _x} foreach (units _guardb);
{deleteVehicle _x} foreach (units _guardc);

Never use "alive" for conditions, unless what you want to know is IF the group leader "THIKS" that unit is alive or dead.