stonefisher Posted July 9, 2017 Author Share Posted July 9, 2017 Well it compiled thx. now to go test it out. Link to comment Share on other sites More sharing options...
SMB92 Posted July 9, 2017 Share Posted July 9, 2017 I usually use Actor Property PlayerRef Auto Const for anytime I use the PlayerRef more than once/twice in my scripts. You can also look at filling aliases if you want to go that far but just making the single actor a property is good enough IMO. Link to comment Share on other sites More sharing options...
stonefisher Posted July 9, 2017 Author Share Posted July 9, 2017 "Actor Property ActorRef Auto" worked perfectly thank you. It seems all so obvious once you know but it has been driving me crazy for days. :) Link to comment Share on other sites More sharing options...
SMB92 Posted July 9, 2017 Share Posted July 9, 2017 Haha yeah its like that with code. It's a real epiphany when you final get it :D. Have fun! Link to comment Share on other sites More sharing options...
TheDungeonDweller Posted July 9, 2017 Share Posted July 9, 2017 (edited) "Actor Property ActorRef Auto" worked perfectly thank you. It seems all so obvious once you know but it has been driving me crazy for days. :smile:Yeah that compiled, but I'm waiting for you to come back and say it doesn't work in game, then I can say because that property is either none(if you don't set it) or you set it to a specific actor(to which the script will then only run if that specific actor is equipping it.) You could have simply used akActor straight from the Event so that it knows to work on ANY actor that equips the object. So I think you missunderstood SMB92's post. His example is the alternative to using Game.GetPlayer().. and you need to fill it with PlayerRef. Actor property ActorRef auto = either an actor set in the CK or <none>.. so the event will spit an error out saying "can't so and so to a none actor". So I made some changes to your original script. Not compiled but the general idea is all there. Scriptname CGXAM_GhostGoggles extends ObjectReference Armor Property CGXAM_CourserGhostX92Goggles Auto Keyword property CGXAMGhostX92GogglesDown auto Keyword property CGXAMGhostX92GogglesUp auto Keyword property CGXAMGhostX92GogglesPulsingDown auto Keyword property CGXAMGhostX92GogglesPulsingUp auto Keyword property CGXAMGhostX92GogglesAnimated auto Keyword property CGXAMWearingGhostX92Goggles auto ObjectMod Property CGXAM_mod_CourserGhostX92GogglesDown Auto ObjectMod Property CGXAM_mod_CourserGhostX92GogglesUp Auto ObjectMod Property CGXAM_mod_CourserGhostX92GogglesPulsingDown Auto ObjectMod Property CGXAM_mod_CourserGhostX92GogglesPulsingUp Auto Actor ActorRef ; YOU NEED THIS VARIABLE SO YOU CAN USE THE EQUIPPING ACTOR VAR IN THE ANIMATION EVENT Event OnEquipped(Actor akActor) ; Use akActor in this event block because the script will know its for any actor. ActorRef = akActor ; For use in the Animation Event block. If (akActor.wornhaskeyword(CGXAMGhostX92GogglesAnimated)) RegisterForAnimationEvent(ActorRef, "WeaponDraw") RegisterForAnimationEvent(ActorRef, "WeaponSheathe") if (akActor.IsWeaponDrawn() == true) If (akActor.wornhaskeyword(CGXAMGhostX92GogglesUp)) AttachMod(CGXAM_mod_CourserGhostX92GogglesDown) ElseIF (akActor.wornhaskeyword(CGXAMGhostX92GogglesPulsingUp)) AttachMod(CGXAM_mod_CourserGhostX92GogglesPulsingDown) EndIf ElseIF (akActor.IsWeaponDrawn() == false) If (akActor.wornhaskeyword(CGXAMGhostX92GogglesDown)) AttachMod(CGXAM_mod_CourserGhostX92GogglesUp) ElseIF (akActor.wornhaskeyword(CGXAMGhostX92GogglesPulsingDown)) AttachMod(CGXAM_mod_CourserGhostX92GogglesPulsingDown) EndIf EndIf EndIf EndEvent Event OnAnimationEvent(ObjectReference akSource, string asEventName) If (ActorRef.wornhaskeyword(CGXAMGhostX92GogglesAnimated)) if (akSource == ActorRef) && (asEventName == "WeaponDraw") If (ActorRef.wornhaskeyword(CGXAMGhostX92GogglesUp)) AttachMod(CGXAM_mod_CourserGhostX92GogglesDown) ElseIF (ActorRef.wornhaskeyword(CGXAMGhostX92GogglesPulsingUp)) AttachMod(CGXAM_mod_CourserGhostX92GogglesPulsingDown) EndIf ElseIf (akSource == ActorRef) && (asEventName == "WeaponSheathe") If (ActorRef.wornhaskeyword(CGXAMGhostX92GogglesDown)) AttachMod(CGXAM_mod_CourserGhostX92GogglesUp) ElseIF (ActorRef.wornhaskeyword(CGXAMGhostX92GogglesPulsingDown)) AttachMod(CGXAM_mod_CourserGhostX92GogglesPulsingUp) EndIf EndIf EndIf endEvent Event OnUnequipped(Actor akActor) if akActor == ActorRef ; WILL CHECK IF ACTORREF IS THE SAME ACTOR THAT EQUIPPED THIS. If !(ActorRef.wornhaskeyword(CGXAMWearingGhostX92Goggles )) UnregisterForAnimationEvent(Game.GetPlayer(), "WeaponDraw") UnregisterForAnimationEvent(Game.GetPlayer(), "WeaponSheathe") EndIf EndIf EndEvent Edited July 9, 2017 by TheDungeonDweller Link to comment Share on other sites More sharing options...
stonefisher Posted July 9, 2017 Author Share Posted July 9, 2017 Yep, set to none in creation kit, works perfectly in game still. Link to comment Share on other sites More sharing options...
Recommended Posts