187Killa 2 Posted September 27, 2017 Hello everyone first time posting I am new to arma and this whole scripting thing but I feel like I have learned a lot searching topics on here and the web. I have came across my first problem and I realize it has been answered and asked a bunch but every time i try to simulate what others have done it still wont work. So sorry for the annoying question but i have to ask How do i make the mission end when a side reaches the score limit? I dont care if i have to use triggers or sqf files I just would like to see it accomplished! here is what I have so far motor.sqf Spoiler if (isServer) then { bluforflag setFlagSide west; opforflag setFlagSide east; pointsA = 0; publicVariable "pointsA"; pointsR = 0; publicVariable "pointsR"; A = 0; publicVariable "A"; B = 0; publicVariable "B"; minutos = ParamsArray Select 1; publicVariable "minutos"; segundos = 1; publicVariable "segundos"; pointlimit = ParamsArray Select 2; publicVariable "pointlimit"; }; while {true} do { call compile preprocessFileLineNumbers "scripts\hud\hud_update.sqf"; if (isServer) then { //Bases if (A == 1) then { pointsA = pointsA +1; }; if (A == 2) then { pointsR = pointsR +1; }; if (B == 1) then { pointsA = pointsA +1; }; if (B == 2) then { pointsR = pointsR +1; }; }; publicVariable "pointsA"; publicVariable "pointsR"; sleep 10; }; inti.sqf Spoiler [west, "EE"] call BIS_fnc_addRespawnInventory; [west, "ME"] call BIS_fnc_addRespawnInventory; [west, "MM"] call BIS_fnc_addRespawnInventory; [west, "G"] call BIS_fnc_addRespawnInventory; [west, "MG"] call BIS_fnc_addRespawnInventory; [west, "O"] call BIS_fnc_addRespawnInventory; [east, "EE2"] call BIS_fnc_addRespawnInventory; [east, "ME2"] call BIS_fnc_addRespawnInventory; [east, "MM2"] call BIS_fnc_addRespawnInventory; [east, "G2"] call BIS_fnc_addRespawnInventory; [east, "MG2"] call BIS_fnc_addRespawnInventory; [east, "O2"] call BIS_fnc_addRespawnInventory; publicVariable "pointsA","pointsR"; minutos = paramsArray select 1; pointlimit = ParamsArray Select 2; enableSaving [false, false]; enableSentences false; //Disables auto spotting radio chatter if ( (!isServer) && (player != player) ) then { waitUntil {player == player}; waitUntil {time > 10}; }; if !(isnull player) then { [] spawn { _colorWest = WEST call BIS_fnc_sideColor; _colorEast = EAST call BIS_fnc_sideColor; {_x set [3, 0.73]} forEach [_colorWest, _colorEast]; if (side player == west) then { [getmarkerPos "orbitblufor","Team Death Match",10,30,250,1, [["\a3\ui_f\data\map\Markers\NATO\n_support.paa", _colorWest, markerPos "orbitblufor", 2, 1, 0, "Blufor", 0], ["\a3\ui_f\data\map\Markers\NATO\n_support.paa", _colorEast, markerPos "orbitopfor", 2, 1, 0, "Opfor", 0]]] spawn BIS_fnc_establishingShot; }; if (side player == east) then { [getmarkerPos "orbitopfor","Team Death Match",10,30,250,0, [["\a3\ui_f\data\map\Markers\NATO\n_support.paa", _colorWest, markerPos "orbitblufor", 2, 1, 0, "Blufor", 0], ["\a3\ui_f\data\map\Markers\NATO\n_support.paa", _colorEast, markerPos "orbitopfor", 2, 1, 0, "Opfor", 0]]] spawn BIS_fnc_establishingShot; }; }; //Wait for UAV intro to stop playing before loading hud otherwise hud will not display. From Larrow / BIS forums. waitUntil {!isnil "BIS_fnc_establishingShot_playing" && {!BIS_fnc_establishingShot_playing}}; //Load HUD (adapted from Dynamic Take And Secure Author:galzohar) [] call compile preprocessFileLineNumbers "scripts\hud\hud_create.sqf"; }; _null = [] execVM "scripts\motor.sqf"; _null = [] execVM "scripts\weather.sqf"; _null = [] execVM "scripts\icon.sqf"; [ 20, // seconds to delete dead bodies (0 means don't delete) 120, // seconds to delete dead vehicles (0 means don't delete) 60, // seconds to delete dropped weapons (0 means don't delete) 240, // seconds to deleted planted explosives (0 means don't delete) 120 // seconds to delete dropped smokes/chemlights (0 means don't delete) ] execVM "repetitive_cleanup.sqf"; null = [] execVM "scripts\jump.sqf"; player addaction [("<t color=""#FF4444"">" + "Open Virtual Arsenal" + "</t>"), {["Open", true] call BIS_fnc_arsenal}, "", 0, false, false]; hint format ["Welcome %1, Use Action Key to Open Virtual Aresenal",name player]; and if its not to much to ask Im getting a error on my playerrespawn file but its not affecting anything just the ugly black box with a error pops up but if it can be fixed that be great! error message "#sleep 30; error generic error in expression playerrespawn.sqf line 15 if (!isserver) && (player ! == player).... error if type object, expected bool" not sure what is wrong with that code. onPlayerRespawn.sqf Spoiler _unit = _this select 0; _unit allowdamage false; if ( (!isServer) && (player != player) ) then { waitUntil {player == player}; }; if (side player == east) then { pointsA = pointsA +1; }; if (side player == west) then { pointsR = pointsR +1; }; if (player == player) then { [] call compile preprocessFileLineNumbers "scripts\hud\hud_create.sqf"; }; sleep 3; _unit allowdamage true; removeAllWeapons player; removeGoggles player; removeHeadgear player; removeVest player; removeUniform player; removeAllAssignedItems player; clearAllItemsFromBackpack player; removeBackpack player; player setUnitLoadout(player getVariable["Saved_Loadout",[]]); player addaction [("<t color=""#FF4444"">" + "Open Virtual Arsenal" + "</t>"), {["Open", true] call BIS_fnc_arsenal}, "", 0, false, false]; Thanks in Advance! 1 Share this post Link to post Share on other sites
LastNerve 2 Posted September 28, 2017 Same here, a lot of the old threads dont appear to be working. I found this thread but it never would end either though (yes i made sure to change the param to match the param number in my description) if you get it to work please hollar at me. I messed with it different ways and never got it! Share this post Link to post Share on other sites
187Killa 2 Posted September 28, 2017 4 hours ago, LastNerve said: Same here, a lot of the old threads dont appear to be working. I found this thread but it never would end either though (yes i made sure to change the param to match the param number in my description) if you get it to work please hollar at me. I messed with it different ways and never got it! I got it working i send you a PM Share this post Link to post Share on other sites
187Killa 2 Posted September 28, 2017 Two things if anyone can help that be awesome How do you turn off AI chat messages they still show up. I have disabled radio chatter but would like to disable the chat part as well I have tried this so far 0 fadeRadio 0; enableRadio false; enableSentences false; showChat false; also can someone look at this script and tell me what the error is I cant figure it out although it works I would like to just get rid of the black message that pops up here and there about it error message "#sleep 30; error generic error in expression playerrespawn.sqf line 15 if (!isserver) && (player ! == player).... error if type object, expected bool" not sure what is wrong with that code. onPlayerRespawn.sqf Hide contents _unit = _this select 0; _unit allowdamage false; if ( (!isServer) && (player != player) ) then { waitUntil {player == player}; }; if (side player == east) then { pointsA = pointsA +1; }; if (side player == west) then { pointsR = pointsR +1; }; if (player == player) then { [] call compile preprocessFileLineNumbers "scripts\hud\hud_create.sqf"; }; sleep 3; _unit allowdamage true; removeAllWeapons player; removeGoggles player; removeHeadgear player; removeVest player; removeUniform player; removeAllAssignedItems player; clearAllItemsFromBackpack player; removeBackpack player; player setUnitLoadout(player getVariable["Saved_Loadout",[]]); player addaction [("<t color=""#FF4444"">" + "Open Virtual Arsenal" + "</t>"), {["Open", true] call BIS_fnc_arsenal}, "", 0, false, false]; Share this post Link to post Share on other sites
TheGeneral2899 19 Posted September 28, 2017 8 hours ago, 187Killa said: Two things if anyone can help that be awesome How do you turn off AI chat messages they still show up. I have disabled radio chatter but would like to disable the chat part as well I have tried this so far 0 fadeRadio 0; enableRadio false; enableSentences false; showChat false; Reveal hidden contents Hide contents _unit = _this select 0; _unit allowdamage false; if ( (!isServer) && (player != player) ) then { waitUntil {player == player}; }; if (side player == east) then { pointsA = pointsA +1; }; if (side player == west) then { pointsR = pointsR +1; }; if (player == player) then { [] call compile preprocessFileLineNumbers "scripts\hud\hud_create.sqf"; }; sleep 3; _unit allowdamage true; removeAllWeapons player; removeGoggles player; removeHeadgear player; removeVest player; removeUniform player; removeAllAssignedItems player; clearAllItemsFromBackpack player; removeBackpack player; player setUnitLoadout(player getVariable["Saved_Loadout",[]]); player addaction [("<t color=""#FF4444"">" + "Open Virtual Arsenal" + "</t>"), {["Open", true] call BIS_fnc_arsenal}, "", 0, false, false]; Hey @187Killa - If you mean the messages where the AI yell out "Enemy 500 meters front" etc, you need to adjust the difficulty settings of the server its running on. You can find it in the BIS Wiki for Diffuclty Settings. Its the setting called Auto Report. If that doesn't work, I have added in the init field of all BLUFOR units (if your playable units are on the BLUFOR side) the following code: this setSpeaker "NoVoice"; And last resort would be to just disable the group channel via the description.ext file. Here is the BIS Wiki for Description.ext Hope that helps! Share this post Link to post Share on other sites
LastNerve 2 Posted September 28, 2017 5 hours ago, TheGeneral2899 said: Hey @187Killa - If you mean the messages where the AI yell out "Enemy 500 meters front" etc, you need to adjust the difficulty settings of the server its running on. You can find it in the BIS Wiki for Diffuclty Settings. Its the setting called Auto Report. If that doesn't work, I have added in the init field of all BLUFOR units (if your playable units are on the BLUFOR side) the following code: this setSpeaker "NoVoice"; And last resort would be to just disable the group channel via the description.ext file. Here is the BIS Wiki for Description.ext Hope that helps! Ill have to give this a try too! Share this post Link to post Share on other sites
187Killa 2 Posted September 28, 2017 5 hours ago, TheGeneral2899 said: Hey @187Killa - If you mean the messages where the AI yell out "Enemy 500 meters front" etc, you need to adjust the difficulty settings of the server its running on. You can find it in the BIS Wiki for Diffuclty Settings. Its the setting called Auto Report. If that doesn't work, I have added in the init field of all BLUFOR units (if your playable units are on the BLUFOR side) the following code: this setSpeaker "NoVoice"; And last resort would be to just disable the group channel via the description.ext file. Here is the BIS Wiki for Description.ext Hope that helps! Thank you. Share this post Link to post Share on other sites
pierremgi 4890 Posted September 28, 2017 7 hours ago, TheGeneral2899 said: Hey @187Killa - If you mean the messages where the AI yell out "Enemy 500 meters front" etc, you need to adjust the difficulty settings of the server its running on. You can find it in the BIS Wiki for Diffuclty Settings. Its the setting called Auto Report. No! Don't do that! That doesn't work for AIs. Enables/disables automatic reporting of spotted enemies by players only. On the other hand, if you disable the autoreport and you play alone in your group (no AI in group), you will not have any cursortarget return on enemy <obj-null>! This can be weird for some scripts. Share this post Link to post Share on other sites
187Killa 2 Posted September 29, 2017 4 hours ago, pierremgi said: No! Don't do that! That doesn't work for AIs. Enables/disables automatic reporting of spotted enemies by players only. On the other hand, if you disable the autoreport and you play alone in your group (no AI in group), you will not have any cursortarget return on enemy <obj-null>! This can be weird for some scripts. yea it didnt work anyways. I had already got the "radio" voice to disappear I was just looking for a way to get the messages that go with it to disappear such as in the chat box "contact infantry 130m front". do you happen to know what is wrong with the generic error script i have? I dont understand what im missing Also how do you get server to end when clock runs out? I have 2 triggers for west and east and they work on ending the game when point limit is reached but im not sure how to end time and when time ends whoever has the most points wins...I found a way to end mission by time with a third trigger but obvously it doesnt say who won or lost it just ends missions and starts the next one! And im not sure how to tie it into my exsisting script. Quote if (isServer) then { GameFinished = false; while {!(GameFinished)} do { if ( (scoreSide west >= (paramsArray select 2)) || (scoreSide east >= (paramsArray select 2)) ) then { if ( scoreSide west > scoreSide east ) then { //west won, show end1 with closing shot, called on all west players via BIS_fnc_MP [["end1",true,true],"BIS_fnc_endMission", west, false] call BIS_fnc_MP; //east failed, show end2 with closing shot, called on all east players via BIS_fnc_MP [["end2",true,true],"BIS_fnc_endMission", east, false] call BIS_fnc_MP; }else{ //east won, show end1 with closing shot, called on all east players via BIS_fnc_MP [["end1",true,true],"BIS_fnc_endMission", east, false] call BIS_fnc_MP; //west failed, show end2 with closing shot, called on all west players via BIS_fnc_MP [["end2",true,true],"BIS_fnc_endMission", west, false] call BIS_fnc_MP; }; GameFinished = true; }; sleep 1; }; }; once i get these 2 things done I will have completed my first mission script! Share this post Link to post Share on other sites
pierremgi 4890 Posted September 29, 2017 Yep, I just have a look on what you wrote above. At least your onPlayerRespawn.sqf could be simpler, because it concerns player (locally) and player is already defined. Also spawn Bis_fnc_Arsenal (see BIKI, call crashes the game for "opening" action). params ["_newGuy","_oldGuy"]; _newGuy allowdamage false; call { if (side _newGuy == east) exitWith { pointsA = pointsA +1; publicVariable "pointsA" }; if (side _newGuy == west) exitWith { pointsR = pointsR +1; publicVariable "pointsB" }; }; call compile preprocessFileLineNumbers "scripts\hud\hud_create.sqf"; // not sure you need that! [_newGuy,_oldGuy] spawn { params ["_newGuy","_oldGuy"]; sleep 3; _newGuy allowdamage true; removeAllContainers _newGuy ; removeAllWeapons _newGuy; removeHeadgear _newGuy; removeGoggles _newGuy; removeAllAssignedItems _newGuy; _newGuy setUnitLoadout (_oldGuy getVariable ["Saved_Loadout",[]]); _newGuy addaction [("<t color=""#FF4444"">" + "Open Virtual Arsenal" + "</t>"), {["Open", true] spawn BIS_fnc_arsenal}, "", 0, false, false]; }; Share this post Link to post Share on other sites
187Killa 2 Posted September 29, 2017 19 hours ago, pierremgi said: well so far on my dedicated server and hosting locally nobody has gotten a crash yet from aresenal. maybe thats fixed? we did some testing of the script last night everything worked well except points / time hosted from my pc the point counter and timer worked but from my dedicated server points worked every now and then and time never moved... any idea on what I would need to make it work on dedicated server you dont have to write the script Im sure i could i just dont know what functions I should look at to make it do so. Thanks for your help! ill look at the code here in a bit and learn what i did wrong or shoulda added! appreciate everything man! EDIT: also does your script still need to be if !isServer && player != player... or should it work as copied and paste? im not home to test it but thought Id ask just in case later on I run into a issue Share this post Link to post Share on other sites
pierremgi 4890 Posted September 29, 2017 58 minutes ago, 187Killa said: hosted from my pc the point counter and timer worked but from my dedicated server points worked every now and then and time never moved... any idea on what I would need to make it work on dedicated server you dont have to write the script Im sure i could i just dont know what functions I should look at to make it do so. EDIT: also does your script still need to be if !isServer && player != player... or should it work as copied and paste? im not home to test it but thought Id ask just in case later on I run into a issue publicVariable is fine for broadcasting a common variable , and JIP compatible. But you need to refresh it every time the value changes. that means you have to add publicVariable "pointsA" (or "B") in your scripts. (corrected mine above). Same for other ones. EDIT: No, you don't need to add that. Furthermore, I'm using the embedded params, not the player variable. Share this post Link to post Share on other sites
187Killa 2 Posted September 29, 2017 5 hours ago, pierremgi said: okay ran into a issue. still getting the generic issue for pointsR undefined variable. Do i need to put params _newguy _oldguy in another file like init or something? im not sure thats the problem just a guess. Also the VA action key stop appearing but im assuming its because the error prior... not sure though...it also sprung another error in my "engine.sqf" maybe need to put _newguy _oldguy in there im still trying to figure out exactly what is not happening so i think ill have a better understanding of this once I see how its messed up! engine.sqf Quote Spoiler Share this post Link to post Share on other sites
pierremgi 4890 Posted September 29, 2017 Oups, I did a mistake throwing string instead of variables into the spawn inside your onPlayerRespawn.sqf. Corrected. On the other hand, i don't understand your intended behavior. If it's to remove all gears on dead you should consider _oldGuy instead of _newGuy (I replaced player). Your init.sqf is wrong because you publicVariable undefined varaible. Define first (pointsA = 0) public after (publicVariable "pointsA"), and not dsure you can write something like publicVariable "A","B". It seems to me, you need to 2 lines with this command. Share this post Link to post Share on other sites
187Killa 2 Posted September 29, 2017 I figured it out man, only thing thats not working is removing all gear when respawning. but the VA action key works and stuff. Its not a huge deal if it doesnt remove all weapons its just a idea that i had! also the above script line 12- end returned as a string and i assumed it was cause you listed params twice even though they had already been defined. so I removed the seconds params before _newguy allow damage true; and it removed error but removing the load out and what not isnt working. im gonna try _newGuy removeAllweapons; instead maybe that will work! Thanks again. Share this post Link to post Share on other sites
187Killa 2 Posted September 29, 2017 1 hour ago, pierremgi said: Oups, I did a mistake throwing string instead of variables into the spawn inside your onPlayerRespawn.sqf. Corrected. On the other hand, i don't understand your intended behavior. If it's to remove all gears on dead you should consider _oldGuy instead of _newGuy (I replaced player). Your init.sqf is wrong because you publicVariable undefined varaible. Define first (pointsA = 0) public after (publicVariable "pointsA"), and not dsure you can write something like publicVariable "A","B". It seems to me, you need to 2 lines with this command. forgot to tag ya! look above^^!! Share this post Link to post Share on other sites
pierremgi 4890 Posted September 29, 2017 57 minutes ago, 187Killa said: forgot to tag ya! look above^^!! The script i wrote, is working. Don't remove any line if you don't understand them. (You need to declare local variables inside the spawned code. Not matter if they are the same as outter scope). Now, I assume you want to remove gear on dead corpse (not sure. when you say "when respawning",what does that mean?... naked player or naked corpse?). Share this post Link to post Share on other sites
187Killa 2 Posted September 29, 2017 7 minutes ago, pierremgi said: s what i assumed was the right thing to do. But if i dont remove that part the script doesnt work for me Share this post Link to post Share on other sites
pierremgi 4890 Posted September 29, 2017 As i wrote, I corrected MY post . So, why don't you copy / paste it? I can't correct YOURS. (you should erase the quoted code in yours. It garbles the post). Share this post Link to post Share on other sites
187Killa 2 Posted September 29, 2017 7 minutes ago, pierremgi said: As i wrote, I correct MY post. So, why don't you copy / paste it? I can't correct YOURS. (you should erase all quoted codes. They garble the post). will do! mine does now... only thing is when you spawn into or die your gear isnt removed. everything works now i got a string error i guess from editing myself and not copy pasting lol its not a big deal though that the gear is spawned on its probably more practical than what i was intially planning on doing! Thanks Again for all your help! Share this post Link to post Share on other sites
pierremgi 4890 Posted September 29, 2017 No, I spawned: [variables here] spawn { code with sleep command (scheduled event) here } because onPlayerRespawn is an "unscheduled" event script. (probably) and you could have a "suspension not allowed" in your rpt file, because of the sleep 3. Not tested. In the doubt... Then, no news about the intention: removing gears.... on respawned guy or on dead corpse... perhaps both... Waiting.... Probably 187Killa coming back with invincible respawned men.... Share this post Link to post Share on other sites
187Killa 2 Posted September 29, 2017 24 minutes ago, pierremgi said: No, I spawned: [variables here] spawn { code with sleep command (scheduled event) here } because onPlayerRespawn is an "unscheduled" event script. (probably) and you could have a "suspension not allowed" in your rpt file, because of the sleep 3. Not tested. In the doubt... Then, no news about the intention: removing gears.... on respawned guy or on dead corpse... perhaps both... Waiting.... Probably 187Killa coming back with invincible respawned men.... im not wanting to "spawn" in gear i know how to do that. I was wanting when you join or got killed and respawned at base. I wanted the players to be stripped of gun and ammo so that they will have to use action key to use the VA to select loadout then once they have seleted there loadout they will start spawning with that loadout till they use VA to change it! Also one thing I had noticed when it worked on my before we changed the script for the greater good. was ammo lets say you had 9 rounds and before you died you had 1 mag left. When you spawned instead of getting 9 mags you would only spawn with whatever you had left. how do would you save the ammo count. I thought this "setUnitLoadout (_oldGuy getVariable ["Saved_Loadout",[]]);" would save everything thats why i used it but it only saves gun/scope/gear but not ammo. Share this post Link to post Share on other sites
pierremgi 4890 Posted September 29, 2017 You can: - spawn at start or not. (respawnOnStart = ...) , see BIKI for description.ext and choose to run or not the onPlayerRespawn.sqf script at start or not. (I prefer not) - getUnitLoadOut before death, setUnitLoadout after respawn. 2 "issues": * as you noticed, no ammo count, mags are full (workaround is possible) * you can't open the backpack of another respawned unit. Only yours or those of never-died units. The reason why I prefer bis_fnc_saveInventory / Bis_fnc_loadInventory So, i'd proceed like this: - no respawn on start (respawnOnStart = -1 in description.ext - edited loadout (in 3den) for start (just uniform, addAction or what you want) - respawning with the same loadout , ammos in mags, as player died. Needs to save the loadout at the time of the death. In that way, DISREGARD ALL CODES ABOUT GEARS in former onPlayerRespawn.sqf. REPLACE BY this code, not inside onPlayerRespawn.sqf but in init.sqf (eventHandler is equivalent as onPlayerRespawn.sqf event script): Spoiler addMissionEventHandler ["entityKilled", { _victim = _this select 0; if (local _victim && _victim isKindOf "CAManBase") then { [_victim, [missionNamespace, name _victim]] call BIS_fnc_saveInventory; _victim setVariable ["MGI_ammo1",_victim ammo (primaryWeapon _victim)]; _victim setVariable ["MGI_ammo2",_victim ammo (handgunWeapon _victim)]; _victim setVariable ["MGI_ammo3",_victim ammo (secondaryWeapon _victim)]; _victim setVariable ["MGI_mags",magazinesAmmoFull _victim]; _victim setVariable ["MGI_weapon",currentWeapon _victim]; }; }]; addMissionEventHandler ["entityRespawned", { _unit = _this select 0; _corpse = _this select 1; if (local _unit && _unit isKindOf "CAManBase") then { [_unit, [missionNamespace, name _unit]] call BIS_fnc_loadInventory; {_unit removeMagazine _x} forEach magazines _unit; _unit setAmmo [primaryWeapon _unit, 0]; _unit setAmmo [handGunWeapon _unit, 0]; _unit setAmmo [secondaryWeapon _unit, 0]; { if (((_unit getVariable "MGI_mags") select _foreachindex select 3) <= 0) then { _unit addMagazine [_x select 0,_x select 1] } } forEach (_unit getVariable "MGI_mags"); _unit setAmmo [primaryWeapon _unit,_unit getVariable "MGI_ammo1"]; _unit setAmmo [handGunWeapon _unit,_unit getVariable "MGI_ammo2"]; _unit setAmmo [secondaryWeapon _unit,_unit getVariable "MGI_ammo3"]; _unit selectWeapon (_unit getVariable "MGI_weapon"); removeAllWeapons _corpse; removeBackpackGlobal _corpse; removeVest _corpse; removeAllAssignedItems _corpse; removeAllItems _corpse; removeGoggles _corpse; removeHeadgear _corpse; {deleteVehicle _x} forEach nearestObjects [(getPosATL _corpse),["WeaponHolderSimulated","groundWeaponHolder"],5]; }; }]; As you will see if you test it, player recovers same loadout (each mag, each count) as before. and the corpse keeps only the emptied uniform (it's a choice). I'm using this codes for ages. So tested multiple times. Share this post Link to post Share on other sites
187Killa 2 Posted September 30, 2017 2 hours ago, pierremgi said: You can: - spawn at start or not. (respawnOnStart = ...) , see BIKI for description.ext and choose to run or not the onPlayerRespawn.sqf script at start or not. (I prefer not) - getUnitLoadOut before death, setUnitLoadout after respawn. 2 "issues": * as you noticed, no ammo count, mags are full (workaround is possible) * you can't open the backpack of another respawned unit. Only yours or those of never-died units. The reason why I prefer bis_fnc_saveInventory / Bis_fnc_loadInventory So, i'd proceed like this: - no respawn on start (respawnOnStart = -1 in description.ext - edited loadout (in 3den) for start (just uniform, addAction or what you want) - respawning with the same loadout , ammos in mags, as player died. Needs to save the loadout at the time of the death. In that way, DISREGARD ALL CODES ABOUT GEARS in former onPlayerRespawn.sqf. REPLACE BY this code, not inside onPlayerRespawn.sqf but in init.sqf (eventHandler is equivalent as onPlayerRespawn.sqf event script): Hide contents addMissionEventHandler ["entityKilled", { _victim = _this select 0; if (local _victim && _victim isKindOf "CAManBase") then { [_victim, [missionNamespace, name _victim]] call BIS_fnc_saveInventory; _victim setVariable ["MGI_ammo1",_victim ammo (primaryWeapon _victim)]; _victim setVariable ["MGI_ammo2",_victim ammo (handgunWeapon _victim)]; _victim setVariable ["MGI_ammo3",_victim ammo (secondaryWeapon _victim)]; _victim setVariable ["MGI_mags",magazinesAmmoFull _victim]; _victim setVariable ["MGI_weapon",currentWeapon _victim]; }; }]; addMissionEventHandler ["entityRespawned", { _unit = _this select 0; _corpse = _this select 1; if (local _unit && _victim isKindOf "CAManBase") then { [_unit, [missionNamespace, name _unit]] call BIS_fnc_loadInventory; {_unit removeMagazine _x} forEach magazines _unit; _unit setAmmo [primaryWeapon _unit, 0]; _unit setAmmo [handGunWeapon _unit, 0]; _unit setAmmo [secondaryWeapon _unit, 0]; { if (((_unit getVariable "MGI_mags") select _foreachindex select 3) <= 0) then { _unit addMagazine [_x select 0,_x select 1] } } forEach (_unit getVariable "MGI_mags"); _unit setAmmo [primaryWeapon _unit,_unit getVariable "MGI_ammo1"]; _unit setAmmo [handGunWeapon _unit,_unit getVariable "MGI_ammo2"]; _unit setAmmo [secondaryWeapon _unit,_unit getVariable "MGI_ammo3"]; _unit selectWeapon (_unit getVariable "MGI_weapon"); removeAllWeapons _corpse; removeBackpackGlobal _corpse; removeVest _corpse; removeAllAssignedItems _corpse; removeAllItems _corpse; removeGoggles _corpse; removeHeadgear _corpse; {deleteVehicle _x} forEach nearestObjects [(getPosATL _corpse),["WeaponHolderSimulated","groundWeaponHolder"],5]; }; }]; As you will see if you test it, player recovers same loadout (each mag, each count) as before. and the corpse keeps only the emptied uniform (it's a choice). I'm using this codes for ages. So tested multiple times. okay! Cant wait to test this out! I gotta reread it a few times again though lol also, this should be a quick and easy job I thought but Im failing miserably! Im trying to show friendly names above head so you can see your team mate. Well i have done that successfully but only one side works. and the enemy can see that sides tags too even thought the script isnt in playerslocal. so to clarify i can see team mates tags if im on West side. Red side I cant see team mate tags but I can See West side tags. the logic i used made sense but isnt working logically. init.sqf Spoiler null = [] ExecVM "Tags\Init_Player_East.sqf"; null = [] ExecVM "Tags\Init_Player_West.sqf"; Init_Player_West Spoiler onEachFrame { { if ((side _x == west) && (_x != player)) then { drawIcon3D ["", [0, 0, 255, 1], [visiblePosition _x select 0, visiblePosition _x select 1,(visiblePosition _x select 2)+2], 0.2, 0.2, 45, (format ["%2 - %1m",player distance _x, name _x]), 1, 0.03, "PuristaMedium"]; }; } foreach allunits; }; Init_Player_East Spoiler onEachFrame { { if ((side _x == east) && (_x != player)) then { drawIcon3D ["", [255, 0, 0, 1], [visiblePosition _x select 0, visiblePosition _x select 1,(visiblePosition _x select 2)+2], 0.2, 0.2, 45, (format ["%2 - %1m",player distance _x, name _x]), 1, 0.03, "PuristaMedium"]; }; } foreach allunits; }; EDIT: I tried the above code...i didnt get any error codes but it also didnt work. maybe i need to do a little more than what you said? Share this post Link to post Share on other sites
pierremgi 4890 Posted September 30, 2017 at least, side _x == playerSide instead of 2 codes. Then , for colors : _color = [0,0,0]; call { if (side _x == west) exitWith {_color = [0,0,255,0]}; if (side _x == east) exitWith {_color = [255,0,0]}; }; drawIcon3D ["", _color, [visiblePosition _x select 0, visiblePosition _x select 1,(visiblePosition _x select 2)+2], 0.2, 0.2, 45, (format ["%2 - %1m",round (player distance _x), name _x]), 1, 0.03, "PuristaMedium"]; Well, I have some time, so here is a code for a toggling action menu enabling names on your side on/off. MP/ respawn compatible: in initPlayerLocal.sqf Action_Icon = 0; Action_Menu ="<t color='#11ff11'>Names On</t>"; fn_Action = { _plyr = _this; _plyr addAction [Action_Menu, { _plyr = _this select 0; Action_Icon = (Action_Icon + 1) mod 2; Action_Menu = if (Action_Icon == 1) then [{"<t color='#ff1111'>Names Off</t>"},{"<t color='#11ff11'>Names On</t>"}]; _plyr setUserActionText [(_this select 2),Action_Menu]; },nil,0.8,false,true,"", "vehicle _target == vehicle _this"]; }; player call fn_Action; player addEventHandler ["respawn", { (_this select 0) call fn_action}]; addMissionEventHandler ["draw3D", { { if (Action_Icon == 1 && side _x == playerSide && _x != player) then { _color = [0,0,0,0]; call { if (side _x == west) exitWith {_color = [0,0,255,1]}; if (side _x == east) exitWith {_color = [255,0,0,1]}; }; drawIcon3D ["", _color, [visiblePosition _x select 0, visiblePosition _x select 1,(visiblePosition _x select 2)+2], 0.2, 0.2, 45, (format ["%2 - %1m",round (player distance _x), name _x]), 1, 0.03, "PuristaMedium"]; }; } forEach (allUnits select {effectiveCommander vehicle _x == _x}) }]; Tested. Share this post Link to post Share on other sites