OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started 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
? 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 :)
-
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:
hint format ["%1",mpgame]
...and that kind of says the variable doesn't exist.
I would say, check the addon's config file.
-
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.
-
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"
-
? 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:
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?