From a31d017672372b73b8de5b4a5e6c46cb433f6e96 Mon Sep 17 00:00:00 2001 From: Zepheris Date: Sun, 4 Mar 2018 23:04:14 -0700 Subject: [PATCH] Added Respawn at base mod --- mpmissions/Exile.Altis.pbo | Bin 2861233 -> 2867480 bytes mpmissions/Exile.Altis/CfgExileCustomCode.cpp | 5 +- ...ileClient_gui_selectSpawnLocation_show.sqf | 184 ++++++++++++++++++ 3 files changed, 188 insertions(+), 1 deletion(-) create mode 100644 mpmissions/Exile.Altis/custom/respawnAtBase/ExileClient_gui_selectSpawnLocation_show.sqf diff --git a/mpmissions/Exile.Altis.pbo b/mpmissions/Exile.Altis.pbo index 8534dab7ff4fd44ca08068286984f489997c4a35..8a757605b4ba8c01c437dd6888195c0b1a6f8f6e 100644 GIT binary patch delta 5815 zcmc&&-ESOM6(`^(UVAsrr=2t;T#sXHla1|-tE!6QsNQv2S@K6@r>&H&HO%hb^$wYx z+04w=b}TapP%BgkB2{Sm&=H|FkI{sm?exmQq z@H_d_$Ahen}JTg&wPyt5l$F8i{+Y*!>du$%Rgbl0nF*Imc7eUH|;hFw`} z*5k`1!#Cn|q7%((8u%K)T^?F82=yxNpmf-mDpQ2|;q#^j|am zn%EZ=)7aK6XB$3GFuf^E`whb~E23ez*yBrAFH@LD-x=ZQN&0uJ58HpEQncp1Y7W%-lTLJ;_+PH6)FzZij?k~ zUC(p0llQRM0sEM@cUqjVA?YCEcl1JH{X}zb3ie;y+8~z|JLF?m!uA`ThQkYF7u!!t zC@W3x&cmi*-E)#YYK29L+>%Q1ayI_9pg-5=W@i&?qD3ivxb4%Hd#{OH`2H`)E(IOo zMSgplZPEGQpyR{DnUGb9(}Yox%=lc%vRIAV3nCXsUf|atlg)XGU|0H0*OnDgH7rkR z%3*v>S|8A_r)%G0LPt+L1_x3c1(Z_ZkG94y-pvfO6wx*r@8~4iO~Q&mkHQxM6FA1n z9b;m&&9RppTZX6J?Hj(T9?43_x>e3m%0#$O)525z{TB_jvSZznX&^62;*MeZuh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tP94P%@rV$GKC!*E z`q>FkKPUyF`$13|lmVRt4S`O9PJ_;X&VtT?&Vz#J%u+g`{PT# z?c^vJ?}MPL(n>P@b;i5iN-{=k@znEl)v2N_6iuL+7Fube{i0|N^L+6XopjMnksf*} z(MLZ63^GKSVMZ8bjBzHIWQu8Km}QQ67FcA7WmZ^ajdeCIPqEoP%ME>h{k~d{`>ps{ L+J~F|U?%?n?RixH diff --git a/mpmissions/Exile.Altis/CfgExileCustomCode.cpp b/mpmissions/Exile.Altis/CfgExileCustomCode.cpp index 77c7359..8fc8df5 100644 --- a/mpmissions/Exile.Altis/CfgExileCustomCode.cpp +++ b/mpmissions/Exile.Altis/CfgExileCustomCode.cpp @@ -61,4 +61,7 @@ ExileClient_object_player_death_startBleedingOut = "custom\EnigmaRevive\ExileCli ExileClient_object_player_event_onInventoryOpened = "custom\EnigmaRevive\ExileClient_object_player_event_onInventoryOpened.sqf"; //Happys Revive AntiDupe ---NEW with v0.65 //Door Fix -//ExileServer_object_construction_database_load = "custom\fixes\ExileServer_object_construction_database_load.sqf"; \ No newline at end of file +//ExileServer_object_construction_database_load = "custom\fixes\ExileServer_object_construction_database_load.sqf"; + +//Spawn at Base +ExileClient_gui_selectSpawnLocation_show = "custom\respawnAtBase\ExileClient_gui_selectSpawnLocation_show.sqf"; \ No newline at end of file diff --git a/mpmissions/Exile.Altis/custom/respawnAtBase/ExileClient_gui_selectSpawnLocation_show.sqf b/mpmissions/Exile.Altis/custom/respawnAtBase/ExileClient_gui_selectSpawnLocation_show.sqf new file mode 100644 index 0000000..131696a --- /dev/null +++ b/mpmissions/Exile.Altis/custom/respawnAtBase/ExileClient_gui_selectSpawnLocation_show.sqf @@ -0,0 +1,184 @@ +private["_display","_spawnButton","_listBox","_listItemIndex","_numberOfSpawnPoints","_randNum","_randData","_randomSpawnIndex"]; + +if(isNil "spawnRegistry") then +{ + spawnRegistry = []; +}; + +fn_checkRespawnDelay = { + _markerName = _this select 0; + if(isNil "_markerName") exitWith { diag_log "checkRespawn: invalid parameter 1"; true; }; + + diag_log format["checkRespawn: Checking flag %1...", _markerName]; + + _counter = 0; + { + + + _name = _x select 0; + _time = _x select 1; + + if(isNil "_name") exitWith { true; }; + if(isNil "_time") exitWith { true; }; + + diag_log format["checkRespawn: checking flag %1, with reg %2", _markerName, _name]; + if(_name isEqualTo _markerName) then + { + if(_time > time-300) then + { + _counter = _counter + 1; + }; + }; + } forEach spawnRegistry; + diag_log format["checkRespawn: counter for flag %1 = %2",_markerName, _counter]; + + if(_counter >= 1) exitWith + { + diag_log format["checkRespawn: returned false"]; + false; + }; + + diag_log format["checkRespawn: returned true"]; + true; +}; + +disableSerialization; +diag_log "Selecting spawn location..."; +ExileClientSpawnLocationSelectionDone = false; +ExileClientSelectedSpawnLocationMarkerName = ""; +createDialog "RscExileSelectSpawnLocationDialog"; +waitUntil {_display = findDisplay 24002;!isNull _display}; +_display displayAddEventHandler ["KeyDown", "_this call ExileClient_gui_loadingScreen_event_onKeyDown"]; +_listBox = _display displayCtrl 24002; +lbClear _listBox; +{ + if (getMarkerType _x == "ExileSpawnZone") then + { + _name = markerText _x; + if(! ( [_name] call fn_checkRespawnDelay) ) exitWith { diag_log format["checkRespawn returned false for spawn zone: %1, respawn disabled",_name]; }; + + diag_log format["Adding spawn zone: %1",markerText _x]; + + _listItemIndex = _listBox lbAdd (markerText _x); + _listBox lbSetData [_listItemIndex, _x]; + + }; +} forEach allMapMarkers; +// _numberOfSpawnPoints = {getMarkerType _x == "ExileSpawnZone"} count allMapMarkers; +// if(_numberOfSpawnPoints > 0)then +// { + // _randNum = floor(random _numberOfSpawnPoints); + // _randData = lbData [24002,_randNum]; + // _randomSpawnIndex = _listBox lbAdd "Random"; + // _listBox lbSetData [_randomSpawnIndex, _randData]; +// }; + +defaultLBsize = lbSize _listBox; +myUID = getPlayerUID player; +myFlags = []; +{ + _flag = _x; + _owner = _flag getVariable ["ExileOwnerUID", ""]; + _arrBuildRights = _x getVariable["ExileTerritoryBuildRights",[]]; // by Nerexis + + if(myUID isEqualTo _owner OR ( !(isNil "_arrBuildRights") AND (count _arrBuildRights>0) AND (myUID in _arrBuildRights) ) )then + { + + + _name = _flag getVariable ["ExileTerritoryName", ""]; + + if(! ( [_name] call fn_checkRespawnDelay) ) exitWith { diag_log format["checkRespawn returned false for flag: %1, respawn disabled",_name]; }; + + _lbid = _listBox lbAdd (_flag getVariable ["ExileTerritoryName", ""]); + _listBox lbSetColor [_lbid, [0,0.68,1,1]]; + _listBox lbSetData [_lbid,str(count myFlags)]; + myFlags pushBack _flag; + + // localmarkerName = format['LOCALFLAG_%1',myUID]; + // deleteMarkerLocal localmarkerName; + // _marker = createMarkerLocal [localmarkerName,getPosATL _flag]; + // _marker setMarkerShapeLocal "ICON"; + // _marker setMarkerTypeLocal "loc_Bunker"; + // _marker setMarkerColorLocal "ColorGreen"; + // _marker setMarkerSize [3, 3]; + // _marker setMarkerTextLocal (_flag getVariable ["ExileTerritoryName", ""]); + }; +} forEach (allMissionObjects "Exile_Construction_Flag_Static"); + + +fnc_LBSelChanged_24002 = { + disableSerialization; + _ctrl = _this select 0; + _curSel = lbCurSel _ctrl; + if(_curSel < defaultLBsize)then + { + _this call ExileClient_gui_selectSpawnLocation_event_onListBoxSelectionChanged; + } + else + { + _data = _ctrl lbData _curSel; + _num = parseNumber _data; + _flag = myFlags select _num; + + + markerName = format['FLAG_%1',myUID]; + deleteMarker markerName; + createMarker [markerName,getPosATL _flag]; + ExileClientSelectedSpawnLocationMarkerName = markerName; + + // localmarkerName = format['LOCALFLAG_%1',myUID]; + // deleteMarkerLocal localmarkerName; + // _marker = createMarkerLocal [localmarkerName,getPosATL _flag]; + // _marker setMarkerShapeLocal "ICON"; + // _marker setMarkerTypeLocal "loc_Bunker"; + // _marker setMarkerColorLocal "ColorGreen"; + // _marker setMarkerSize [3, 3]; + // _marker setMarkerTextLocal (_flag getVariable ["ExileTerritoryName", ""]); + + _mapControl = (findDisplay 24002) displayCtrl 24001; + _mapControl ctrlMapAnimAdd [1, 0.1, getMarkerPos ExileClientSelectedSpawnLocationMarkerName]; + ctrlMapAnimCommit _mapControl; + }; +}; +_listBox ctrlRemoveAllEventHandlers "LBSelChanged"; +_listBox ctrlAddEventHandler ["LBSelChanged", "_this call fnc_LBSelChanged_24002;"]; + +fnc_ButtonClick_24003 = { + disableSerialization; + + _display = nil; + waitUntil {_display = findDisplay 24002;!isNull _display}; + _lB = _display displayCtrl 24002; + _curSel = lbCurSel _lB; + _data = _lB lbData _curSel; + _num = parseNumber _data; + _flag = myFlags select _num; + _name = lbText [24002, _curSel]; //_flag getVariable ["ExileTerritoryName", ""]; + //spawnRegistry pushBack [_name, time]; + spawnRegistry pushBack [_name, time]; + + //diag_log format["Plr selected spawn %1", lbText [24002, _curSel]]; + diag_log format["Plr respawning at flag %1 - time: %2",_name, _time]; + + [] call ExileClient_gui_selectSpawnLocation_event_onSpawnButtonClick; + + + + // if(!isNil 'markerName')then + // { + // [] spawn { + // waitUntil {!isNil 'ExileClientLoadedIn'}; + // uiSleep 3; + // deleteMarker markerName; + // deleteMarkerLocal localmarkerName; + // }; + // }; +}; +_spawnButton = _display displayCtrl 24003; +_spawnButton ctrlRemoveAllEventHandlers "ButtonClick"; +_spawnButton ctrlSetEventHandler["ButtonClick","call fnc_ButtonClick_24003"]; +_spawnButton ctrlSetText "Spawn!"; +_spawnButton ctrlEnable true; +_spawnButton ctrlCommit 0; + +true \ No newline at end of file