Hi and thanks for your suggestion.
I have previously used "weaponfire" as a means for generating a "regenerating ammo" response. Like a lot of other methods, using that method has it's advantages and disadvantages.
For instance, I found that a player that uses Power Armor will 'break' a script using "weaponfire" unless there's a lot of additional scripting based on how Power Armor works within the game. Once the player enters Power Armor, the regenerating ammo effect will stop and won't continue again. I've been informed that there are ways to counteract this effect but I have yet to try it.
My current method uses a timer mechanism (OnTimer & StartTimer) that seems to work fairly well so far (except, of course, for the case of ammo that you can drop from the inventory)
Again, thanks for your suggestion.
Hey, sorry I didn't realize you couldn't attach scripts to ammo. For this case I would maybe attach a script to the weapon. You can make it so you only have a certain amount of ammo and check every time the weapon is fired with an animation event. Example script:
Ammo Property WeaponAmmo Auto Event OnEquipped(Actor akActor) RegisterForAnimationEvent(akActor, "weaponFire") CheckAmmo(akActor, WeaponAmmo) Endevent Event OnAnimationEvent(ObjectReference akSource, string asEventName) CheckAmmo(akSource, WeaponAmmo) EndEvent Event OnUnequipped(Actor akActor) UnRegisterForAnimationEvent(akActor, "weaponFire") EndEvent Function CheckAmmo(ObjectReference akSource, Ammo akAmmo) If akSource.GetItemCount(akAmmo) < 10 akSource.AddItem(akAmmo, 1, True) ;add 1 ammo silently Endif EndFunction
Again have the script extend ObjectReference