Home   Help Search Login Register  

Author Topic: if a leader do...  (Read 1572 times)

0 Members and 1 Guest are viewing this topic.

Offline 456820

  • Contributing Member
  • **
if a leader do...
« on: 30 Aug 2007, 16:05:45 »
Well new computer and I've started creating missions again however after not doing any scripting for a very long time I'm now very rusty.

My question is...

I have a trigger which I want to run a script on every squad leader in the area. However I cant quite remember how to do so.

I have set the activation trigger up however this is running on every single soldier in the trigger how do I make the trigger check if its a squad leader?

Closest I could think of is "this and leader" in the condition field, however no luck like I expected.
Cheers.

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: if a leader do...
« Reply #1 on: 30 Aug 2007, 16:12:41 »
Welcome home!  :cool2:

A little more detail. Are you trying to get the trigger to activate for only the leaders, or trying to get the on activation code to run only on the leaders?
urp!

Offline 456820

  • Contributing Member
  • **
Re: if a leader do...
« Reply #2 on: 30 Aug 2007, 16:13:30 »
Trying to get the trigger to activate for only the leaders.

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: if a leader do...
« Reply #3 on: 30 Aug 2007, 16:17:27 »
Code: [Select]
myLeader in thisList
or

Code: [Select]
myLeader1 in thisList || myLeader2 in thisList ...
or

Code: [Select]
({_x in thisList} count [myLeader1, myLeader2, ...]) > 0
edit: You could also group the trigger to the leaders, but make sure the trigger type is for the unit, not for the group.

urp!

Offline 456820

  • Contributing Member
  • **
Re: if a leader do...
« Reply #4 on: 30 Aug 2007, 16:21:44 »
Thanks for the reply.

But by any chance is there a more easier way, for use of a lot of squads? for example about 100+ squads or will I have to start naming them all?  :D

Offline Nixer6

  • Members
  • *
Re: if a leader do...
« Reply #5 on: 30 Aug 2007, 16:27:08 »
I guess you could loop thru the whole trigger list finding  :scratch:

leader group _this and then adding them to an array,  _leaders[].

Somebody who knows what they are doing will come along...I hope.  ;)
Why do I have to be a Rocket Scientist to make a good mission?

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: if a leader do...
« Reply #6 on: 30 Aug 2007, 16:42:35 »
Condition
Code: [Select]
{leader _x == _x} count thisList > 0;
OnActivation
Code: [Select]
{if (leader _x == _x) then {nul = [_x] execVM "myScript.sqf";}} forEach thisList
« Last Edit: 30 Aug 2007, 16:46:02 by Mr.Peanut »
urp!

Offline 456820

  • Contributing Member
  • **
Re: if a leader do...
« Reply #7 on: 30 Aug 2007, 17:05:44 »
thankyou very much, shall try and report back.

Offline 456820

  • Contributing Member
  • **
Re: if a leader do...
« Reply #8 on: 30 Aug 2007, 17:35:01 »
Well seems to work, thanks alot.

#topic solved