PDA

View Full Version : JIP and Mission/task after Respawn (thx)



R34P3R
Jun 10 2009, 00:10
Hi there.. i try to create my first Arma Mission... i have Readed the JIP in Murrys-Guide. Bur i have a little problem... First please check my Script if this will work for JIP i dont understand this part to 100%.

So first.. please check if this will work:

my Init.sqf:



CurrentMission=1;

if(isServer) then{ publicVariable "CurrentMission"; };

onPlayerConnected "Server exec ""mission_update.sqf"" ";


The mission_update.sqf:



if(isServer) then{ publicVariable "CurrentMission"; };

if(CurrentMission == 1)then {
_MissionBriefingLong = "Mission 1";
_MissionBriefingHUD = "";
_MissionBriefingShort = "TEST1";
Mission1 = player createSimpleTask ["obj1"];
Mission1 setSimpleTaskDescription [_MissionBriefingLong,_MissionBriefingShort,_MissionBriefingHUD];
Mission1 setSimpleTaskDestination (getMarkerPos "obj1");
Mission1 settaskstate "CURRENT";
[objNull, ObjNull, Mission1, "CURRENT"] execVM "CA\Modules\MP\data\scriptCommands\taskHint.sqf";
player setCurrentTask Mission1;
};

if(CurrentMission == 2)then {

[objNull, ObjNull, Mission1, "SUCCEEDED"] execVM "CA\Modules\MP\data\scriptCommands\taskHint.sqf";
Mission1 settaskstate "SUCCEEDED";
_MissionBriefingLong = "Mission 2";
_MissionBriefingHUD = "";
_MissionBriefingShort = "TEST2";
Mission2 = player createSimpleTask ["obj2"];
Mission2 setSimpleTaskDescription [_MissionBriefingLong,_MissionBriefingShort,_MissionBriefingHUD];
Mission2 setSimpleTaskDestination (getMarkerPos "obj2");
Mission2 settaskstate "CURRENT";
[objNull, ObjNull, Mission2, "CURRENT"] execVM "CA\Modules\MP\data\scriptCommands\taskHint.sqf";
player setCurrentTask Mission2;
};



Will this work ? or do i anything wrong ?

So and now i have a little Problem.. if ti load up my test Mission on Multiplayer (Creating a LAN Server) ive got the current mission and Task. BUT.. if i got killed and Respawning my Complete Mission/Task is deledet. SO i dont have a Mission after Respawn.

Thanks a lot for your Help. Hope u support some noobie questions :D

Dr_Eyeball
Jun 10 2009, 00:42
1. You cannot use 'exec' to exec a sqf file, so use 'execVM' instead.

2. You won't need this with the changes below, but normally for proper JIP support, you would:

//change:
CurrentMission=1;
//to:
if (isNil "CurrentMission") then {CurrentMission = 1};
so that you do not overwrite the public variable which gets sent to the client automatically upon JIP.

3. Again, public variables are automatically sent for JIP, so delete the line:
if(isServer) then{ publicVariable "CurrentMission"; };

4. onPlayerConnected will only execute on the server, so mission_update.sqf will only execute on the server, but it looks like you want it to run on the client.

Change init.sqf to:

if (isServer) then
{
CurrentMission=1;
publicVariable "CurrentMission";
};

[] execVM "mission_update.sqf"; // run on client


change the top part of mission_update.sqf:

//change:
if(isServer) then{ publicVariable "CurrentMission"; };
//to:
if (isServer && isDedicated) exitWith {};
waitUntil {!isNil "CurrentMission"};

R34P3R
Jun 10 2009, 01:14
Ok thanks going to test it.. i cant find the command isNil in the Murry Guide.. this meens If EMPTY ?

Ok woking.. but.. i think i have also some Errors on my MissionTrigger.

This Trigger will end the First Mission and starts the Second:



CurrentMission=2; publicVariable "CurrentMission"; temp=[] execvm "mission_update.sqf";

R34P3R
Jun 10 2009, 22:59
is this Trigger correct ? and another question to JIP: if i add some Scrore to a player or give them another Rank. Must i also work with global Variables ?

Thanks a lot.