Home   Help Search Login Register  

Author Topic: moveing players & arrays  (Read 1227 times)

0 Members and 1 Guest are viewing this topic.

CopyrightPhilly

  • Guest
moveing players & arrays
« on: 13 Jun 2005, 16:20:16 »
ok i have a script that will move the players the a possion using setpos

ok and another, i'm using the units init filed to exec a script, that then adds them to an array...

should these be ran localy or server only?

cheers,
Phil
« Last Edit: 13 Jun 2005, 16:45:08 by CopyrightPhilly »

Offline RujiK

  • Members
  • *
  • KoKo Puh-Fizzles!
Re:moveing players & arrays
« Reply #1 on: 13 Jun 2005, 18:23:20 »
Depends what you want to do. Your question is too vague.

Obviously if more then one script are running at the same time go local, however if you want an array to keep all units added to it, then you would have to go global.
I like your approach, lets see your departure.
Download the New Flashlight Script!

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Re:moveing players & arrays
« Reply #2 on: 14 Jun 2005, 11:26:14 »
You could just put this in your init.sqs:

Code: [Select]
;init.sqs - player detection
;
player_pool = [player1,player2,player3,player4,player5,player6,player7,player8,player9,player10,player11,player12]

player_array = []

"if (alive _x) then {player_array = player_array + [_x]}" forEach player_pool

all you need change of course is;
playerx to whatever name you gave your players, and the
names of the arrays  ;)

No need for local/global, as init.sqs will be run everywhere and
so the check for presence of the units - no queries about wether local or global in this case.

And setposs'ing a player unit should be global anyway (as i
reckon setpos to be a global command).

:edit - oh i forgot to explain what the init.sqs script does;

first you put all playable units into an array (player_pool), and second you proove this array for present units (not disabled in player selection screen), and put them into another array (player_array)

~S~ CD
« Last Edit: 14 Jun 2005, 11:29:19 by Chris Death »
Dont argue with idiots....they will bring you down to their level and beat you there with experience.

How to use Waypoint type Scripted