is it possible?
procedure start;
#include ".\HEADERS\DEFINE.H"
#include ".\HEADERS\COMMAND.H"
#include ".\HEADERS\sfall.h"
#include ".\HEADERS\define_extra.h"
#include ".\HEADERS\dik.h"
procedure start begin
if game_loaded then begin
register_hook(HOOK_KEYPRESS);
end else begin
variable
event := get_sfall_arg,
keyDX := get_sfall_arg,
item, ammoPID, ammoCount, ammoPacks, ammoObj;
if (event == 1) and (keyDX == DIK_V) then begin
// get item object in active hand
if (critter_inven_obj(dude_obj, INVEN_TYPE_RIGHT_HAND) > 0) then begin
item := critter_inven_obj(dude_obj, INVEN_TYPE_RIGHT_HAND);
end else if (critter_inven_obj(dude_obj, INVEN_TYPE_LEFT_HAND) > 0) then begin
item := critter_inven_obj(dude_obj, INVEN_TYPE_LEFT_HAND);
end
if (obj_item_subtype(item) == item_type_weapon) then begin
ammoPID := get_weapon_ammo_pid(item);
ammoCount := get_weapon_ammo_count(item);
if (ammoPID > 0) and (ammoCount > 0) then begin
ammoPacks := ammoCount / get_proto_data(ammoPID, PROTO_AM_PACK_SIZE);
if ammoPacks then begin
add_mult_objs_to_inven(dude_obj, create_object(ammoPID, 0, 0), ammoPacks);
end
ammoPacks := ammoCount % get_proto_data(ammoPID, PROTO_AM_PACK_SIZE);
if ammoPacks then begin
ammoObj := create_object(ammoPID, 0, 0);
set_weapon_ammo_count(ammoObj, ammoPacks);
add_obj_to_inven(dude_obj, ammoObj);
end
set_weapon_ammo_count(item, 0);
intface_redraw;
display_msg("You unloaded your weapon.");
end
end
end
end
end