[Issue] Script Works fine Once.

Post » Tue Jan 01, 2013 7:02 pm

I am not amazing at coding but i do enjoy doing it and seeing the results, and i have come across some annoying issues, I have these two scripts, one that controls the effects and the other that controls the menu + some minor effects, the issue is when in game it works all perfectly once and then keeps failing after....

What the Scripts are for: http://www.gamesas.com/topic/1434022-show-us-what-youre-working-on-thread-6/page__view__findpost__p__22011476

(I tried uses OnTranslationComplete but couldn't get it to work.)

I warn you know, seeing as im not amazing at coding, it may seem messy to you.

effect script;

Scriptname MODNToRInner extends ObjectReference import gameimport debugimport utility;Static ObjectsObjectReference property MagicOrb1 autoObjectReference property MagicOrb2 autoObjectReference property MagicOrb3 autoObjectReference property MagicOrb4 auto;Animated Static ObjectsObjectReference property MagicEffect01 auto;EffectsSpell Property MagicExpo auto;ReferencesObjectReference property XMarkerUP autoObjectReference property XMarkerDOWN autoObjectReference property Heading auto;Player ReferenceActor Property PlayerRef Auto;GlobalVarGlobalVariable Property MODGlobal auto  ;GlobalGlobalVariable Property MODTeleOK auto  ;Global;************************************auto State waiting;Event OnBeginState();endEvent Event onTriggerEnter(objectReference akActionRef)  utility.wait(2.0)  ;if(akActionRef == PlayerRef)   if(MODGlobal.GetValue() == 1)      MagicOrb1.enable()    MagicOrb2.enable()    MagicOrb3.enable()    MagicOrb4.enable()    self.disable()       Game.DisablePlayerControls(true, true, false, true, false, false, true)    Game.ForceThirdPerson()    PlayerREF.TranslateToRef(XmarkerDown,300)       utility.wait(2.0)    PlayerREF.StopTranslation()    MagicExpo.Cast(XMarkerUP,PlayerREF)    utility.wait(1.0)    PlayerREF.SetAlpha(0.0)    PlayerREF.SetGhost(True)    MagicEffect01.enable()    utility.wait(3.0)    PlayerRef.TranslateToRef(XmarkerUP,300)    MagicEffect01.TranslateToRef(XmarkerUP,300)    Game.FadeOutGame(true, true, 3.6, 2.6)  	 utility.wait(2.5)	 MODTeleOK.setValue(1)	 GoToState("alldone")   endif  endEventendState;************************************State allDoneEvent OnBeginState();endEvent;Event onTriggerLeave(objectReference akActionRef)  ;if(akActionRef == PlayerRef)    utility.wait(3.0)    MagicOrb1.disable()    MagicOrb2.disable()    MagicOrb3.disable()    MagicOrb4.disable()    utility.wait(3.0)    GoToState("waiting")   ;endifendEventendState

Menu Script:

Scriptname MODNToRMenuSystem extends ObjectReference import gameimport debugimport utility;City HeadingsObjectReference property WRHeading auto  ;WhiterunObjectReference property WHHeading auto  ;WindHelmObjectReference property WTHeading auto  ;WinterHoldObjectReference property DSHeading auto  ;DawnStarObjectReference property FAHeading auto  ;FalkreathObjectReference property SOHeading auto  ;SolitudeObjectReference property MAHeading auto  ;MarkarthObjectReference property MOHeading auto  ;MorthalObjectReference property RIHeading auto  ;Riften;-----ObjectReference property Dest auto;City VarsGlobalVariable Property MODGlobal auto  ;GlobalGlobalVariable Property MODTeleOK auto  ;Global;MenuMessage Property MODMenuSystemP1 AutoMessage Property MODMenuSystemP2 Auto;Player ReferenceActor Property PlayerRef Auto;Reset ObjectsObjectReference property MagicEffect01 autoObjectReference property XMarkerDOWN auto;Effects;Spell Property MagicExpo autoauto State waiting;Event OnBeginState();endEvent EVENT onTriggerEnter(objectReference akActionRef)  int buttonSelected  IF(akActionRef == PlayerRef)   buttonSelected = MODMenuSystemP1.Show()	   if (buttonSelected == 0)	  ;Whiterun	 ;MODWRVar.SetValue(1)	 MODGlobal.SetValue(1)	 Dest = WRHeading	 GoToState("teleport")    elseIf (buttonSelected == 1)  ;WindHelm	 ;MODWHVar.SetValue(1)	 MODGlobal.SetValue(1)	 Dest = WHHeading	 GoToState("teleport")    elseIf (buttonSelected == 2)  ;WinterHold	 ;MODWTVar.SetValue(1)	 MODGlobal.SetValue(1)	 Dest = WTHeading	 GoToState("teleport")    elseIf (buttonSelected == 3)  ;DawnStar	 ;MODDSVar.SetValue(1)	 MODGlobal.SetValue(1)	 Dest = DSHeading	 GoToState("teleport")    elseIf (buttonSelected == 4)  ;Falkreath	 ;MODFAVar.SetValue(1)	 MODGlobal.SetValue(1)	 Dest = FAHeading	 GoToState("teleport")    elseIf (buttonSelected == 5)  ;-Next	 buttonSelected = MODMenuSystemP2.Show()	  if (buttonSelected == 0) ;-Prev	   buttonSelected = MODMenuSystemP1.Show()	  elseIf (buttonSelected == 1)  ;Solitude	   ;MODSOVar.SetValue(1)	   MODGlobal.SetValue(1)	   Dest = SOHeading	   GoToState("teleport")	  elseIf (buttonSelected == 2)  ;Markarth	   ;MODMAVar.SetValue(1)	   MODGlobal.SetValue(1)	   Dest = MAHeading	   GoToState("teleport")	  elseIf (buttonSelected == 3)  ;Morthal	   ;MODMOVar.SetValue(1)	   MODGlobal.SetValue(1)	   Dest = MOHeading	   GoToState("teleport")	  elseIf (buttonSelected == 4)  ;Riften	   ;MODRIVar.SetValue(1)	   MODGlobal.SetValue(1)	   Dest = RIHeading	   GoToState("teleport")	  elseIf (buttonSelected == 5)  ;-Exit	   MODGlobal.SetValue(0)	  endIF    endIf  endIF endEVENTendSTATEState teleportEvent OnBeginState()utility.wait(6.0)if(MODGlobal.GetValue() == 1 && MODTeleOK.GetValue() == 1)  PlayerREF.StopTranslation()  MagicEffect01.StopTranslation()  Game.FastTravel(Dest)  MODGlobal.SetValue(0)  MODTeleOK.setValue(0)   Self.enable()   PlayerREF.SetAlpha(1.0)   PlayerREF.SetGhost(False)   Game.EnablePlayerControls()   MagicEffect01.MoveTo(XMarkerDown)   MagicEffect01.disable()  GoToState("waiting")  else  GoToState("loop")endifendEventendStateState loopEvent OnBeginState()GoToState("teleport")endEventendState

Please point to where i have messed up or tidy the script up either way i would be greatly thankful!
User avatar
Horse gal smithe
 
Posts: 3302
Joined: Wed Jul 05, 2006 9:23 pm

Post » Tue Jan 01, 2013 2:23 pm

You've commented out some code, why is that?

OnTranslationComplete events will only get sent from objects that do any translating. For example, you can't have an activator tell a static to translate, and then expect to receive that event within the script on the activator...

Have you tried adding Debug.Notification's to various stages of your code? It does wonders helping you figure out where things may be going wrong......
User avatar
mollypop
 
Posts: 3420
Joined: Fri Jan 05, 2007 1:47 am

Post » Tue Jan 01, 2013 11:09 am

You've commented out some code, why is that?

If parts of the code are commented out its because i was either trying a different method and/or saving it for later.

OnTranslationComplete events will only get sent from objects that do any translating. For example, you can't have an activator tell a static to translate, and then expect to receive that event within the script on the activator...

I'm not sure I understand what you just said there, I understand that OnTranslationComplete with only happen when the translation is complete yes? but what your saying is that i should have OnTranslationComplete on the actually object that is moving? I suppose that does make alot more sense :S
User avatar
Marion Geneste
 
Posts: 3566
Joined: Fri Mar 30, 2007 9:21 pm


Return to V - Skyrim