Search the Community
Showing results for tags 'entitykilled'.
Found 5 results
-
Vehicle respawn with EntityKilled EH
Asmodeuz posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hello, through trial and testing I've arrived to the following format for a vehicle respawn functionality. addMissionEventHandler ["EntityKilled", { params ["_killed", "_killer", "_instigator"]; [_killed] spawn { switch (true) do { case (!alive vehCivSUV_1): {deleteVehicle vehCivSUV_1; _newVehicle2 = "C_SUV_01_F" createVehicle [1263,1298,0]; _newVehicle2 setVehicleVarName "vehCivSUV_1"; vehCivSUV_1 = _newVehicle2; publicVariable "vehCivSUV_1";}; sleep 2; case (!alive vehCivSUV_2): {deleteVehicle vehCivSUV_2; _newVehicle = "C_SUV_01_F" createVehicle [1232,1298,0]; _newVehicle setVehicleVarName "vehCivSUV_2"; vehCivSUV_2 = _newVehicle; publicVariable "vehCivSUV_2";}; }; }; }]; While testing has proven that it works decently enough in a dedicated server there's still at least one edge-case scenario that I'd like to iron out. The edge-case is that should the two vehicles mentioned in the event handlers code be destroyed exactly at the same time the functionality does not work as expected. Should the demise of both vehicles happen at the same time the other vehicle won't be created at all (and the other that gets created will have a duplicate vehicle spawned next to it). So while what I have now works to some degree there should be some changes made to make the functionality more robust. Maybe the switch-do is not the best solution but I have only just arrived to that and don't have off the top of my head any other solution to try. So question for this is that: what would be a more robust way to achieve what I have now and do away with the edge-case scenario at the same time? Another thing would be that the functionality should, if possible, incorporate at least two more vehicles in it. edit: while I know that there's a respawn module available in the editor that can't be used for "reasons" -
[SOLVED] Remove all magazines and items from soldiers upon getting killed
Asmodeuz posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hello, I thought the following script would remove all magazines from a soldier (be it a dynamically spawned AI or human player) upon getting killed but for reasons unknown to me nothing gets removed ever: _removeMagazinesFromAnyone = addMissionEventHandler ["EntityKilled", { params["_killed","_killer","_instigator"]; if (_killed isKindOf "CAManBase") then { (_this select 0) spawn { sleep 1; {_this removeMagazine _x} forEach magazines _this; }; }; }]; When testing the script with a mission on a dedicated server there's no script errors. What gives in this case? All in all I'm looking for a script that would remove everything* else from killed units except the containers (vest, backpack, uniform) they use to carry stuff. *though not necessarily main weapon since there's another script that makes picking one up not possible Edit: Solved by using in this case removeMagazineGlobal instead of just removeMagazine- 3 replies
-
- entitykilled
- addmissioneventhandler
-
(and 3 more)
Tagged with:
-
Using Sleep with Mission Eventhandler Entitykilled on Dedicated Server
aie-boshell posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hello, I I am using an entitykilled mission eventhandler how to run a custom radio message each time a certain unit gets a Kill. Everything is working fantastic accepted that I would like to have a delay before the radio message gets played. I've been trying to use sleep and it is not working. Does anyone know how to get sleep to work with entitykilled or perhaps a viable alternative to achieve the results of getting a delay before a radio message after a certain unit gets a Kill? Any help is very much appreciated, as always :-)- 10 replies
-
- sleep
- missioneventhandler
-
(and 2 more)
Tagged with:
-
The below script is intended to act as a functionality that checks if the killer is player and whether killed is either on the same side as the player or on the enemy side. _TK = addMissionEventHandler ["EntityKilled", { params["_killed", "_killer", "_instigator"]; if ((side _killer == playerSide) && (side group _killed == playerSide) || (side group _killed != playerSide)) then { _this = _this select 0; {_this removeMagazine _x} forEach magazines _this; removeAllItems _this; removeAllAssignedItems _this; }; }]; When a player kills either a friendly soldier or an enemy soldier the code should make it so that all the items and magazines get removed from the now deceased. The code itself works very well for the case: if ((side _killer == playerSide) && (side group _killed == playerSide) but not so well for the case if ((side _killer == playerSide) || (side group _killed != playerSide)) Very often in this particluar case ammunition and items can be picked from the killed enemy soldiers. As much as I understand to read the code it should work as follows: If player is killer AND killed is friendly OR killed is not friendly (is enemy in this case) then remove all items and magazines What I might be missing here? Or should I be looking for completely another approach for what I'm trying to achieve here?
- 4 replies
-
- entitykilled
- playerside
-
(and 2 more)
Tagged with:
-
[SOLVED] addMissionEventHandler
Flightcaptain93 posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
_civkilled = addMissionEventHandler ["EntityKilled",{if (((_this select 1) == player) && (side (_this select 0) == civilian)) then {[[], "ray_lose_fnc", true, true] call BIS_fnc_MP; [[(_this select 1)], "ray_killer_fnc", true, true] call BIS_fnc_MP; }else{}; }]; I have this type of code... it works correctly. But if i kill the second teammate in the group of the player (blufor) the trigger fires... Thanks :)