Weapon drop mod

Sduibek said:
EDIT: This is now fully implemented in my mod -- links are in my signature.

Thanks Sduibek...your fast becoming one of my favorites here at NMA. :mrgreen: Does it have the random fall feature?

Josan will you tie this into your survival mod…can I make a suggestion – with this weapon drop, can the weapon drop in a random manner in any one of the six bordering hexes, and if that hex is blocked then the next empty hex…no one can accurately predict how a weapon would fall in real life, so I think adding random element would be refreshing. :wink:

weapondrop.gif
 
Code:
	variable LVar1;
	variable LVar2;
	LVar2 := critter_inven_obj(self_obj, 1);
	LVar1 := tile_num_in_direction(tile_num(self_obj), random(0, 5), random(1, 2));
	rm_obj_from_inven(self_obj, LVar2);
	move_to(LVar2, LVar1, elevation(self_obj));

For those wanting to expand on this, some notes:

-LVar2 is for item slot 1 (i.e.active hand).

-LVar1 is the random location part. The (0, 5) is the direction/six hexes you are asking about, Pixote. Random(1, 2) is the number of hexes. Replace that (random(1, 2)) with just a 1 or a 2 (or higher) to set it to be the same number each time. Same concept goes with the direction.

-This process can be repeated for the other hand (or even the armor slot) by copying this whole part and using two additional variables (such as LVar3 and LVar4).
 
Sduibek said:
So what was the general verdict on these questions:

1) Drop second hand item slot?
2) Drop armor slot?
3) Drop on KO/Unconscious?
4) Drop on crippled limb?

My current implementation is just the main item (slot #1), but I think adding it to KO and Crippled Arm could be a good idea.

EDIT: I did some digging and I think it'll be best if I check both slot #1 and #2. Check if it's a non-unarmed, non-point-blank-melee weapon, and drop them. Otherwise leave it.

I thought the weapon would drop from the active hand slot only on a critical - or do you want to make it a successful arm target shot. 8-)

KO and crippled limbs is a bit too difficult to achieve, remember just because they have dropped their weapon doesn't mean they wont pick it up at the start of the next round and reequip it. There could be cases were another critter will grab the weapon for themselves. :wink:

I wouldn't worry about the second hand item slot or drop armor slot.
 
If you want, the random(1,2) can also be substituted with random(0,2) -- in other words the weapon has a chance of falling on the corpse's hex. This isn't as bad as it sounds, as many weapons are long enough that you can still highlight to pick it up anyway.

EDIT>> This is what i'm using currently:
Code:
//BEGIN WEAPON DROP -- Jason12 & MIB88
	variable LVar1;
	variable LVar2;
	LVar2 := critter_inven_obj(self_obj, 1);//    Active item slot
	LVar1 := tile_num_in_direction(tile_num(self_obj), random(0, 5), random(0, 2));//    Random direction, 0 to 2 hexes from killed critter's hex (so under the corpse, next to it, or farther from it)
	if ((LVar2 != 21) or (LVar2 != 234) or (LVar2 != 235) or (critter_inven_obj(self_obj, 2) != 21) or (critter_inven_obj(self_obj, 2) != 234) or (critter_inven_obj(self_obj, 2) != 235)) then begin//    Brass Knuckles, Spiked Knuckles, Power Fist
		rm_obj_from_inven(self_obj, LVar2);
		move_to(LVar2, LVar1, elevation(self_obj));//    Drop active item slot's item 
//END WEAPON DROP -- Jason12 & MIB88
	end
This checks if their equipped weapon is Spiked Knuckles, Brass Knuckles, or Power Fist, and if it is NOT one of those three, runs the drop weapon code.


Josan12 said:
And i'm not sure how to stop robots 'dropping' their guns .... MIB??
Apologies if this was already answered -- easiest way to do this is run code to destroy the items in question, or if you want to prevent them from dropping all weapons and ammo (i.e. Mr Handy) then can simply do:

Code:
	move_obj_inven_to_obj(self_obj, [destroyme]);
	destroy_object([destroyme]);


For those interested, the game can check Obj_Type, meaning Weapon Drop code could make sure this is equal to three (because 3 == Weapon Type) before dropping.

That could of course be checked on the main hand, off hand, or both.
 
Back
Top