PoliteRaider Posted March 29, 2016 Share Posted March 29, 2016 (edited) Okay, I think I've got this sorted now. So I'm currently trying to get a visual effect working on my Decontamination booth and running into trouble. Most of the good visual effects I've seen in game are done with the MovableStatic type. I've been able to spawn a MovableStatic using 'Form' for the variable type in Papyrus and the placeatme command. Once I've created it though I can't seem to manipulate it any further. I've tried calling both disable and delete methods on the MovableStatic and nothing seems to work. The script compiles successfully in Caprica but then once I load Fallout the MovableStatic does get created, it just doesn't also disappear the way it should. Any suggestions as to how I can handle the MovableStatic? Even just letting me know about another script that works with this object type would be handy, I've had a look but haven't spotted one yet. Here's the latest version of my unsuccessful script for reference in case it helps. ScriptName DeconBoothScript extends ObjectReference ;-- Properties -------------------------------------- workshopparentscript Property WorkshopParent Auto Light Property InteriorLight Auto Hazard Property RadTrapHazard Auto Form Property InteriorMist Auto ;-- Variables --------------------------------------- ObjectReference myLight ObjectReference myHazard ObjectReference InteriorMist ;-- Functions --------------------------------------- Function OnLoad() Self as ObjectReference If (Self.getLinkedRef(None) == None) InteriorLight as Form RadTrapHazard as Form InteriorMist as Form myLight = Self.placeAtMe(::temp3, 1, False, False, True) myHazard = Self.placeAtMe(::temp5, 1, False, False, True) myMist = Self.placeAtMe(::temp6, 1, False, False, True) myLight.moveTo(Self as ObjectReference, 0, 0, 190, True) Else myLight = Self.getLinkedRef(None) myHazard = Self.getLinkedRef(None) EndIf If (Self.getOpenState() == 1) myLight.enable(False) myMist.enable(False) myHazard = Self.placeAtMe(::temp5, 1, False, False, True) ElseIf (Self.getOpenState() == 3) myLight.disable(False) myHazard.delete() myMist.delete() EndIf EndFunction Function OnActivate(ObjectReference akActionRef) RadTrapHazard as Form InteriorMist as Form If (akActionRef == Game.getPlayer() as ObjectReference) int openState = Self.getOpenState() If (openState == 2) If (Self.getDistance(Game.getPlayer() as ObjectReference) > 55) Utility.wait(1) myLight.enable(False) myHazard = Self.placeAtMe(::temp5, 1, False, False, True) myMist.enable(False) EndIf ElseIf (Self.getOpenState() == 4) If (Self.getDistance(Game.getPlayer() as ObjectReference) > 55) myLight.disable(False) myHazard.delete() myMist.disable(False) EndIf EndIf EndIf EndFunction Function OnOpen(ObjectReference akActionRef) Self.blockActivation(False, False) If (akActionRef == Game.getPlayer() as ObjectReference) If (Self.getDistance(Game.getPlayer() as ObjectReference) > 55) Self.registerforDistanceLessThanEvent(Self as ScriptObject, Game.getPlayer() as ScriptObject, 55) Else Self.registerforDistanceGreaterThanEvent(Self as ScriptObject, Game.getPlayer() as ScriptObject, 64) EndIf EndIf EndFunction Function OnDistanceLessThan(ObjectReference akObj1, ObjectReference akObj2, float afDistance) Self.setOpen(False) Self.blockActivation(True, False) Utility.wait(2) Self.blockActivation(False, False) EndFunction Function OnDistanceGreaterThan(ObjectReference akObj1, ObjectReference akObj2, float afDistance) myLight.disable(False) myHazard.delete() myMist.disable(False) Utility.wait(0.5) Self.setOpen(False) EndFunction Function OnUnload() Self.unregisterForDistanceEvents(Self as ScriptObject, Game.getPlayer() as ScriptObject) EndFunction Function OnWorkshopObjectDestroyed(ObjectReference akActionRef) myHazard.delete() myLight.disable(False) myMist.disable(False) EndFunction Function OnWorkshopObjectMoved(ObjectReference akReference) myHazard.delete() myHazard = Self.placeAtMe(::temp5, 1, False, False, True) myLight.moveTo(Self as ObjectReference, 0, 0, 190, True) EndFunction Edited March 29, 2016 by PoliteRaider Link to comment Share on other sites More sharing options...
Reneer Posted March 29, 2016 Share Posted March 29, 2016 Uhhh... why are you coding the script like that? Use Champollion to decode the PEX scripts instead of Caprica and rewrite your script in Papyrus code instead of trying to write it in Papyrus Assembly. Link to comment Share on other sites More sharing options...
PoliteRaider Posted March 29, 2016 Author Share Posted March 29, 2016 (edited) Uhhh... why are you coding the script like that? Use Champollion to decode the PEX scripts instead of Caprica and rewrite your script in Papyrus code instead of trying to write it in Papyrus Assembly. *facepalms* Trust me to be doing things backwards. That's how I've been doing all my coding. I'll give it a try with Champollion and not make it quite so difficult on myself. Edit: I downloaded Champollion a while back, but never took the time to actually learn to use it. Edited March 29, 2016 by PoliteRaider Link to comment Share on other sites More sharing options...
PoliteRaider Posted March 29, 2016 Author Share Posted March 29, 2016 (edited) Okay, so I've converted it to .psc and put that in the first post spoilerblock. I'll see if I can get it working this way instead. Edit: Oh, also the code's a little broken from being passed around between compilers so many times, like a piece of text that's gone through google translate in a lot of different languages. I'm aware of that and fixing it now. Edited March 29, 2016 by PoliteRaider Link to comment Share on other sites More sharing options...
PoliteRaider Posted March 29, 2016 Author Share Posted March 29, 2016 Thanks, I think I've figured out what was causing the problem. Using .psc does make it easier to figure some of this out, although I've kinda gotten used to working in .pas. Thankyou Reneer. I think the problem was that by casting the MSST as a form, rather than an object reference it lacked both the delete and the disable method. It was an inheritance problem. Link to comment Share on other sites More sharing options...
Reneer Posted March 29, 2016 Share Posted March 29, 2016 Glad to hear you figured it out! :) Link to comment Share on other sites More sharing options...
Recommended Posts