Home   Help Search Login Register  

Author Topic: Multiple respawn and JIP  (Read 1330 times)

0 Members and 1 Guest are viewing this topic.

Offline fleepee

  • Members
  • *
  • Enter the Matrix!
Multiple respawn and JIP
« 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:
Code: [Select]
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...)

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Multiple respawn and JIP
« Reply #1 on: 29 Sep 2008, 21: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) [Select]
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) [Select]
; 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) [Select]
tiberiaoccup=false;
publicVariable "tiberiaoccup";
« Last Edit: 29 Sep 2008, 21:20:59 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline fleepee

  • Members
  • *
  • Enter the Matrix!
Re: Multiple respawn and JIP
« Reply #2 on: 30 Sep 2008, 10:09:44 »
thanks!
I hope that that will solve the prob...
I'll try the updated mission ASAP!