Jump to content
italiandrache

When adding a weapon to a dead unit, the weapon 3D model isn't visible

Recommended Posts

As stated in the title, when adding a weapon to a dead unit (whom's previous primary weapon had already been removed), the weapon 3D model isn't visible to the player, albeit it being pickable from the ground and showing when inventory is opened.

I'm not sure if this issue occurs only with primary weapons or with the other weapon types, too.

 

Any suggestion? Thank you a lot.

Share this post


Link to post
Share on other sites

Don't add weapon on corpse. That can lead to some strange results like weapon floating in the air. (depending on mods and other considerations)

For example, adding a weapon like this (in init field of the unit):

if (isServer) then {
  this addEventHandler ["killed", {
   params ["_unit"];
   hint "adding arifle_AK12_GL_arid_F";
   _unit addWeapon "arifle_AK12_GL_arid_F";
}]};

will not guarantee you can grab it (depending on the stance of unit when this EH runs).

 

For your purpose, just create a weapon holder at corpse's position, and place your weapon(s) + mags +... inside.

Example, in MP, on server:

if (isServer) then {
  this addEventHandler ["killed", {
   params ["_unit"];
   hint "adding arifle_AK12_GL_arid_F";
   private _wh = createVehicle ["WeaponHolderSimulated_Scripted",getpos _unit,[],0,"can_collide"];
   _wh addWeaponCargoGlobal ["arifle_AK12_GL_arid_F",1];
}]};

 

Share this post


Link to post
Share on other sites
On 12/18/2020 at 3:27 AM, pierremgi said:

Don't add weapon on corpse. That can lead to some strange results like weapon floating in the air. (depending on mods and other considerations)

For example, adding a weapon like this (in init field of the unit):

if (isServer) then {
  this addEventHandler ["killed", {
   params ["_unit"];
   hint "adding arifle_AK12_GL_arid_F";
   _unit addWeapon "arifle_AK12_GL_arid_F";
}]};

will not guarantee you can grab it (depending on the stance of unit when this EH runs).

 

For your purpose, just create a weapon holder at corpse's position, and place your weapon(s) + mags +... inside.

Example, in MP, on server:


if (isServer) then {
  this addEventHandler ["killed", {
   params ["_unit"];
   hint "adding arifle_AK12_GL_arid_F";
   private _wh = createVehicle ["WeaponHolderSimulated_Scripted",getpos _unit,[],0,"can_collide"];
   _wh addWeaponCargoGlobal ["arifle_AK12_GL_arid_F",1];
}]};

 

 

Thanks, I'll try!

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

×