Forum Jump :

Author Message


Posts: 4
Rank:


Level: Member

Country: de
Location:
Occupation:
Age:
In-game name:

 
#1 Posted at 2016-10-31 02:35        
     
Hello,

I try to achieve the following for days:
I want that a triggerzone is created at the location where the unit dies / where the body is. I don´t know how to do it. I tried a few things, but I can´t get a trigger to appear. The player need to get to the body in order to trigger a certain event. But I don´t want a immobile trigger and I don´t want to make that specific unit static.

Any ideas?

Thank you


Author Message


Posts: 131
Rank:


Level: Member

Country: us
Location:
Occupation:
Age: 25
In-game name: Joshua

 
#2 Posted at 2016-10-31 04:25        
     
There are a few ways that I can think of to do this. The most simple is to just scan for anyone around the dead unit by using the following in the condition of the trigger:
player distance2D deadUnit < 1 and !alive deadUnit
Just replace player with whoever is supposed to activate the trigger and deadUnit with the unit that died.

Annother way is to create a trigger when the unit dies - https://community.bistudio.com/wiki/createTrigger

There are probably even more ways to do this. Check out the commands here, these are all the arma commands: https://community.bistudio.com/wiki/Category:Scripting_Commands_Arma_3
'Control' + 'F' to search is your friend on this page.


Advertisement


Author Message


Posts: 4
Rank:


Level: Member

Country: de
Location:
Occupation:
Age:
In-game name:

 
#3 Posted at 2016-10-31 11:38        
     
Hey jshear95,

thank you very much. Your code works flawlessly. I fiddlet around with the createTrigger command, but couldn´t get it to work.

Much appreciated!
Edelrost


Author Message


Posts: 1589
Rank:


Level: Member

Country: pf
Location: Tahiti
Occupation: too many Arma
Age: 60
In-game name: Kobayashi Maru

 
#4 Posted at 2016-10-31 16:45        
     
You can avoid triggers for such distance check. In init.sqf, for example, SP & MP compatible:

if (isServer) then {  // in case of MP
  [] spawn {
    while {true} do { // loop
      {
        if (!alive deadUnit && {_x distanceSqr deadUnit < 1}) then {
          < your code here with _x as special variable for the player(s) who is (are) near the corpse >;
        };
      } forEach allPlayers;
      sleep 2; // laziest than a trigger but sufficient
    }
  }
};

PLEASE CONTACT ME ON BI FORUMS FOR ANY SCRIPT / MOD QUESTION. TKS

Author Message


Posts: 4
Rank:


Level: Member

Country: de
Location:
Occupation:
Age:
In-game name:

 
#5 Posted at 2016-11-04 13:10        
     
Is it possible to create a map marker at the location of the body that will appear on the map when the enemy is dead?


Author Message


Posts: 131
Rank:


Level: Member

Country: us
Location:
Occupation:
Age: 25
In-game name: Joshua

 
#6 Posted at 2016-11-04 14:30        
     
You can use this command to create the marker: https://community.bistudio.com/wiki/createMarker
For ways to customize it you can check this link: https://community.bistudio.com/wiki/Category:Scripting_Commands_Arma_3
Its the same one I posted above with all the scripting commands. Just Control F for 'Marker' and you should find all the commands related to changing marker direction, icon, color, location, ...


Author Message


Posts: 1589
Rank:


Level: Member

Country: pf
Location: Tahiti
Occupation: too many Arma
Age: 60
In-game name: Kobayashi Maru

 
#7 Posted at 2016-11-04 17:29        
     
in init.sqf :

Say you are on SP mission. In MP, the code is slightly different:
{
  _x addEventHandler ["killed", {
    _victim = _this select 0;
    _mark = createMarkerLocal [name _victim,getPosATL _victim];
    _mark setMarkerTypeLocal "selector_selectable"; // or what [url=https://community.bistudio.com/wiki/cfgMarkers]type you want[/url]
    _mark setMarkerText "walking dead";
    _mark setMarkerColor "colorRed";
  }]
} forEach (allUnits select {(side _x) getFriend player < 0.6});

If you spawn units in game, as this code runs at start, you need to loop it to actualize allUnits variable:

0 = [] spawn {
  while {true} do {
   sleep 5;
   {
     if !(_x getVariable ["marked",false]) then {
       _x setVariable ["marked",true];
       _x addEventHandler ["killed", {
         _victim = _this select 0;
         _mark = createMarkerLocal [name _victim,getPosATL _victim];
         _mark setMarkerTypeLocal "selector_selectable"; // or what [url=https://community.bistudio.com/wiki/cfgMarkers]type you want[/url]
         _mark setMarkerText "walking dead";
         _mark setMarkerColor "colorRed";
       }];
      };
    } forEach (allUnits select {(side _x) getFriend player < 0.6});
  };
};

PLEASE CONTACT ME ON BI FORUMS FOR ANY SCRIPT / MOD QUESTION. TKS





Tags: 3, Arma, Create, Trigger, Unit, Where