Home   Help Search Login Register  

Author Topic: One trigger - bunch o' peeps  (Read 1471 times)

0 Members and 1 Guest are viewing this topic.

zsa_zsa_rasputin

  • Guest
One trigger - bunch o' peeps
« on: 28 Aug 2003, 14:44:25 »
I want to make it so that a group of civilians will Switchmove "FXStandsuruniv" (ie. Surrender)
When they are within the area of a trigger...

That is to say:
I will have a trigger of a certain size and a bunch of civilians (All different groups)
What I want to happen is that all those civilians inside the trigger area will surrender

That's it :)

Cheers,
Dan ;D

Drozdov

  • Guest
Re:One trigger - bunch o' peeps
« Reply #1 on: 28 Aug 2003, 15:14:37 »
Okay, this can be done with the one trigger as long as all the civvies are in the same group. Group their leader with the trigger (in the normal way) and then open up that trigger. You will now see new options in the activation field (vehicle, group leader, any group member or whole group). Choose 'Whole Group', so that it activates only when every group member is present. The next bit I think will require much typing. Do the switchmove standsuruniv thing on each of the civvies. Note that you may have to put a delay on the trigger if you want them to surrender in a nice line  :) . Otherwise they will do it as soon as the last person enters, which will probably not give enough time to get them to where they should be.

zsa_zsa_rasputin

  • Guest
Re:One trigger - bunch o' peeps
« Reply #2 on: 28 Aug 2003, 15:30:46 »
Thanks Drozdov, but...

a> I want more than 12 people to surrender... (Ie. more than 1 group)
b> I want the trigger to set them to surrender rather than have to type in manually in each of their init lines - otherwise the triggers seems a bit pointless! :P

Dan ;D

deaddog

  • Guest
Re:One trigger - bunch o' peeps
« Reply #3 on: 28 Aug 2003, 15:43:10 »
Do you want the trigger to activate as soon as a civilian enters the area (ie, a civilian present trigger)?  The problem with that is it is going to activate when the first civy enters the trigger area.  He might surrender but the guy right behind him will not (he is not inside the trigger).  That would look kind of funny :)

OR

Do you want the trigger to be activated by another means (a variable) and everyone that happens to be standing in the trigger area surrender?

Either way, you can get a list of all the civilians in the trigger like this:

In the activation field, put:  civylist = +thislist

Now you have an array of all the civilians inside the trigger area.  You can loop through this array to play the surrender move.  Or you can just type this in the activation field:

{_x Switchmove "FXStandsuruniv"} foreach thislist

Drozdov

  • Guest
Re:One trigger - bunch o' peeps
« Reply #4 on: 28 Aug 2003, 15:55:03 »
Quote
b> I want the trigger to set them to surrender rather than have to type in manually in each of their init lines - otherwise the triggers seems a bit pointless!

Who said anything about init lines?  :P

I think with use of a counter and what dead dog said about the list thing you could set it so that when there was a certain amount of people in the trigger it would activate. And that {_x switchmove "FXstandsuruniv"} foreach thislist trick would mean a lot less work. Assuming it works... arrays don't behave themselves very often.

zsa_zsa_rasputin

  • Guest
Re:One trigger - bunch o' peeps
« Reply #5 on: 28 Aug 2003, 15:55:36 »
Basically - I just want anybody who happens to BE in the trigger - to switchmove "FXStandSurUniv".
That's it! :D
Please just tell me what I need to put in the trigger's init line! :)

Dan ;D

deaddog

  • Guest
Re:One trigger - bunch o' peeps
« Reply #6 on: 28 Aug 2003, 16:37:24 »
Quote
Assuming it works... arrays don't behave themselves very often

Hmm, I've never had problems with arrays.  I use them a lot.  You do have to watch out when you assign one array to equal another, ie thisarray=thatarray.  Both arrays point to the same memory!!   Changing the contents of either one changes both.  You have to use the + operator when assigning arrays:  thisarray=+thatarray.  That makes two independent copies.  (Just in case you didn't know all that :) )

Quote
Please just tell me what I need to put in the trigger's init line!

A trigger does not have an init line.   What you want is this type of trigger:

activation:  civilian, present
condition: this
on activation: {_x Switchmove "FXStandsuruniv"} foreach thislist

Even if you use a repeating trigger, it will not retrigger until whatever caused it to activate is removed from the trigger area.  It has to de-activate before it can re-activate (or repeat).  So, as soon as the first civilian enters, he will be the only one to surrender, even if others enter the trigger zone.  One way to get around this is to setpos the trigger somewhere else, wait 1 second and then setpos it back.  Use a small script:

;movetrigger.sqs

_trig=_this select 0

_pos=getpos _trig

_trig setpos [0,0,0]
~1
_trig setpos _pos

exit


So name the trigger civytrigger (make it repeating) and put this in the on-activation field:
{_x Switchmove "FXStandsuruniv"} foreach thislist;[civytrigger] exec "movetrigger.sqs"

The 1 second delay gives it time to de-activate.

Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:One trigger - bunch o' peeps
« Reply #7 on: 29 Aug 2003, 03:45:31 »
Or you could do something like this:

Init.sqs or any units init field:

civintrig = 0

Trigger

Radius: as required
Condition: Civilian Present (Repeatedly)
Condition Field: civilian countside thislist != civintrig
OnActivation Field: "_x switchmove {FXStandsuruniv}" foreach thislist; civintrig = (civilian countside thislist)


That would effectively 'reset' the trigger every time a new civilian entered it... ;)

deaddog

  • Guest
Re:One trigger - bunch o' peeps
« Reply #8 on: 29 Aug 2003, 04:32:42 »
@Sui

I just tried that and it works great.  I learn something new every day :)  The only problem that I saw is with a group.  Only the leader would do the fx move (as he walked into the trigger area).  But that is easily fixed by this:

on activation:
Code: [Select]
{_g=_x;"_x switchmove {FXStandsuruniv}" foreach units (group _g)} foreach thislist; civintrig = (civilian countside thislist)
That makes everybody in the civilians group surrender (if that is actually necessary).

Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:One trigger - bunch o' peeps
« Reply #9 on: 29 Aug 2003, 04:36:17 »
Granted, but when the next guy in the group walks into the trigger, he'll switchmove too ;)

deaddog

  • Guest
Re:One trigger - bunch o' peeps
« Reply #10 on: 29 Aug 2003, 04:45:00 »
It depends on the formation.

When the leader stops, the rest of the group will take their proper places in relation to the leader.  If that happens to be in the trigger area then they will do the switchmove (which looks stupid because it happens too fast, but playmove doesn't work).