OFPEC Forum

Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting Multiplayer => Topic started by: bardosy on 14 Oct 2011, 09:06:49

Title: Veteran in single scripting, noob in multi
Post by: bardosy on 14 Oct 2011, 09:06:49
Hey,

I'm a veteran mission/campaign designer since OFP. And I created many scripts too. But - until now - I did it for single missions. Now I start to create multi missions, but I know nothing about multi scripting. Errrr... I have imagines about multi scripting and probably this is worst than know nothing. :)

Questions:

1. A good tutorial for multi scripting? I need only the multi specific things.

2. As I saw, the scripts for multiplayer missions start with a check, if the script run on the server and if not, then exit. Is it a basic truth? I have to start all the scripts with this? Eg: if I create a basic mission with lot of enemies in a town and I want to create a script if the enemies numer is under 5, the players got a new order, because 5 is low enough to continue the mission. And I check the enemies count by a script. Do I start this script with a if not server then exit?
And if I put a trigger to somewhere to check the BLUE presence and then run a script to spawn (create) a team of opfor. Do I start this create-script with server check? And if I didn't, this script run in every client and create so many opfor team as the players' count?

3. Please advice me a good respawn script.
I loved the mechanism of respawn in Insurgency. Is it a common respawn script or I have to mine it from the Insurgency?
Title: Re: Veteran in single scripting, noob in multi
Post by: i0n0s on 14 Oct 2011, 11:56:12
You have to watch for the locality of the functions.
There are two things to watch: The argument and the effect. The argument tells where you have to run the script. If it requires a local one, it has to run on the computer where the object is local, otherwise it should run on the server. And if you have a function with a local effect, you have to make sure that this function is called on all clients so that every user has the effect.

The isServer-check is there to make sure that only one instance of a script is running. So if you want to start a specific script at the beginning of the mission, you can use the init.sqf. But then it will run on every computer playing. And you only need it on one since most function has a global effect (setPos for example).
Title: Re: Veteran in single scripting, noob in multi
Post by: kju on 17 Oct 2011, 19:56:43
Check these links:
http://community.bistudio.com/wiki/Locality_in_Multiplayer
http://community.bistudio.com/wiki?title=6thSense.eu:EG
http://dev-heaven.net/projects/cmb/wiki
Title: Re: Veteran in single scripting, noob in multi
Post by: bardosy on 17 Oct 2011, 21:34:04
Thank both of you!