icecreamassassin Posted March 30, 2017 Share Posted March 30, 2017 I have a parent script: Scriptname DBM_AirshipScript extends ObjectReference ImagespaceModifier Property AzuraFadeToBlack Auto ImagespaceModifier Property FadeToBlackBackIMod Auto ImagespaceModifier Property FadeToBlackHoldIMod Auto GlobalVariable Property GameHour Auto ObjectReference Property ShipRef auto ObjectReference property PlayerMark auto FormList Property ShipList Auto Int Property ReadyState Auto Event OnActivate (ObjectReference akActionRef) if akActionRef == Game.GetPlayer() if ReadyState == 0 Debug.notification("You must set a heading first") Elseif ReadyState == 1 ShipREF.Enable() FadeOut() Game.GetPlayer().MoveTo(PlayerMark) FadeIn() Utility.Wait(2) ResetShipREFS() GoToState("Waiting") endif Endif EndEvent Function ResetShipREFS() Int Index = ShipList.GetSize() While Index index -= 1 ObjectReference O = ShipList.GetAt(Index) as ObjectReference if O != ShipREF Disable() Endif EndWhile EndFunction Function FadeOut() Game.DisablePlayerControls(true, true, true, true, true, false, true, true) AzuraFadeToBlack.Apply() Utility.Wait(2) Game.FadeOutGame(False,True,50, 1) Gamehour.Value += 4 EndFunction Function FadeIn() Game.FadeOutGame(False,True,0.1, 0.1) AzuraFadeToBlack.PopTo(FadeToBlackBackImod) Utility.Wait(2) Game.EnablePlayerControls() EndFunctionand I have a child script that extends this script: Scriptname DBM_NavigateScript extends DBM_AirshipScript Message Property MyMSG Auto ; point to a MESSAGE form that states "Heading set for (NAME)" DBM_AirshipScript Property ParentScript Auto Hidden ObjectReference Property Ship Auto ObjectReference Property Mark Auto Event OnActivate (ObjectReference akActionRef ) If akActionRef == Game.GetPlayer() ShipREF = Ship PlayerMark = Mark ReadyState = 1 MyMSG.Show() endif endeventLiterally all the child script does is takes whatever properties you have set manually in it and is supposed to change the properties in the parent script with the values and it is supposed to change the ReadyState Int property to 1 but every time I test, the child script activator works fine and gives me the specified message but fails to set the INT on the parent script. Which leads me to think it's also failing to fill the objectreferences. What the hell am I missing? I am almost certain I have the ReadyState = 1 command right. I have even tried to property the parent script and call DBM_AirshipScript.Readystate = 1 and it does nothing. It's late and I burnt my brain out on an entirely separate attempt before realizing I could get the results I wanted in this, a much simpler method but it's defying logic to me. Every time I test, it gives me the message that I must set the heading, so Readystate won't change from 0. Thanks in advance. Link to comment Share on other sites More sharing options...
icecreamassassin Posted March 30, 2017 Author Share Posted March 30, 2017 Should I be removing the extends state of the child script and setting it to extend objectreference instead and just call changes remotely via property assigned script (DBM_AirshipScript.ReadyState = 1)? Link to comment Share on other sites More sharing options...
icecreamassassin Posted March 31, 2017 Author Share Posted March 31, 2017 never was able to figure this out, so I went with a formlist handled method which works perfectly. But I would like to know if this is possible if anyone knows. Thanks Link to comment Share on other sites More sharing options...
PeterMartyr Posted March 31, 2017 Share Posted March 31, 2017 (edited) I don't profess to be expert in these matters, but I have extended a few scripts (one), I can honesty say I never try to a change a value in the parent as well. I can say that you don't need to define the parent in the child as a Property Value, I call on it using Parent If(Parent.xxxxx) Parent.somefunction() Like I said, I've never try to Parent.Number = 2 Simply cause I never had a need too. So if you don't mind I like to tag along for ride since I too wondered about this. But my common sense is telling me to try adding in the appropriate spot Parent.OnActivate(akActionRef) Event OnActivate (ObjectReference akActionRef ) If akActionRef == Game.GetPlayer() ShipREF = Ship PlayerMark = Mark Parent.ReadyState = 1 Parent.OnActivate(akActionRef) MyMSG.Show() endif endevent Like I said, I soo don't profess to a expert in these lofty matters, but I'm always open to making a fool of my myself. :laugh: Plus whenever I get involved in posts by my better, I always finish off with a "be kind I'm self taught." Edited March 31, 2017 by PeterMartyr Link to comment Share on other sites More sharing options...
ReDragon2013 Posted March 31, 2017 Share Posted March 31, 2017 As I told you last time, you don't really understand the difference between script variables/properties and function variables.Additionally you made a real mistake. The event OnActivate() in parent script cannot trigger, if the child script is in the same stateas parent script and has the same event here. Take a look in Bethesda wiki: http://www.creationkit.com/index.php?title=States_(Papyrus) In hope you want to learn new things about papyrus scripting, my changes as follow: child script: DBM_NavigateScript Scriptname DBM_NavigateScript extends DBM_AirshipScript ; https://forums.nexusmods.com/index.php?/topic/5495932-stumped-on-a-script/ Message Property MyMSG auto ; point to a MESSAGE form that states "Heading set for (NAME)" ObjectReference Property Ship auto ObjectReference Property Mark auto ; -- EVENTs -- EVENT OnActivate(ObjectReference akActionRef) IF akActionRef == Game.GetPlayer() gotoState("Action") ; ### STATE ### myF_MovePlayer(Ship, Mark, MyMSG) ; see parent script Utility.Wait(2.0) ResetShips(Ship) ; see parent script gotoState("") ; ### STATE ### back to empty state ENDIF ENDEVENT ;=========================== state Busy ;========= EVENT OnActivate(ObjectReference akActionRef) ENDEVENT ;======= endState parent script: DBM_AirshipScript Scriptname DBM_AirshipScript extends ObjectReference GlobalVariable Property GameHour auto ImagespaceModifier Property AzuraFadeToBlack auto ImagespaceModifier Property FadeToBlackBackIMod auto ImagespaceModifier Property FadeToBlackHoldIMod auto FormList Property ShipList auto ; -- EVENT -- EVENT OnActivate(ObjectReference akActionRef) if akActionRef == Game.GetPlayer() Debug.Notification("I am the parent script! Bad activation..") Endif ENDEVENT ; -- FUNCTIONs -- 4 FUNCTION FadeOut() ;----------------- Game.DisablePlayerControls(true, true, true, true, true, false, true, true) AzuraFadeToBlack.Apply() Utility.Wait(2.0) Game.FadeOutGame(False, TRUE, 50.0, 1.0) ; your version, seems to be strange !! ; http://www.creationkit.com/index.php?title=FadeOutGame_-_Game ;;; Game.FadeOutGame(TRUE, TRUE, 5.0, 1.0) ; why not? abFadingOut: Fades game out if true ; afSecsBeforeFade: Number of seconds to wait before starting the fade-out / -in float f = GameHour.GetValue() + 4.0 Gamehour.SetValue(f) ENDFUNCTION FUNCTION FadeIn() ;---------------- Game.FadeOutGame(False, TRUE, 0.1, 0.1) ; 0.1 sec fading in AzuraFadeToBlack.PopTo(FadeToBlackBackImod) ; bugfix for "black/white screen is instantly removed after the fade-in" Utility.Wait(2.0) Game.EnablePlayerControls() ENDFUNCTION FUNCTION myF_MovePlayer(ObjectReference shipRef, ObjectReference mRef, Message msg) ;---------------------------------------------------------------------------------- msg.Show() shipRef.Enable() FadeOut() Game.GetPlayer().MoveTo(mRef) FadeIn() ENDFUNCTION FUNCTION ResetShips(ObjectReference shipRef) ;------------------------------------------- int i = ShipList.GetSize() WHILE (i > 0) i = i - 1 objectReference oRef = ShipList.GetAt(i) as ObjectReference IF (!oRef) || (oRef == ShipRef) ELSE self.Disable() ENDIF ENDWHILE ENDFUNCTION Link to comment Share on other sites More sharing options...
Recommended Posts