Home   Help Search Login Register  

Author Topic: group reveal unit question.  (Read 965 times)

0 Members and 1 Guest are viewing this topic.

Baphomet

  • Guest
group reveal unit question.
« on: 29 Jun 2003, 04:42:41 »
I'm trying to write a interval based revealing script for multiplayer. However I'm not sure how script a way to get the list of human players and integrate that into the "group reveal unit" command.

So it's not simply one unit revealing another, but when a timer runs down for a particular player. His location is revealed to everyone on the map briefly.

Rubble_Maker

  • Guest
Re:group reveal unit question.
« Reply #1 on: 29 Jun 2003, 22:44:43 »
its not exactly a simple task because you cannot use arrays in MP scripts, so I'm afraid you will have to use metavariables. Here's some code you could try:

;// INIT.SQS CODE - RUNS ON ALL CLIENTS

~random .5
?format ["%1",clientCounter]=="scalar bool array string 0xfcffffef":clientCounter=0; publicVariable "clientCounter"
_player=PLAYER
_p=[_player]
Call Format ["client%1=_p select 0", clientCounter]; publicvariable format ["client%1", clientCounter]
clientCounter=clientCounter+1; publicVariable "clientCounter"

Ok short explaination: First off I check if the "clientCounter" var is initialized, if not it is set to zero. Next I make a metavariable "clientX" with X being a number from 0..clientCounter-1 and stick the player ID into it.
There is a random delay to reduce traffic and collisions of the variable broadcasting.

In you script where you need the player arrays, use the following expression to get hold of a player name:

_playerUnit=Call Format ["client%1",_c]

where _c is a number between 0 and (clientCounter-1)

hope that helps!

PheliCan

  • Guest
Re:group reveal unit question.
« Reply #2 on: 01 Jul 2003, 15:59:43 »
You can get the list of players by using the skill command. The player always have the skill set to 1 (even if you set it to something else in the editor). Avoid setting skills to 1 and check which units have the skill 1.

With this, you don't have to broadcast variables using publicVariable. :)