OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting Multiplayer => Topic started by: UH60MG on 07 Apr 2009, 14:05:01

Title: Random numbers , etc, in MP
Post by: UH60MG on 07 Apr 2009, 14:05:01
Hello,

I want to generate 1 random number for all the machines in a multiplayer COOP game, then I want to spawn the enemies using CreateUnit. How do I do this so I dont get multiple copies?

I am using .sqs scripts.
Title: Re: Random numbers , etc, in MP
Post by: i0n0s on 07 Apr 2009, 14:58:57
Code: [Select]
//Init
Random_array = [];
for "_i" from 0 to MAXNUMBER do {
Random_array = Random_array + [_i];
};

//Get random number:
_random = Random_array select floor random (count Random_array);
Random_array = Random_array - [_random];
I'm using SQF.
Title: Re: Random numbers , etc, in MP
Post by: Deadfast on 07 Apr 2009, 16:10:00
CreateUnit is global BTW so no need to execute it on every client.
Title: Re: Random numbers , etc, in MP
Post by: UH60MG on 08 Apr 2009, 23:42:06
CreateUnit is global BTW so no need to execute it on every client.

That is helpful. Is there a list anywhere of which commands are global?
Title: Re: Random numbers , etc, in MP
Post by: Worldeater on 09 Apr 2009, 09:40:10
Check the "Links" section of this site (http://community.bistudio.com/wiki/Image:effects_global.gif). The list is not complete yet but it's a good start.