hi ,
i have a gun with 2 bullets in its clip the clip it self have max place for 4 bullets , now my player find a new bullet just 1 , so how i can add it to the pool only not to the clip directly , i have this code that i'm using:
this one is according to
https://opsive.com/support/documentation/ultimate-character-controller/items-inventory/inventory/
another try is
but the result is same it push the new bullet directly to the clip even without reloading animation
i have a gun with 2 bullets in its clip the clip it self have max place for 4 bullets , now my player find a new bullet just 1 , so how i can add it to the pool only not to the clip directly , i have this code that i'm using:
string PistolWeaponBasePlayer = "PistolWeaponBasePlayer";
CharacterItemAction[] CharacterItemAction_PistolWeaponBasePlayer;
ListSlice<CharacterItem> characterItems = inventory.GetAllCharacterItems();
for (int y = 0; y < characterItems.Count; ++y)
{
if (characterItems[y].name == PistolWeaponBasePlayer)
{
CharacterItemAction_PistolWeaponBasePlayer = characterItems[y].ItemActions;
CharacterItemAction[] itemActions = characterItems[y].ItemActions;
print("itemActions= " + itemActions.Length);
var shootableAction = itemActions[0] as ShootableAction;
var ammoModuleGroup = shootableAction.AmmoModuleGroup;
print("ammoModuleGroup= " + ammoModuleGroup.ModuleCount);
var shootableAmmoModule1 = ammoModuleGroup.Modules[0] as Opsive.UltimateCharacterController.Items.Actions.Modules.Shootable.ShootableAmmoModule;
var shootableAmmoModule2 = ammoModuleGroup.Modules[1] as Opsive.UltimateCharacterController.Items.Actions.Modules.Shootable.ShootableAmmoModule;
shootableAmmoModule2.AdjustAmmoAmount(1);
}
this one is according to
https://opsive.com/support/documentation/ultimate-character-controller/items-inventory/inventory/
another try is
according to WillEquip() function in ReloaderModule.csshootableAction.MainAmmoModule.AdjustAmmoAmount(1);
but the result is same it push the new bullet directly to the clip even without reloading animation