Home   Help Search Login Register  

Author Topic: trigger deactivation and stuff  (Read 1277 times)

0 Members and 1 Guest are viewing this topic.

gundernak

  • Guest
trigger deactivation and stuff
« on: 17 Jan 2004, 19:28:33 »
hi all,

I have a trigger. Name: trigger01. Rectangle. Repeated. This is my red zone.

I have a group. They are west. Based on the story only they will activate the trigger.  Therefore the trigger is activated 'west present'.

If a dude steps to the area of red zone, he will get a consequence.

The consequence is: setCaptive false.

I have tryed with exec a srcipt on activation using 'list trigger01' and "_x setCaptive false" forEach (list trigger01).

The problem is:
If a dude is inside the red zone, the trigger will not deactivate until he is killed or leave this territory.
And if meanwhile another dude enters the red zone he will not activate the trigger, because the trigger is not deactivated, and off course he will not get the setCaptive...
 :-\

Could you help me to get a solution on this?

thanks in advance

deaddog

  • Guest
Re:trigger deactivation and stuff
« Reply #1 on: 18 Jan 2004, 00:58:04 »
Try this:

Put this in your init.sqs or init line of your player:  countzone=0

in your trigger, do this:

condition:count thislist != countzone
activation:  countzone=count thislist; "_x setCaptive false" forEach thislist
deactivation: countzone=count thislist

each time a unit enters the trigger zone, it will activate the trigger.  It doesn't matter if a unit is inside already or not.  Basically, anytime the unitcount inside the trigger changes, all units inside the trigger will have "setcaptive false" run on them.

gundernak

  • Guest
Re:trigger deactivation and stuff
« Reply #2 on: 18 Jan 2004, 01:49:42 »
thanks for your answer,

I guess you advised the trigger repeatedly too, as I wrote...

I have to say, I am afraid of you are not right.
Because until deactivation not happens the trigger will not repeat.


Let's see:

A unit walks to the red zone, the others wait outside.

'count thislist' is now = 1, therefore 'count thislist != countzone' became true and the trigger is activated.

The dude inside got the 'setCaptive false'. OK

But the dude inside decides he stays inside furthermore.

Because of this, deactivation is not happening, and the trigger is not repeated yet.

At this moment another loon steps inside the red zone, and he does not activate anything...and off course he does not get the 'setCaptive false'.

that is the problem... :-\

deaddog

  • Guest
Re:trigger deactivation and stuff
« Reply #3 on: 18 Jan 2004, 02:13:21 »
Did you actually try this?

The trigger deactivates .5 seconds after it activates.  Why?  Becuase the condition is !=.

1. No one in trigger area, countzone = 0

2.  Unit walks in.  count thislist(1) != to countzone(0).  Trigger activates.  All units in trigger are setcaptive false

3.  countzone now equals count thislist (countzone = 1, count thislist = 1)

4.  Since countzone(1) is now equals to count thislist(1), the condition (!=) is no longer satisfied and the trigger is deactivated.

5.  Another unit walks in.  count thislist (2) != countzone (1).  Trigger activates.  All units in trigger are setcaptive false.

and it keeps going....
« Last Edit: 18 Jan 2004, 02:25:52 by deaddog »

gundernak

  • Guest
Re:trigger deactivation and stuff
« Reply #4 on: 18 Jan 2004, 02:26:52 »
yes I have tryed what you wrote,

believe me until there is no deactivation, there is no repeat!

Since then it looks I succeded to solve it with a script (altought not much wise):

Code: [Select]
_targets = list trigger01

#Loop

"_x setCaptive false" forEach _targets

? count _targets == 0: exit
? count _targets != 0:goto "Loop"

If you or anyone have a more elegant solution, it would be appriciated...

gundernak

  • Guest
Re:trigger deactivation and stuff
« Reply #5 on: 18 Jan 2004, 02:32:38 »
weird,

I wrote to 'on deactivation': hint "deactivate".

And I did not see once this to appear...

