Home   Help Search Login Register  

Author Topic: Drop the @*&$&*(##($ Gun!  (Read 760 times)

0 Members and 1 Guest are viewing this topic.

Homefry31464

  • Guest
Drop the @*&$&*(##($ Gun!
« on: 24 Jan 2004, 00:12:30 »
Now that I have your attention, I have to ask a question.  When a unit is killed, is there any delay or is he dead, instantly?  I ask this because I was wondering if there was a way to make the unit drop the weapon when he's killed.

Is there a command, much like the unassign command for a unit in a vehicle, which makes the weapon be dropped from a unit?

Offline icarus_uk

  • Members
  • *
  • LiarLiarPants Inflame True
    • [furryclan]
Re:Drop the @*&$&*(##($ Gun!
« Reply #1 on: 24 Jan 2004, 00:16:56 »
An odd question.  As soon as a units dammage reaches 1 then hit is dead.  He can be stanidng up while this happens, but then he falls to the floor.

The next part is even more confusing, when a unit dies, you can pick up his weapon, it just shows it in his hand, but you can still take it, and order or script AI to take it.  Do you want him to fling it across the map in the throes of his death?

Homefry31464

  • Guest
Re:Drop the @*&$&*(##($ Gun!
« Reply #2 on: 24 Jan 2004, 00:58:44 »
The main reason behind it is the fact of when an explosion goes off, the weapon flies with it, only seemingly floating a few inches away from the man's hand.

gundernak

  • Guest
Re:Drop the @*&$&*(##($ Gun!
« Reply #3 on: 24 Jan 2004, 01:58:45 »
this script is executed by "killed" eventhandler:
Code: [Select]
_dead = _this select 0

_weapons = weapons _dead

_weapon ="WeaponHolder" CreateVehicle getPos _dead

_weapon addWeaponCargo [format ["%1",_weapons select 0], 1]

_dead removeWeapon format ["%1",_weapons select 0]

exit

someone should add an ammo check, because this gives an empty weapon the dude had...

gundernak

  • Guest
Re:Drop the @*&$&*(##($ Gun!
« Reply #4 on: 24 Jan 2004, 02:38:24 »
Ok here is the script...

It needs to be refined the position to the weapons dropped....

After a little experimenting I noticed that select 0 is always the primary weapon
and select 1 is the rpg or law etc...

It does not depend on which weapon is in the unit's hand when he is killed...

These script will drop one weapon if he had 1, two if he had two...with the ammo the dude had
Code: [Select]
_dead = _this select 0

_weapons = weapons _dead

? count _weapons == 1: goto "1weapon"
? count _weapons == 2: goto "2weapons"


#1weapon
_ammo01 = _dead Ammo format ["%1",_weapons select 0]

_weapon01 ="WeaponHolder" CreateVehicle getPos _dead

_weapon01 addWeaponCargo [format ["%1",_weapons select 0], 1]
_weapon01 addMagazineCargo [format ["%1",_weapons select 0], _ammo01]

_dead removeWeapon format ["%1",_weapons select 0]

goto "end"


#2weapons

_ammo01 = _dead Ammo format ["%1",_weapons select 0]
_ammo02 = _dead Ammo format ["%1",_weapons select 1]

_weapon01 ="WeaponHolder" CreateVehicle getPos _dead
_weapon02 ="WeaponHolder" CreateVehicle getPos _dead

_weapon01 addWeaponCargo [format ["%1",_weapons select 0], 1]
_weapon01 addMagazineCargo [format ["%1",_weapons select 0], _ammo01]

_weapon02 addWeaponCargo [format ["%1",_weapons select 1], 1]
_weapon02 addMagazineCargo [format ["%1",_weapons select 1], _ammo02]

_dead removeWeapon format ["%1",_weapons select 0]
_dead removeWeapon format ["%1",_weapons select 1]

#end
exit

Homefry31464

  • Guest
Re:Drop the @*&$&*(##($ Gun!
« Reply #5 on: 24 Jan 2004, 03:01:30 »
Thanks a lot dude.  How do I impliment this into the mission??  As in, have this script run for every unit on the map when he is killed.  

gundernak

  • Guest
Re:Drop the @*&$&*(##($ Gun!
« Reply #6 on: 24 Jan 2004, 14:40:27 »
name this script to: weapondrop.sqs

Create a trigger covering all unit you want to have this feature

set to: anybody present

type: none

copy this to 'on activation field':

"_x addEventHandler [""killed"",{_this exec ""weapondrop.sqs""}]" forEach thislist

But I let you know, when the rpg or law or AA...dropped, its position is vertical and looks like it is drilled to the ground.
As I said its position needs to be refined...

The primary weapon will be laying nicely... ;)

Homefry31464

  • Guest
Re:Drop the @*&$&*(##($ Gun!
« Reply #7 on: 24 Jan 2004, 17:02:29 »
Alright.  Thanks a lot.  ;D ;D ;D

Homefry31464

  • Guest
Re:Drop the @*&$&*(##($ Gun!
« Reply #8 on: 24 Jan 2004, 22:00:47 »
Does anyone know how to fix the secondary weapon's problem??