Jump to content
Sign in to follow this  
1para{god-father}

Marker just for EAST to see ?

Recommended Posts

I am trying to make a marker for Just EAST to see on the Map but it does not show and i get no error ? (its spawns in the crate No problem)


_ammobox = createVehicle ["GuerillaCacheBox",getmarkerpos "marker_clear", [], 0, "NONE"];  

if ((side player) == EAST) then {
_markerstr = createMarkerLocal["Ammo Crate",getpos _ammobox];
_markerstr setMarkerShapeLocal "ICON";
_markerstr setMarkerTypeLocal "DOT";
};

Share this post


Link to post
Share on other sites

You should stay away from using spaces in marker names like that. If you want it to display "Ammo Crate" you need to use

_ammobox = createVehicle ["GuerillaCacheBox",getmarkerpos "marker_clear", [], 0, "NONE"];  

if ((side player) == EAST) then {
_markerstr = createMarkerLocal["ammobox1",getpos _ammobox];
_markerstr setMarkerShapeLocal "ICON";
_markerstr setMarkerTypeLocal "DOT";
[b]_markerstr setMarkerTextLocal "Ammo Crate";[/b]
};

Share this post


Link to post
Share on other sites

OK this works great when i test , but when i try on Dedi server no marker comes up ?

Any idea how i can get it to work on Dedi ?

Share this post


Link to post
Share on other sites

Because it needs to run on clients, not the server.

Share this post


Link to post
Share on other sites

Ahhh yes i have this at the start of my script no wounder !

if(not isServer) exitWith{};

Ill wrap what i need in if (isserver) then {} apart from the markerlocal

Thanks

Share this post


Link to post
Share on other sites

Hmmm this is strange as it still will not work on Dedi server, we get no markers still ?


if (isserver) then {


My code I need to spawn etc.. on server

};



if ((side player) == EAST) then {
_markerstr = createMarkerLocal["Pilot",getpos _pilot];
_markerstr setMarkerShapeLocal "ICON";
_markerstr setMarkerTypeLocal "DOT";
_markerstr setMarkerTextLocal "Pilot Location";
};


if (isserver) then {


My code I need to spawn etc.. on server

};


Edited by psvialli

Share this post


Link to post
Share on other sites

It's because _pilot is defined in the isServer clause and thus does not exist for anyone except the server.

if (isServer) then {
TAG_pilot = // create pilot
publicVariable "TAG_pilot";
};



if ((side player) == EAST) then {
waitUntil {!isNil "TAG_pilot"};
_markerstr = createMarkerLocal["Pilot",getPos TAG_pilot];
_markerstr setMarkerShapeLocal "ICON";
_markerstr setMarkerTypeLocal "DOT";
_markerstr setMarkerTextLocal "Pilot Location";
};

Share this post


Link to post
Share on other sites

Well i never knew that I presumed if it was on the server they would also be able to see & reference it !

So I cannot use a Variable "_Pilot" would i have to change all my code to TAG_Pilot to PV it ?

i.e ?

_grp = createGroup WEST;
_pilot = _grp createUnit ["US_Soldier_Pilot_EP1", _pos, [], 0, "FORM"];
_pilot setCaptive true;
_pilot setHit ["hands",1];
_pilot setHit ["head_hit",0.4];
_pilot setHit ["body",0.5];
_pilot playMoveNow "AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon";
_pilot disableAI "MOVE";
_pilot disableAI "ANIM";
_pilot setVehicleInit "this addaction ['Capture', 'scripts\capture.sqf', [],1,false,true,'','((side _this) == west)'];"; processInitCommands;
         publicVariable "_pilot";


if ((side player) == EAST) then {
waitUntil {!isNil "_pilot"};
_markerstr = createMarkerLocal["Pilot",getPos _pilot];
_markerstr setMarkerShapeLocal "ICON";
_markerstr setMarkerTypeLocal "DOT";
_markerstr setMarkerTextLocal "Pilot Location";
};



or would that not work ?

Share this post


Link to post
Share on other sites
Well i never knew that I presumed if it was on the server they would also be able to see & reference it !

So I cannot use a Variable "_Pilot" would i have to change all my code to TAG_Pilot to PV it ?

i.e ?

or would that not work ?

You can't PV a local variable (unless it's handled by a PVEH).

Here's some information for you:

http://community.bistudio.com/wiki/Variables#Local_Variables

http://community.bistudio.com/wiki/Variables#Scope

Share this post


Link to post
Share on other sites

OK so this should work should it not ??? or am i missing something ? as I still do not get any Marker for EAST ?


