Jump to content
Seldkam

Attempting a "honk and boom" car bomb, help request!

Recommended Posts

Hey folks. I've tried various script drafts at this point but can't seem to get anything to work, I'm not experienced with coding in general aside from tinkering in Unity way back when. Putting both these two iterations of the code in a van transport truck's init (just by double clicking the vehicle in the editor) does nothing upon honking the horn. 

 

if (!local this) exitWith {};

this addEventHandler ["Fired",

{ if (_this select 1 == "CarHorn")

then { ied1 setDamage 1; }

forEach attachedObjects _vehicle; } ]

The above is the most recent version, the below is the version I started with thanks to someone on the discord.
 


if (!local this) exitWith {}; 

this addEventHandler ["Fired", {
  private _vehicle = _this select 0;
  private _weapon = _this select 1;
  private _weaponName = getText (configFile >> "cfgWeapons" >> _weapon >> "displayName");
  if (toLower _weaponName isEqualTo "carhorn") then {
    {
      if ("remote" in toLower typeOf IEDUrbanBig_Remote_Mag) then { 
        IEDUrbanBig_Remote_Mag setDamage 1;
      };
    } forEach attachedObjects _vehicle;
  };
}];

Any help is appreciated. 

 

The version I'm using now (the shorter one) doesn't work, nor does the longer one below it. This is meant for public zeus usage, but I'm just curious to see how to make this work at this point. 

Share this post


Link to post
Share on other sites

You will not fire the EH "fired" with the truck horn.

 

The simplest way. No need to add ied (but you can if you want). Add a trigger (not server only), condition: TRUE  (instead of this)

on activation:


 

[] spawn {
  waitUntil {!isNull findDisplay 46};
  (findDisplay 46) displayAddEventHandler ["mouseButtonDown", {
    params ["_display","_button"];
    private _car = objectParent player;
    if (!isNull _car && {_button == 0 && driver _car == player && _car isKindOf "car"}) then {
      [] spawn {
        _car = objectParent player;
        sleep 1;
        _car setdamage 1
       }
    };
    false
  }];
};

 

  • Like 1

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

×