Jump to content
OsqaRpl

Trigger with condition - if Civil1 is alive and the player is in the trigger activation zone.

Recommended Posts

Trigger with condition - if Civil1 is alive and the player is in the trigger activation zone. If Civil1 is dead, the trigger will not be activated. Do you know how to transfer this game? Thank you for all your help.

Share this post


Link to post
Share on other sites
alive Civil1 AND player in thislist;

 

🤙

Share this post


Link to post
Share on other sites
On 3/30/2022 at 3:21 PM, Rok Stuhne said:

alive Civil1 AND player in thislist;

 

🤙

 

Not so simple. player in thislist depends on:

- what thisList is made of, so the preset condition. For example an OPFOR player for BLUFOR present will not work

- if player is on foot or inside a vehicle. If player is inside a vehicle, even if BLUFOR (example), that will not fire.

 

ANYPLAYER present solves the first issue but not the second one. In vehicle, still no joy. Change for:

alive civil1 && vehicle player in thisList.

Now this preset condition works.

 

You can skip the preset condition (none, none or whatever preset cond.):

alive civil1 && player inArea thisTrigger   (no matter player in foot or inside a vehicle).

 

  • Like 1

Share this post


Link to post
Share on other sites
4 hours ago, pierremgi said:

 

Not so simple. player in thislist depends on:

- what thisList is made of, so the preset condition. For example an OPFOR player for BLUFOR present will not work

- if player is on foot or inside a vehicle. If player is inside a vehicle, even if BLUFOR (example), that will not fire.

 

ANYPLAYER present solves the first issue but not the second one. In vehicle, still no joy. Change for:

alive civil1 && vehicle player in thisList.

Now this preset condition works.

 

You can skip the preset condition (none, none or whatever preset cond.):

alive civil1 && player inArea thisTrigger   (no matter player in foot or inside a vehicle).

 

 

I like your enthusiasm.

 

Now pls help me with how to write a code snippet for a killticker script that needs to work with AI spawner module. 😉  

 

Last post 😔

 

 

Share this post


Link to post
Share on other sites
9 minutes ago, Rok Stuhne said:

Now pls help me with how to write a code snippet for a killticker script that needs to work with AI spawner module. 😉  

 

huh 2013 script? (I guess the author will not reply. no activity since then).

 

Try that instead:
 

tlq_parseKill = {
  params ["_victim","_instigator"];
  private _line = "";
  private _killerName = "";
  private _victimName = "";
  private _killerString = "";
  private _victimString = "";
  private _killerColor = "#99D5FF";
  private _victimColor = "#99D5FF";
 
  if (!(isplayer _instigator)) then {
    _killerName = getText (configFile >> "CfgVehicles" >> format["%1",typeOf _instigator] >> "Displayname");
    if(!isNull objectParent _instigator) then {
      _killerName = getText (configFile >> "CfgVehicles" >> format["%1 crew",typeof vehicle _instigator] >> "Displayname")
    };
  } else {
    _killerName = name _instigator
  };

  if (!(isplayer _victim)) then {
    _victimName = getText (configFile >> "CfgVehicles" >> format["%1",typeOf _victim] >> "Displayname");
    if(!isNull objectParent _victim) then {
      _victimName = getText (configFile >> "CfgVehicles" >> format["%1 crew",typeof vehicle _victim] >> "Displayname")
    };
  } else {
    _victimName = name _victim
  };

  if (_instigator == player) then {
    _killerColor = "#ffff00";
  } else {
    _killerColor = side group _instigator call BIS_fnc_sideColor;
    _r = _killerColor select 0;
    _g = _killerColor select 1;
    _b = _killerColor select 2;
    _killerColor = [_r+0.1,_g+0.1,_b+0.1];
    _killerColor = _killerColor call BIS_fnc_colorRGBtoHTML;
  };

  if (_victim == player) then {
    _victimColor = "#ffff00";
  } else {
    _victimColor = side group _victim call BIS_fnc_sideColor;
    _r = _victimColor select 0;
    _g = _victimColor select 1;
    _b = _victimColor select 2;
    _victimColor = [_r+0.1,_g+0.1,_b+0.1];
    _victimColor = _victimColor call BIS_fnc_colorRGBtoHTML;
  };
  _killerString = format["<t color='%1'>%2</t>",_killerColor ,_killerName];
  _victimString = format["<t color='%1'>%2</t>",_victimColor,_victimName];
  _line = switch(true) do {
    case(_instigator == _victim): {format ["%1 killed themselves",_killerString]};
    case(isNull _instigator): {format ["Bad luck for %1",_victimString]};
    default {format ["%1 killed %2",_killerString,_victimString]};
  };
  _line;
};