I tryed your idea this way:
I tell you now if a unit has setCaptive false inside the trigger he got killed.

I sent a soldier of my group to the red zone. And when he enters I follow him.

He got killed, me not...

In this case this way does not work.

Anyway thank you!!!

gundernak

  • Guest
Re:trigger deactivation and stuff
« Reply #6 on: 18 Jan 2004, 02:43:35 »
OK, sorry...

after a little experimenting, I can say deactivation happens!!!
As you wrote. Now I can see the hint appearing..

But sometimes when I fast enough and I step in the red zone immediately after the dude, it happens the trigger is not fast enough to detect me...
And I can stay inside as friendly, altought I supposed to be enemy and I should have got killed.

Is it possible a trigger is not fast enough?

deaddog

  • Guest
Re:trigger deactivation and stuff
« Reply #7 on: 18 Jan 2004, 02:48:01 »
It works great for me.  

I did this as a test:

I placed a west soldier named test1 in the trigger area (removed all weapons, setcaptive true)

condition:count thislist != countzone
activation:  countzone=count thislist; "_x setCaptive false" forEach (thislist - [test1])
deactivation: countzone=count thislist

I placed an east solider near the trigger.

My players group has three west guys.  I removed all weapons and setcaptive true on my group.

Now, I ordered my guys into the trigger area.  They are setcaptive false and the east soldier shoots them.  The west soldier named test1 in never shot and stays in the trigger area.

This part:

...  forEach (thislist - [test1])

ensures test1 doesn't get setcaptive false so he does not get shot.


Here is the test mission.  Just move your guys to the barrel and they will get shot.

http://home.earthlink.net/~dgk816/sitebuildercontent/sitebuilderfiles/captivefalse.intro.zip
« Last Edit: 18 Jan 2004, 02:52:47 by deaddog »

deaddog

  • Guest
Re:trigger deactivation and stuff
« Reply #8 on: 18 Jan 2004, 02:51:10 »
Is it possible a trigger is not fast enough?

That could be true.  A trigger only updates every .5 seconds (or so I've heard :) )

I'll try moving into the trigger behind one of my guys.

gundernak

  • Guest
Re:trigger deactivation and stuff
« Reply #9 on: 18 Jan 2004, 02:59:12 »
thanks man for your effort, really appriciated.

I understand every line of yours

And I did similar.

My red zone is a building (police) with guards.

The border is exactly the entrance.

If I send a loon to step inside the building and I simply follow him we got killed. It is OK.

But when I step inside following him very very close, almost the same time, it happens he got killed and they leave me alive...

deaddog

  • Guest
Re:trigger deactivation and stuff
« Reply #10 on: 18 Jan 2004, 03:03:03 »
I thought of another way to do this:

Set your redzone trigger to:
west present, repeating
condition: this
activation: nothing
deactivation: nothing

execute this script from init.sqs or an init line of a unit

[] exec "redzone.sqs"

;redzone.sqs

#loop
~1

{_x setcaptive false} foreach list trigger01

goto "loop"


I tested this and it works ok.  A little easier, too :)

gundernak

  • Guest
Re:trigger deactivation and stuff
« Reply #11 on: 18 Jan 2004, 03:08:22 »
yes yes :)

Similarly I realized it myself too I have mentioned above

Code: [Select]
_targets = list trigger01

#Loop

"_x setCaptive false" forEach _targets

? count _targets == 0: exit
? count _targets != 0:goto "Loop"

I guess we can solve now, and thanks again!!!

Offline Captain Crunch

  • Members
  • *
Re:trigger deactivation and stuff
« Reply #12 on: 18 Jan 2004, 06:23:25 »
Hi there!

   I've this problem before. (Triggers not responding fast enough).

   I solved the problem in a not so elegant way but it did worked fine.

   I set a similar trigger over the other. While one is being activated, the other is always ready to be activated. It also gives the time for the first activated trigger to be set to deactivated.

  Hmmm. Very unelegant way to do it but I thought of sharing the idea, just in case it might help.

 :)
Back to the forest!