if (isserver) then {
_towns = nearestLocations [getPosATL player, ["NameVillage","NameCity","NameCityCapital","StrongPoint"], 20000];
//_towns =  [getPosATL player, ["StrongPoint","FlatAreaCity"], 25000];
_pos = position (_towns select (floor (random (count _towns))));
_size=30;

["Rescue","Black Hawk Down","The Americans have a Black Hawk down and we need to retrieve their Pilot who is surrounded by Rebels and safely return him to SAG HQ  you are also to make sure no parts of the Black Hawk fall into rebel hands",true,["MissionAO",_pos,"flag","ColorYellow"]] call SHK_Taskmaster_add;
_wreck = "UH60_wreck_EP1" createVehicle [(_pos select 0) + 2*_size - random 4*_size,(_pos select 1) + 2*_size - random 4*_size,0];
//[_wreck] execVM "scripts\c4only.sqf";
_wreck addEventHandler ["Killed",{
	(_this select 0) spawn {
		sleep 2;
		deleteVehicle _this;
	};
}];


//////////Create Pilot//////////////////

_grp = createGroup WEST;
TAG_pilot = _grp createUnit ["US_Soldier_Pilot_EP1", _pos, [], 0, "FORM"];
TAG_pilot setCaptive true;
TAG_pilot setHit ["hands",1];
TAG_pilot setHit ["head_hit",0.4];
TAG_pilot setHit ["body",0.5];
TAG_pilot playMoveNow "AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon";
TAG_pilot disableAI "MOVE";
TAG_pilot disableAI "ANIM";
TAG_pilot setVehicleInit "this addaction ['Capture', 'scripts\capture.sqf', [],1,false,true,'','((side _this) == west)'];"; processInitCommands;
publicVariable "TAG_pilot";

//////////////////////Trigge/////////////////////


_triggeram1 = createTrigger["EmptyDetector",[getPos TAG_pilot select 0,getPos TAG_pilot select 1,0]];
_triggeram1 setTriggerArea [120,120,0,false];
_triggeram1 setTriggerActivation ["WEST","PRESENT",false];
_triggeram1 setTriggerTimeout [1,1,1,true];
_triggeram1 setTriggerStatements ["this", "TAG_pilot allowDamage true;",""];

////////////////////CREATE /MARKER LOCAL ///////////////////////////////////
};


if ((side player) == EAST) then {
waitUntil {!isNil "TAG_pilot"};
_markerstr = createMarkerLocal["Pilot",getPos TAG_pilot];
_markerstr setMarkerShapeLocal "ICON";
_markerstr setMarkerTypeLocal "DOT";
_markerstr setMarkerTextLocal "Pilot Location";
};


if (isserver) then {


_houses = [TAG_pilot,120] call getEnterableHouses;
if((count _houses) > 0) then {
	_house = _houses call getRandomElement;
	_buildingpos = 1 max (round random (_house select 1));
	_house = _house select 0;
	TAG_pilot setPos (_house buildingPos _buildingpos);
} else {
	TAG_pilot setPos [(getpos _wreck select 0) + _size - round random (2*_size),(getpos _wreck select 1) + _size - round random (2*_size),0];
};

/////DEBUG/////////
if ((paramsarray select 0) == 1) then { 
 	_cid = floor(random 10000);
	_t = format["Pilot is here%1",_cid];
	[_t, TAG_pilot, "Icon", [1,1], "TEXT:", _t, "TYPE:", "dot", "COLOR:", "ColorGreen", "GLOBAL", "PERSIST"] call CBA_fnc_createMarker;
};
_pos= Getpos _wreck;

//////////////////////////Set UP AI NOW/////////////////////
////GROUP1/////////
_grp1 = [_pos, EAST, (configFile >> "CfgGroups" >> "EAST" >> "BIS_TK_INS" >> "Infantry" >> "TK_INS_Patrol")] call BIS_fnc_spawnGroup;
[_grp1,getpos TAG_pilot,50] execVM "scripts\BIN_taskDefend.sqf";
{
  _x addEventHandler ["Killed", { if (isPlayer (_this select 1) AND side (_this select 1) == WEST ) then {totalscore = totalscore + 10;}}];
} forEach (units _grp1);


/////////////////////////////////////////////////////////////
////GROUP2/////////
_grp2 = [_pos, EAST, (configFile >> "CfgGroups" >> "EAST" >> "BIS_TK_INS" >> "Infantry" >> "TK_INS_Patrol")] call BIS_fnc_spawnGroup;
[_grp2,_pos,250] execVM "scripts\BIN_taskPatrol.sqf";
{
  _x addEventHandler ["Killed", { if (isPlayer (_this select 1) AND side (_this select 1) == WEST ) then {totalscore = totalscore + 10;}}];
} forEach (units _grp2);

////GROUP3/////////
_grp3 = [_pos, EAST, (configFile >> "CfgGroups" >> "EAST" >> "BIS_TK_INS" >> "Infantry" >> "TK_INS_Patrol")] call BIS_fnc_spawnGroup;
[_grp3,_pos,250] execVM "scripts\BIN_taskPatrol.sqf";
{
  _x addEventHandler ["Killed",{ if (isPlayer (_this select 1) AND side (_this select 1) == WEST ) then {totalscore = totalscore + 10;}}];
} forEach (units _grp3);



///////////Buildings/////////////

_grpbuild1 = [_pos, EAST, (configFile >> "CfgGroups" >> "EAST" >> "BIS_TK_INS" >> "Infantry" >> "TK_INS_Group")] call BIS_fnc_spawnGroup;
_grpbuild1 execVM "PlaceInBuilding.sqf";
{
  _x addEventHandler ["Killed", { if (isPlayer (_this select 1) AND side (_this select 1) == WEST ) then {totalscore = totalscore + 10;}}];
} forEach (units _grpbuild1);


waitUntil{(TAG_pilot distance MHQ_SAFE) < 30 or !alive TAG_pilot} ; 


if(!alive TAG_pilot) then {
	["Rescue","failed"] call SHK_Taskmaster_upd;
	[] call SHK_addTask;
	[_pilot] joinSilent grpNull; 
	totalscore = totalscore -80;  publicVariable "totalscore";
	titleText ["Mission Failed you just lost -80 Points you score is now......" + str totalscore,"PLAIN DOWN"];titleFadeOut 6;

} else {
	["Rescue","succeeded"] call SHK_Taskmaster_upd;
	[] call SHK_addTask;
	[TAG_pilot] joinSilent grpNull; 
	totalscore = totalscore +80;  publicVariable "totalscore";
	titleText ["Well Done Mission Succeeded you got an extra 80 Points you score is now......" + str totalscore,"PLAIN DOWN"];titleFadeOut 6;

};
};

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×