tlq_killPopUp = {
  params ["_victim","_instigator"];
  private _victimName = "";
  private _victimString = "";
  private _victimColor = "#99D5FF";

  if (!(isplayer _victim)) then {
    _victimName = getText (configFile >> "CfgVehicles" >> format["%1",typeOf _victim] >> "Displayname");
    if(!isNull objectParent _victim) then {
      _victimName = getText (configFile >> "CfgVehicles" >> format["%1 crew",typeof vehicle _victim] >> "Displayname")
    };
  } else {
    _victimName = name _victim
  };
  _victimColor = (side group _victim call BIS_fnc_sideColor) call BIS_fnc_colorRGBtoHTML;
  _victimString = format["<t color='%1'>%2</t>",_victimColor,_victimName];
  private _line = if ((_instigator == player) and (_victim == player)) then {
    "<t size='0.5'>You killed yourself</t>";
  } else {
    format ["<t size='0.5'>You killed %1</t>",_victimString];
  };  
    [_line,0,0.8,2,0,0,7017] spawn bis_fnc_dynamicText;
  };

  tlq_killList = {
    if (time - tlq_killTime > 37) then {
      tlq_displayedKills = [];
    };
    tlq_displayedKills set [count tlq_displayedKills, tlq_killArray select (count tlq_killArray - 1)];
    private _tickerText = "";
    private _c = 0;
  for "_i" from (count tlq_displayedKills) to 0 step -1 do {
    _c = _c + 1;
    _tickerText = format ["%1<br />%2",tlq_displayedKills select _i,_tickerText];
    if (_c > 8) exitWith{};
  };
  hintsilent parsetext _tickerText;
  tlq_killTime = time;
};

tlq_killArray = [];
tlq_displayedKills = [];
tlq_killTime = 0;

