Closed nirran closed 1 year ago
I think you can check the total copies of the unloaded weapon in player's inventory, remove all old copies, create a new weapon object and set its ammo count to 0 (since the weapon is "unloaded"), and re-add the same amount of weapons back to the inventory. It should be a single stack of the empty weapon.
Something like this:
obj := create_object(unloaded_weapon_pid, 0, 0);
set_weapon_ammo_count(obj, 0);
add_mult_objs_to_inven(dude_obj, obj, unloaded_weapon_amount);
ok ill try thnx
edit : ok this seems to be working,added in the unload function
item_ptr := create_object(obj_pid(item), 0, 0); rm_obj_from_inven(dude_obj, item); destroy_object(item); set_weapon_ammo_count(item_ptr, 0); add_obj_to_inven(dude_obj, item_ptr); set_weapon_ammo_count(item, 0); sfall_func0("intface_redraw"); display_msg("You unloaded your " + obj_name(item));
thxn for help nova
edit : this is better IMO
set_weapon_ammo_count(item, 0); rm_obj_from_inven(dude_obj, item); add_mult_objs_to_inven(dude_obj, item, 1); display_msg("You unloaded your " + obj_name(item)); sfall_func0("intface_redraw");
edit : seesm to work correctly,il close the topic,reserving the right to coment again
as title says
i have a script that unloada ll weapons in dude inven,but if inven has a stack of unloaded same weapons,engine does not stack them,it creates a new stack,nothing is lost but kinda buggs,can provide save to test if u ask,this script will unload on press 'h' autoloot.zip
asking for scripting command to restack items in inven