Welcome, Guest Thursday 17th April 2014, 11:40:14
   Home   Help Search Login Register  

OFPEC Forum

Author Topic: Multiple respawn and JIP  (Read 325 times)
0 Members and 1 Guest are viewing this topic.
fleepee
*
Offline Offline


Enter the Matrix!


« on: 29 Sep 2008, 18: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:
Code:
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...)
Logged
Spooner
*
Offline Offline


Mostly useless


WWW
« Reply #1 on: 29 Sep 2008, 20:14:58 »

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.
Code: (maintain a list of the names of all players currently connected and broadcast from the server to all players)
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.
Code: (init.sqs)
; 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;

Code: (sending an updated value from the server)
tiberiaoccup=false;
publicVariable "tiberiaoccup";
« Last Edit: 29 Sep 2008, 20:20:59 by Spooner » Logged

[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)
fleepee
*
Offline Offline


Enter the Matrix!


« Reply #2 on: 30 Sep 2008, 09:09:44 »

thanks!
I hope that that will solve the prob...
I'll try the updated mission ASAP!
Logged
Pages: [1]   Go Up
  Send this topicPrint  
 
Jump to: