OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting Multiplayer => Topic started by: fleepee on 29 Sep 2008, 19:53:22
-
Hi!
I've a mission in which, i set progressive respawn points as you advance in the objectives...
read the last posts here: http://www.ofpec.com/forum/index.php?topic=31301.0;all#lastPost
The problem is that when a player join the mission, the respawn point changes... Of course I don't know how to solve it!!
I read many posts about JIP, but my scripting skills and understanding are... not good!
Here is a part of my init file:
onplayerConnected publicVariable "respawnpos"; publicVariable "tiberiaoccup"; publicVariable "prisopaslibres"; publicVariable "prisovie";
onplayerConnected publicVariable "secteur1"; publicVariable "secteur2"
if !(local Server) then {exit};
"3" objStatus "hidden";
"4" objStatus "hidden";
mygrp=group leader player;
tiberiaoccup=true;
prisopaslibres=true;
prisovie=true;
exit;
Thanks a lot!!
(I have 2 other missions with the same moving respawn points...)
-
You are misunderstanding the syntax of onPlayerConnected. It adds a single string script (that is, a commands inside "") which will be run whenever a player connects. e.g.
playerNames = [];
onPlayerConnected "playerNames = playerNames + [_name]; publicVariable 'playerNames'";
onPlayerDisconnected "playerNames = playerNames - [_name]; publicVariable 'playerNames'";
On the other hand, you don't need to public a variable again when someone JIPs, since they will automatically be synchronised with the last value that was publiced. Thus, you don't need to use onPlayerConnected for what you are doing.
; set everything to defaults on every machine (overwritten by server using publicVariable later or on JIP).
"3" objStatus "hidden";
"4" objStatus "hidden";
tiberiaoccup=true;
prisopaslibres=true;
prisovie=true;
; player will never be set on a dedicated server, so don't do anything more.
? isServer and (isNull player) : exit
; You can't get the group until the player spawns in.
@alive player
// "group player" is exactly the same as "group leader player"
mygrp=group player;
tiberiaoccup=false;
publicVariable "tiberiaoccup";
-
thanks!
I hope that that will solve the prob...
I'll try the updated mission ASAP!