stonefisher Posted July 8, 2017 Share Posted July 8, 2017 Hi can someone please help me. been looking for hours. I want to convert some scripts from working on anyone and not just the player. The scripts are attached to armour and weapons. I am trying to find a substitute to get the actor in place of Game.Getplayer() for the actor with that item equipped. Link to comment Share on other sites More sharing options...
shavkacagarikia Posted July 8, 2017 Share Posted July 8, 2017 It depends on events you are using. Link to comment Share on other sites More sharing options...
stonefisher Posted July 8, 2017 Author Share Posted July 8, 2017 (edited) Its for that pesky ghost armour script. I want to make it possible to run on anyone wearing it. I got this far and then lots of headscratching and googleing to get nothin. Works fine with Game.GetPlayer() in place of ActorRef 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 Event OnEquipped(Actor akActor) If (ActorRef.wornhaskeyword(CGXAMGhostX92GogglesAnimated)) Actor ActorRef = ?????????????????? RegisterForAnimationEvent(ActorRef, "WeaponDraw") RegisterForAnimationEvent(ActorRef, "WeaponSheathe") if (ActorRef.IsWeaponDrawn() == true) If (ActorRef.wornhaskeyword(CGXAMGhostX92GogglesUp)) AttachMod(CGXAM_mod_CourserGhostX92GogglesDown) ElseIF (ActorRef.wornhaskeyword(CGXAMGhostX92GogglesPulsingUp)) AttachMod(CGXAM_mod_CourserGhostX92GogglesPulsingDown) EndIf ElseIF (ActorRef.IsWeaponDrawn() == false) If (ActorRef.wornhaskeyword(CGXAMGhostX92GogglesDown)) AttachMod(CGXAM_mod_CourserGhostX92GogglesUp) ElseIF (ActorRef.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 If !(ActorRef.wornhaskeyword(CGXAMWearingGhostX92Goggles )) UnregisterForAnimationEvent(Game.GetPlayer(), "WeaponDraw") UnregisterForAnimationEvent(Game.GetPlayer(), "WeaponSheathe") EndIf EndIf EndEvent Edited July 8, 2017 by stonefisher Link to comment Share on other sites More sharing options...
shavkacagarikia Posted July 8, 2017 Share Posted July 8, 2017 When OnEquipped fires it's parameter comes with Actor which equipped it. So for your case:Actor ActorRef= akActor But that Actor declaration isn't needed tou can just use akActor parameter and call functions on it. Link to comment Share on other sites More sharing options...
stonefisher Posted July 8, 2017 Author Share Posted July 8, 2017 I put "Actor ActorRef = akActor" into my script and compiled it and got: Papyrus Compiler Version 2.8.0.4 for Fallout 4Copyright © ZeniMax Media. All rights reserved.Starting 1 compile threads for 1 files...Compiling "CGXAM_GhostGoggles.psc"...H:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(18,5): variable ActorRef is undefinedH:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(18,14): none is not a known user-defined script typeH:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(18,1): cannot cast a void to a bool to perform a condition checkH:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(39,5): variable ActorRef is undefinedH:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(39,14): none is not a known user-defined script typeH:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(40,18): variable ActorRef is undefinedH:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(41,7): variable ActorRef is undefinedH:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(41,16): none is not a known user-defined script typeH:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(43,11): variable ActorRef is undefinedH:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(43,20): none is not a known user-defined script typeH:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(43,3): cannot cast a void to a bool to perform a condition checkH:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(41,3): cannot cast a void to a bool to perform a condition checkH:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(46,22): variable ActorRef is undefinedH:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(47,7): variable ActorRef is undefinedH:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(47,16): none is not a known user-defined script typeH:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(49,11): variable ActorRef is undefinedH:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(49,20): none is not a known user-defined script typeH:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(49,3): cannot cast a void to a bool to perform a condition checkH:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(47,3): cannot cast a void to a bool to perform a condition checkH:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(39,1): cannot cast a void to a bool to perform a condition checkH:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(57,15): variable ActorRef is undefinedH:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(58,7): variable ActorRef is undefinedH:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(58,16): none is not a known user-defined script typeNo output generated for CGXAM_GhostGoggles.psc, compilation failed. Batch compile of 1 files finished. 0 succeeded, 1 failed.Failed on CGXAM_GhostGoggles.psc Removed that line and replaced all ActorRef with akActor and got: Papyrus Compiler Version 2.8.0.4 for Fallout 4Copyright © ZeniMax Media. All rights reserved.Starting 1 compile threads for 1 files...Compiling "CGXAM_GhostGoggles.psc"...H:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(38,5): variable akActor is undefinedH:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(38,13): none is not a known user-defined script typeH:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(39,18): variable akActor is undefinedH:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(40,7): variable akActor is undefinedH:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(40,15): none is not a known user-defined script typeH:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(42,11): variable akActor is undefinedH:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(42,19): none is not a known user-defined script typeH:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(42,3): cannot cast a void to a bool to perform a condition checkH:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(40,3): cannot cast a void to a bool to perform a condition checkH:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(45,22): variable akActor is undefinedH:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(46,7): variable akActor is undefinedH:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(46,15): none is not a known user-defined script typeH:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(48,11): variable akActor is undefinedH:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(48,19): none is not a known user-defined script typeH:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(48,3): cannot cast a void to a bool to perform a condition checkH:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(46,3): cannot cast a void to a bool to perform a condition checkH:\SteamLibrary\steamapps\common\Fallout 4\Data\Scripts\Source\User\CGXAM_GhostGoggles.psc(38,1): cannot cast a void to a bool to perform a condition checkNo output generated for CGXAM_GhostGoggles.psc, compilation failed. Batch compile of 1 files finished. 0 succeeded, 1 failed.Failed on CGXAM_GhostGoggles.psc Link to comment Share on other sites More sharing options...
shavkacagarikia Posted July 8, 2017 Share Posted July 8, 2017 First error was because you were trying to use ActorRef which was defined into event into other event. That's not how you do stuff, you should declare it out of the event. Second error: I said event comes with parameter and you cannot use that parameter out of that event body. Link to comment Share on other sites More sharing options...
stonefisher Posted July 8, 2017 Author Share Posted July 8, 2017 Aaaah I forgot they couldnt be transfered between events like that. I dont know how to declare it outside an event. I been looking for days on how to get the actor ref of an equiped item. I suspect it counts as being inside the actors container and I will try searching that next. Link to comment Share on other sites More sharing options...
texashokies Posted July 9, 2017 Share Posted July 9, 2017 Aaaah I forgot they couldnt be transfered between events like that. I dont know how to declare it outside an event. I been looking for days on how to get the actor ref of an equiped item. I suspect it counts as being inside the actors container and I will try searching that next.Make an actor property and assign it to the actor that you want to do stuff with. Link to comment Share on other sites More sharing options...
stonefisher Posted July 9, 2017 Author Share Posted July 9, 2017 I want it to work with anyone who wears it. would GetActorOwner() work? not that i can get it to work so far. Link to comment Share on other sites More sharing options...
texashokies Posted July 9, 2017 Share Posted July 9, 2017 I want it to work with anyone who wears it. would GetActorOwner() work? not that i can get it to work so far.Make an actor property call it what ever you want and leave it empty. Then in Event OnEquiped set this property to akActor and use the property throughout the script. Link to comment Share on other sites More sharing options...
Recommended Posts