OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: GeneralCoder on 16 Aug 2003, 09:14:05

Title: What type of variables can publicVariable send?
Post by: GeneralCoder on 16 Aug 2003, 09:14:05
Hi I wanted to use public variable to share array wich holds all the players in multiplayer like this in init.sqs:
comment" players is inited as players = [] in else where before this part gets executed"
players = players + [player]
PublicVariable"players"

Put that doesn't seem to work, so can't arrays be public?
Acording to command reference only types Number, Boolen, Object and Group are suported!

What type is player anyway? should be unit wich is object..?

ADD:

Just rememberd that I also need to update marker colors in client computers, but how?
Title: Re:What type of variables can publicVariable send?
Post by: Tactician on 16 Aug 2003, 09:43:13
players = players + [player]
PublicVariable"players"

Put that doesn't seem to work, so can't arrays be public?
Acording to command reference only types Number, Boolen, Object and Group are suported!

An array is not a number, boolean, object, or group.  An array is a separate data type.  You can't publicVariable arrays.

To change a marker's color you could do something like this..

markerColors = ["","ColorRED","ColorBLUE","ColorBlack"]
marker1Color = 0

Code: [Select]
;; script that waits for marker 1's color to change
#start
@marker1color > 0
"markername" setMarkerColor (markerColor select marker1color)
marker1color = 0
goto "start"

And to change the color for everyone, just have 1 client execute:

Code: [Select]
marker1color = x; publicVariable "marker1color"
Title: Re:What type of variables can publicVariable send?
Post by: GeneralCoder on 16 Aug 2003, 16:19:12
An array is not a number, boolean, object, or group.  An array is a separate data type.  You can't publicVariable arrays.

To change a marker's color you could do something like this..

markerColors = ["","ColorRED","ColorBLUE","ColorBlack"]
marker1Color = 0

Code: [Select]
;; script that waits for marker 1's color to change
#start
@marker1color > 0
"markername" setMarkerColor (markerColor select marker1color)
marker1color = 0
goto "start"

And to change the color for everyone, just have 1 client execute:

Code: [Select]
marker1color = x; publicVariable "marker1color"

Ok so no change sending arrays... thanks for that marker exampe though!
Title: Re:What type of variables can publicVariable send?
Post by: Chris Death on 17 Aug 2003, 02:24:39
Quote
Ok so no change sending arrays... thanks for that marker exampe though!

There is a chance for transfering arrays

Check out CoC Network services and you'll see  ;)

http://www.website.thechainofcommand.net/

~S~ CD