addMissionEventHandler ["EntityKilled", {
  params ["_killed", "_killer", "_instigator"];
  if (isNull _instigator) then {_instigator = UAVControl vehicle _killer #0};
  if (isNull _instigator) then {_instigator = _killer};
  private _newKill = [_killed,_instigator];
  if (count tlq_killArray > 100) then {tlq_killArray = []};
  tlq_killArray set [count tlq_killArray,_newKill call tlq_parseKill];
  [] spawn tlq_killList;
  if (player == _instigator) then {_newKill spawn tlq_killPopUp};
}];
  • Like 1

Share this post


Link to post
Share on other sites
55 minutes ago, pierremgi said:

 

huh 2013 script? (I guess the author will not reply. no activity since then).

 

Try that instead:
 


tlq_parseKill = {
  params ["_victim","_instigator"];
  private _line = "";
  private _killerName = "";
  private _victimName = "";
  private _killerString = "";
  private _victimString = "";
  private _killerColor = "#99D5FF";
  private _victimColor = "#99D5FF";
 
  if (!(isplayer _instigator)) then {
    _killerName = getText (configFile >> "CfgVehicles" >> format["%1",typeOf _instigator] >> "Displayname");
    if(!isNull objectParent _instigator) then {
      _killerName = getText (configFile >> "CfgVehicles" >> format["%1 crew",typeof vehicle _instigator] >> "Displayname")
    };
  } else {
    _killerName = name _instigator
  };

  if (!(isplayer _victim)) then {
    _victimName = getText (configFile >> "CfgVehicles" >> format["%1",typeOf _victim] >> "Displayname");
    if(!isNull objectParent _victim) then {
      _victimName = getText (configFile >> "CfgVehicles" >> format["%1 crew",typeof vehicle _victim] >> "Displayname")
    };
  } else {
    _victimName = name _victim
  };

  if (_instigator == player) then {
    _killerColor = "#ffff00";
  } else {
    _killerColor = side group _instigator call BIS_fnc_sideColor;
    _r = _killerColor select 0;
    _g = _killerColor select 1;
    _b = _killerColor select 2;
    _killerColor = [_r+0.1,_g+0.1,_b+0.1];
    _killerColor = _killerColor call BIS_fnc_colorRGBtoHTML;
  };

  if (_victim == player) then {
    _victimColor = "#ffff00";
  } else {
    _victimColor = side group _victim call BIS_fnc_sideColor;
    _r = _victimColor select 0;
    _g = _victimColor select 1;
    _b = _victimColor select 2;
    _victimColor = [_r+0.1,_g+0.1,_b+0.1];
    _victimColor = _victimColor call BIS_fnc_colorRGBtoHTML;
  };
  _killerString = format["<t color='%1'>%2</t>",_killerColor ,_killerName];
  _victimString = format["<t color='%1'>%2</t>",_victimColor,_victimName];
  _line = switch(true) do {
    case(_instigator == _victim): {format ["%1 killed themselves",_killerString]};
    case(isNull _instigator): {format ["Bad luck for %1",_victimString]};
    default {format ["%1 killed %2",_killerString,_victimString]};
  };
  _line;
};

tlq_killPopUp = {
  params ["_victim","_instigator"];
  private _victimName = "";
  private _victimString = "";
  private _victimColor = "#99D5FF";

  if (!(isplayer _victim)) then {
    _victimName = getText (configFile >> "CfgVehicles" >> format["%1",typeOf _victim] >> "Displayname");
    if(!isNull objectParent _victim) then {
      _victimName = getText (configFile >> "CfgVehicles" >> format["%1 crew",typeof vehicle _victim] >> "Displayname")
    };
  } else {
    _victimName = name _victim
  };
  _victimColor = (side group _victim call BIS_fnc_sideColor) call BIS_fnc_colorRGBtoHTML;
  _victimString = format["<t color='%1'>%2</t>",_victimColor,_victimName];
  private _line = if ((_instigator == player) and (_victim == player)) then {
    "<t size='0.5'>You killed yourself</t>";
  } else {
    format ["<t size='0.5'>You killed %1</t>",_victimString];
  };  
    [_line,0,0.8,2,0,0,7017] spawn bis_fnc_dynamicText;
  };

  tlq_killList = {
    if (time - tlq_killTime > 37) then {
      tlq_displayedKills = [];
    };
    tlq_displayedKills set [count tlq_displayedKills, tlq_killArray select (count tlq_killArray - 1)];
    private _tickerText = "";
    private _c = 0;
  for "_i" from (count tlq_displayedKills) to 0 step -1 do {
    _c = _c + 1;
    _tickerText = format ["%1<br />%2",tlq_displayedKills select _i,_tickerText];
    if (_c > 8) exitWith{};
  };
  hintsilent parsetext _tickerText;
  tlq_killTime = time;
};

tlq_killArray = [];
tlq_displayedKills = [];
tlq_killTime = 0;

addMissionEventHandler ["EntityKilled", {
  params ["_killed", "_killer", "_instigator"];
  if (isNull _instigator) then {_instigator = UAVControl vehicle _killer #0};
  if (isNull _instigator) then {_instigator = _killer};
  private _newKill = [_killed,_instigator];
  if (count tlq_killArray > 100) then {tlq_killArray = []};
  tlq_killArray set [count tlq_killArray,_newKill call tlq_parseKill];
  [] spawn tlq_killList;
  if (player == _instigator) then {_newKill spawn tlq_killPopUp};
}];

 

Well, the script works (i will test your version too of course) i just don't know how to make it work for every new spawned squad. AI spawn module has an expression field...idk the syntax to make it work only for newly spawned and not applying the event handlers to everyone present on map which results in double, triple and quadruple notifications.

Share this post


Link to post
Share on other sites
8 minutes ago, Rok Stuhne said:

 

 (i will test your version too of course)

thks.

  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, pierremgi said:

thks.

 

 

Feels like mixed results, the doubling/tripling of entries stopped tho...

 

pierre.jpg

 

There's definitely more of proper results, but some incomplete entries are still around

 

pierre2.jpg

 

Overall an improvement over what i was using before 🙂

 

Feels like the longer it goes on, the better it works lol

 

pierre3.jpg

 

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

×