Jump to content
Sign in to follow this  

Recommended Posts

When i spawn something in i need it to only be destroyed by a Pipebomb so i thought this would work but not :(

Can someone please advise how to get this to work

Many thanks

_spawnname = "GUE_WarfareBUAVterminal" createVehicle _spot2;
_spawnname  setVehicleInit addEventHandler ["HandleDamage",{(_this select 4) == "PipeBomb"}]
processInitCommands;

Share this post


Link to post
Share on other sites

If you're using ACE you could try this. I got a link at home I can't find right now with the code though.

Share this post


Link to post
Share on other sites

The coding is wrong anyway

 _spawnname = "GUE_WarfareBUAVterminal" createVehicle getpos this;
 _spawnname  setVehicleInit   "_spawnname addEventHandler [""HandleDamage"",{(_this select 4) == ""PipeBomb""}]" ;
processInitCommands;

Share this post


Link to post
Share on other sites

Just read this, so are they saying do not use the setVehicleInit if not can you let us know how i would do this as not sure after reading that !? How would I attaché a PVEH to my spawn so it can only be destroyed by a pipe bomb

@ kylania No not using ace but thanks.

Share this post


Link to post
Share on other sites

_vehicle = "GUE_WarfareBUAVterminal" createVehicle _spot2;
_vehicle addEventHandler ["HandleDamage",{...}];

YourTag_publicAddHandleDamage = _vehicle;
publicVariable "YourTag_publicAddHandleDamage";

+

//init.sqf
"YourTag_publicAddHandleDamage" addPublicVariableEventHandler
{
_vehicle = _this select 1;
_vehicle addEventHandler ["HandleDamage",{...}];
};

Share this post


Link to post
Share on other sites

Adding of eventhandlers to a script created object might be better off with setVehicleInit, unless you add a persistence layer (so JIP players receive the command too), or use existing persistence layer in e.g RE module.

Perhaps an alternative would be to use createVehicleLocal of the Terminal, on every machine. So you don't need PVEH / SVI etc at all.

Share this post


Link to post
Share on other sites

for JIP:

//init.sqf
YourTag_JIPplayer = not isServer && isNull player;

...

if (YourTag_JIPplayer) then
{
{
  private["_vehicle"];
  _vehicle = _x;  
  if (_vehicle isKindOf "GUE_WarfareBUAVterminal") then
  {
   addEventHandler ["HandleDamage",{...}];
  };
} forEach vehicles;
};

---------- Post added at 11:29 ---------- Previous post was at 11:27 ----------

PS: The code inside your HD EH is faulty.

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
Sign in to follow this  

×