Spoiler
Scriptname reallyalteredFireWeaponScript extends ObjectReference {Script for firing projectiles from FireWeaponMarker-The default setting is to fire whatever weapon/ammo you, every 4-6 seconds, if the marker is enabled-If you just want it to fire once then set MinWaitTime to 0.0, MaxWaitTime to 0.1, and TimesFired to 1import utilityimport weaponimport debug;---------------------------;--Hidden Properties;---------------------------int Property TimesFired Auto Hidden{How many times i've already fired}Function Fire(ObjectReference akWeapon, Ammo akAmmo = None) Nativefloat Property WaitTimer Auto hidden{Rand wait time generated based on the Min and Max wait times};---------------------------;--Editable Properties;---------------------------int Property TimesToFire = -1 Auto{Maximum number of times you want this to fire once it's enabled. (-1 = until disabled)}float Property MaxWaitTime = 6.0 auto{Maximum wait between refire, Default = 6.0}float Property MinWaitTime = 4.0 auto{Minimum wait between refire, Default = 4.0}weapon Property Weapontype Auto{Type of weapon you want to fire, (ie. "HuntingBow")}ammo Property Ammotype Auto{Type of ammo you would like to fire, (ie. "IronArrow")}Message Property FailureMessage Auto {Message to say why you can't use this}Projectile Property m16a2ammoprojectile AutoEvent OnLoad() BlockActivation(true)endEventEvent OnUnload() ; safety measure UnregisterForEvents()endEventauto STATE normalEvent OnActivate(ObjectReference akActionRef) gotoState("busy"); debug.trace(self + "OnActivate") if akActionRef == Game.GetPlayer() ; check if player has m16a2 if Game.GetPlayer().GetItemCount(weapontype) > 0 RegisterForEvents(); ; debug.trace(self + "player activation START") Activate(akActionRef, true); ; debug.trace(self + "player activation END") else FailureMessage.Show() endif endif gotoState("normal")endEventendStateSTATE busy ; do nothingendStateEvent OnAnimationEvent(ObjectReference akSource, string asEventName); debug.trace(self + ": animation event received=" + asEventName) if asEventName == "Fire" WeaponType.fire( self as objectReference, Ammotype) ;I'm enabled so fire. endifendEventbool isRegisteredForEvents = falsefunction RegisterForEvents() ; centralize this isRegisteredForEvents = true RegisterForAnimationEvent(Game.GetPlayer(), "Fire")endFunctionfunction UnregisterForEvents() ; centralize this if isRegisteredForEvents isRegisteredForEvents = false UnRegisterForAnimationEvent(Game.GetPlayer(), "Fire") endifendFunction 
