OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: ROBINO on 11 Aug 2005, 19:29:58

Title: is "mpgame" a variable
Post by: ROBINO on 11 Aug 2005, 19:29:58
while having a sneaky peek at UKF's new Warrior APC addon - i wanted to see how they managed to get the suspension animations working only in single player

i saw this code

Code: [Select]
? mpgame: exit

my only questions are ... does this code work and successfully detect MP games ?

i have never seen "mpgame" anywhere before - but i AM new at this :)
Title: Re:is "mpgame" a variable
Post by: Baddo on 11 Aug 2005, 20:29:07

Must be their own variable. If a variable like that one existed, it would be a boolean variable (true or false) and you can easily test it:

Code: [Select]
hint format ["%1",mpgame]
...and that kind of says the variable doesn't exist.

I would say, check the addon's config file.
Title: Re:is "mpgame" a variable
Post by: nominesine on 11 Aug 2005, 20:58:48
Probably a home made variable. The BAS helicopters use a similar variable called basmp (or something like that). If it is set to true, the scripted effects (like cargo, rappel, rope ladders and fire) work better in an MP environment.
Title: Re:is "mpgame" a variable
Post by: Terox on 12 Aug 2005, 21:43:35
if you are after a system to detect if its an mp game or not, you can query the playersnumber

eg

? (playersNumber WEST + playersNumber EAST + playersNumber RESISTANCE + playersnumber CIVILIAN) >1

its gotta be an mp game unless only 1 player is playing on the server

or using a gamelogic called server

?(local server && local player): hint "this is not a dedicated server"
Title: Re:is "mpgame" a variable
Post by: Killswitch on 01 Sep 2005, 14:30:59
Code: [Select]
? mpgame: exitmy only questions are ... does this code work and successfully detect MP games ?
It's just a (somewhat badly) named variable. Why is it badly named? One could argue that by not using an OFPEC tag (Eg UKF_mpgame in this case) it's easy to confuse people. One victim of that is...you ;D

But now that it's there...how can you put it to use? Well, you could have this in the init.sqs of your mission:
Code: [Select]
mpgame={playersNumber _x}count[east,west,resistance,civilian]>0and the addon would adapt to SP/MP games the way the author of that particular script wanted it to do.

Neat, huh?