Home   Help Search Login Register  

Author Topic: Array for all.  (Read 2294 times)

0 Members and 1 Guest are viewing this topic.

Offline 456820

  • Contributing Member
  • **
Array for all.
« on: 01 Sep 2006, 19:32:07 »
Okay well ive got an idea for a MP addon but need help on the scripting side.
Firstly;

How do i create an array of all playable soldiers in MP.
How to create an array of all Apaches placed on the map (Empty or manned)

It would however be fine to use triggers to get the array.
I need it so i can get an array of all players in the game so i can run a script on them like
[_array] exec "Script.sqs"

I need the array of all empty or manned apaches so i cna run a script on each apache.
Cheers.

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Re: Array for all.
« Reply #1 on: 04 Sep 2006, 15:55:30 »
Somebody said array?  ;)

Array of all playable units:

You need an init.sqs and you need to name each playable unit.

in int.sqs put following code:

Code: [Select]
your_array = []

"if (alive _x) then {your_array = your_array + [_x]}" foreach [unit1,unit2,unit,unit4,unit5,unit6,unit7,unit8,unit9,unit10,unit11,unit12]

:note - the example here is based on 12 units named unit1 to unit12

About the apaches array - just simple vanilla ofp apaches or addons too?

And for the all players array give me a little bit time and i'll see what i can do for you.  ;)

~S~ CD
Dont argue with idiots....they will bring you down to their level and beat you there with experience.

How to use Waypoint type Scripted

Offline rhysduk

  • Former Staff
  • ****
Re: Array for all.
« Reply #2 on: 04 Sep 2006, 21:03:41 »
Awwwww, you swine  :dry:

One question i could have answered about arrays and you beat me too it. :thumbsup: Congrats  :thumbsup:

I guess theres no beating you when it comes to arrays hey  :no:#

Rhys
Reviewed Missions Board: Please Read the User's Guide before posting!

Pride and Joy 1 (HW100-T)

Offline 456820

  • Contributing Member
  • **
Re: Array for all.
« Reply #3 on: 04 Sep 2006, 21:47:20 »
Thanks alot. Ill see how i can intergrate them into the addons scripts.
Cheers.

Edit - Oh yeah the apaches are vanilla ofp ones.

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Array for all.
« Reply #4 on: 05 Sep 2006, 20:16:40 »
CD has answered this question so many times, he has a shortcut on his desktop for a quick cut and paste.

Awwwww, you swine  :dry:

One question i could have answered about arrays and you beat me too it. :thumbsup: Congrats  :thumbsup:

I guess theres no beating you when it comes to arrays hey  :no:#

Rhys
urp!

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re: Array for all.
« Reply #5 on: 06 Sep 2006, 16:02:44 »
i think some of the postees are missing the point of this being required for an addon.

To create an array of all players, you could
a) tie your addon to require CoC_Ns and use its internal system to create an array of players (peers)
b) utilise a trigger named "My_Trigger" have your addon run a checking script to see if "My_Trigger" is present and if not throw up an error message explaining to the mission maker what is required

For an addon, ideally it needs to be self sufficient requiring little if any input from a mission maker

I see a problem with the apache issue, what if an addon version of an apache is used

Is there really a reason why you need an array of players, could you not use
?(local player) && (driver _veh == player):

An empty vehicle returns side civilian, maybe that could be used in your scripting system.

some mods  such as wgl have entries in the init fields of all units, within the config that are used to automatically create an array of units.
Having no idea what your script does, it would seem you have many barriers to overcome to make a truly mp compoatinble addon

What you could do is inherit your own apache class from a bis class and use the init field of your new helicopter class to run the rquired apache scripts


There are so many avenues that could be used, but without knowing what end product you are trying to achieve makes it difficult to answer
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re: Array for all.
« Reply #6 on: 06 Sep 2006, 16:26:42 »
Also have a look at Reply #6 here:
http://www.ofpec.com/forum/index.php?topic=27814.0