OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: Chomps on 24 Dec 2002, 05:37:44
-
Okay, so I have a script that allows a chopper to pick up a jeep or something and move it somewhere else and drop it via the action menu. It works fine in single player, but in multiplayer, the jeep will be picked up, but it will not drop off.
I suspect the reason is that the dropping of the jeep is controlled by a global variable that is checked for in the jeep's setPos loop (it consistantly places the jeep under the chopper until it sees that variable turns false, then it terminates the loop and lets the jeep drop)
The variable is switched to false in a script that is activated by an action. Perhaps the variable is not switching to false for all players?
The variable is not local, it was defined without the underscore in front. Any suggestions?
-
I had a question a several days ago about the publicVariable command that no one helped me to answer. However, in my research about the command, I think it'll do exactly what you need.
If I'm not mistaken, you use publicVariable everytime you assign a new value to a global variable, which will then broadcast the variable's new value to all clients. So, relating to your code, immediately after changing the value to false for your variable, put the following code:
publicVariable varName
Where varName is the name of your variable.
Hope it works. Good luck.
-
Thank you! I think that is exactly what I needed! ;D
(I cannot be sure until I test it in MP, but I am confident it should work.)
-
dont think u guys there
hi bytheway,
i'm busy too with multiplayer scripting and in scumball's airstrike u have same prob u need to exec script on all client computers you even have to declare public variables and transport them to all SQS scripts.
this howfar i am, i'm sure u guys problems have to do with same issue
snYper has made promise (If he has time) to explore the multiplayer scripting !!!
i really can do all but in multiplayer you have some tricks with local server stuff and more !!!!
hope more get to this issue
-
Far as I know, publicVariable will not work on a private variable (_variable).
A way around this could be to only run the setPos on the server, since all vehicles are local to it when empty (I think). For all setPos lines, try putting ?(local Server): in front (with the gamelogic named server of course). If there are other messages like radio or hint boxes, you could have other complications with script flow. If you posted the script we could probably help you more..
See either of my multiplayer tutorials for some background on publicVariable usage. I ought to write something on just publicVariable without all that flag crap, but oh well..
-
It is not a private variable I am working with.
-
Ah yes. Damn me for not comprehending what I read :-[