Stargate Script Help

Post » Thu Jun 21, 2012 4:51 am

Hey, I am not really all that great at scripting in any form but I have most of the basic concepts down, I have been trying for the past day or so to get the following script working and so far it seems to be doing most of the script right but seems to be sprinting through other parts when it isn't supposed to and some thing just not happening at all, this is my first script in papyrus so I am expecting this to be something stupid that I have done wrong.

Scriptname SkyFiDHDCheyenneScript extends ObjectReference{DHD Activator in Cheyenne}Int GateStatus = 0String CurrentLocationObjectReference Property PuddleX autoObjectReference Property Puddle2X autoObjectReference Property ForestWorldX autoObjectReference Property DesertWorldX autoObjectReference Property WaterWorldX autoObjectReference Property DestinyX autoObjectReference Property AncientCityX autoMessage Property SkyFiDHDCheyenneMESG AutoFunction GateStatusCheck()if (GateStatus == 1)  GateClose()elseif (GateStatus == 0)  GateDial()endifEndFunctionFunction GateDial()Debug.Notification("Dialing...")Int iButton = SkyFiDHDCheyenneMESG.Show() ; Shows your menu.If (iButton != -1) ; Wait for input  If (iButton == 0)  ; Cancel     GateClose()   GateStatus = 0    ElseIf (iButton == 1) ; Forest World     GateStatus = 1   ForestWorldEnable()    ElseIf (iButton == 2) ; Desert World     GateStatus = 1   DesertWorldEnable()    ElseIf (iButton == 3) ; Water World     GateStatus = 1   WaterWorldEnable()    ElseIf (iButton == 4) ; Destiny     GateStatus = 1   DestinyEnable()    ElseIf (iButton == 5) ; Ancient City     GateStatus = 1   AncientCityEnable()    EndIfEndIfEndFunctionFunction GateClose()GateStatus = 0PuddleX.DisableNoWait(true)Puddle2X.DisableNoWait(true)ForestWorldX.DisableNoWait(false)DesertWorldX.DisableNoWait(false)WaterWorldX.DisableNoWait(false)DestinyX.DisableNoWait(false)AncientCityX.DisableNoWait(false)EndFunctionFunction ForestWorldEnable()Debug.Notification("...Connection Successful")ForestWorldX.EnableNoWait(false)PuddleX.EnableNoWait(true)Puddle2X.EnableNoWait(true)Utility.Wait(38)GateClose()EndFunctionFunction DesertWorldEnable()Debug.Notification("...Connection Successful")DesertWorldX.EnableNoWait(false)PuddleX.EnableNoWait(true)Puddle2X.EnableNoWait(true)Utility.Wait(38)GateClose()EndFunctionFunction WaterWorldEnable()Debug.Notification("...Connection Successful")WaterWorldX.EnableNoWait(false)PuddleX.EnableNoWait(true)Puddle2X.EnableNoWait(true)Utility.Wait(38)GateClose()EndFunctionFunction DestinyEnable()Debug.Notification("...Connection Successful")DestinyX.EnableNoWait(false)PuddleX.EnableNoWait(true)Puddle2X.EnableNoWait(true)Utility.Wait(38)GateClose()EndFunctionFunction AncientCityEnable()Debug.Notification("...Connection Successful")AncientCityX.EnableNoWait(false)PuddleX.EnableNoWait(true)Puddle2X.EnableNoWait(true)Utility.Wait(38)GateClose()EndFunctionEvent OnActivate(ObjectReference akActionRef)GateStatusCheck()EndEvent

The Object references are supposed to be Door objects, which are enabled and disabled to travel to other worlds through the stargate, this is the best way I thought of doing it and really could be the worst way for all I know. The timer doesnt seem to work, or I have done it wrong, the door doesnt enable after disabling, and I am totally lost, I have tried Enable and Disable without the NoWait part but that doesnt do anything different, every time I have tested I have started a new game and coc'd into the cell to test so i am pretty sure there is nothing to do with save games causing problems.

Any help you can give is very much welcome and dont be hesitant in telling me I have done it totally wrong. Also the first if statement to find out if the gate is already open or not works fine as far as I can tell it is mainly just the options menu and the stargate not opening properly that seems to be the problem.
User avatar
Crystal Clarke
 
Posts: 3410
Joined: Mon Dec 11, 2006 5:55 am

Post » Wed Jun 20, 2012 10:42 pm

So the player will be searching for the seventh symbol eh?
User avatar
Josephine Gowing
 
Posts: 3545
Joined: Fri Jun 30, 2006 12:41 pm

Post » Thu Jun 21, 2012 6:49 am

Hehe, not quite, that was the storyline I had set up for Oblivion (which I am planning to go back to after Skyrim). Check out SkyFi on ModDB if you are interested in the mod, if anyone helps me out with this script then I will have the beta out on steam workshop soon after.
User avatar
sam
 
Posts: 3386
Joined: Sat Jan 27, 2007 2:44 pm

Post » Thu Jun 21, 2012 1:48 am

Anyone?
User avatar
Matthew Barrows
 
Posts: 3388
Joined: Thu Jun 28, 2007 11:24 pm

Post » Thu Jun 21, 2012 1:46 am

Well I haven't done anything with messageboxes with button responses yet, but from what I can see, you are trying to call one of a number of functions based on which button the player clicked on the DHD popup?

Checking to see if I'm understanding it right...the "Puddles" are the visible gate portals (No kawoosh?) and the others are the "doors" to the various destinations that you enable when it's open to wherever?

Try putting some more notifications in there to verify you're actually getting to the right code. For example instead of identical "...Connection Successful" notifications, say which one it's trying to connect to in the notification.
User avatar
Ella Loapaga
 
Posts: 3376
Joined: Fri Mar 09, 2007 2:45 pm

Post » Thu Jun 21, 2012 11:30 am

you should run an enable check function instead of a variable because the enable check it is 100% reliable, whereas variables or even properties are not. (this is likely where your code is misfiring)
you should also clean up your functions into one, and pass the reference each time you access the single function.



Scriptname SkyFiDHDCheyenneScript extends ObjectReference{DHD Activator in Cheyenne}String CurrentLocationObjectReference Property PuddleX autoObjectReference Property Puddle2X autoObjectReference Property ForestWorldX autoObjectReference Property DesertWorldX autoObjectReference Property WaterWorldX autoObjectReference Property DestinyX autoObjectReference Property AncientCityX autoMessage Property SkyFiDHDCheyenneMESG AutoEvent OnActivate(ObjectReference akActionRef)   GateStatusCheck()EndEventFunction GateStatusCheck()   if (PuddleX.IsEnabled())	 GateClose()   elseif (PuddleX.IsDisabled())	 GateDial()   endifEndFunctionFunction GateDial()Debug.Notification("Dialing...")Int iButton = SkyFiDHDCheyenneMESG.Show() ; Shows your menu.If (iButton != -1) ; Wait for input  If (iButton == 0)  ; Cancel     GateClose()    ElseIf (iButton == 1) ; Forest World     WorldEnable(ForestWorldX)    ElseIf (iButton == 2) ; Desert World     WorldEnable(DesertWorldX)    ElseIf (iButton == 3) ; Water World     WorldEnable(WaterWorldX)    ElseIf (iButton == 4) ; Destiny     WorldEnable(DestinyX)    ElseIf (iButton == 5) ; Ancient City     WorldEnable(AncientCityX)    EndIfEndIfEndFunctionFunction GateClose()   PuddleX.Disable()   Puddle2X.Disable()   ForestWorldX.Disable()   DesertWorldX.Disable()   WaterWorldX.Disable()   DestinyX.Disable()   AncientCityX.Disable()EndFunctionFunction WorldEnable(ObjectReference akWorldRef)   Debug.Notification("...Connection Successful")   akWorldRef.Enable()   PuddleX.EnableNoWait(true)   Puddle2X.EnableNoWait(true)   RegisterForSingleUpdate(38)EndFunctionEvent OnUpdate()   GateClose()EndEvent



do you want this gate to always be closed? and you have to press the button each time to open it?


if so, add this (although it might not be necessary if the auto-close is working properly:





Event OnCellAttach()   If (PuddleX.IsEnabled())	  GateClose()   EndIfEndEvent
User avatar
Laura Samson
 
Posts: 3337
Joined: Wed Aug 29, 2007 6:36 pm

Post » Thu Jun 21, 2012 12:02 am

Well I haven't done anything with messageboxes with button responses yet, but from what I can see, you are trying to call one of a number of functions based on which button the player clicked on the DHD popup?

Checking to see if I'm understanding it right...the "Puddles" are the visible gate portals (No kawoosh?) and the others are the "doors" to the various destinations that you enable when it's open to wherever?

Try putting some more notifications in there to verify you're actually getting to the right code. For example instead of identical "...Connection Successful" notifications, say which one it's trying to connect to in the notification.

I did that to test the buttons already then swapped it in for the connection successful. Also I am only testing the code, no animations are even started yet lol

you should run an enable check function instead of a variable because the enable check it is 100% reliable, whereas variables or even properties are not. (this is likely where your code is misfiring)
you should also clean up your functions into one, and pass the reference each time you access the single function.



Scriptname SkyFiDHDCheyenneScript extends ObjectReference{DHD Activator in Cheyenne}String CurrentLocationObjectReference Property PuddleX autoObjectReference Property Puddle2X autoObjectReference Property ForestWorldX autoObjectReference Property DesertWorldX autoObjectReference Property WaterWorldX autoObjectReference Property DestinyX autoObjectReference Property AncientCityX autoMessage Property SkyFiDHDCheyenneMESG AutoEvent OnActivate(ObjectReference akActionRef)   GateStatusCheck()EndEventFunction GateStatusCheck()   if (PuddleX.IsEnabled())	 GateClose()   elseif (PuddleX.IsDisabled())	 GateDial()   endifEndFunctionFunction GateDial()Debug.Notification("Dialing...")Int iButton = SkyFiDHDCheyenneMESG.Show() ; Shows your menu.If (iButton != -1) ; Wait for input  If (iButton == 0)  ; Cancel     GateClose()    ElseIf (iButton == 1) ; Forest World     WorldEnable(ForestWorldX)    ElseIf (iButton == 2) ; Desert World     WorldEnable(DesertWorldX)    ElseIf (iButton == 3) ; Water World     WorldEnable(WaterWorldX)    ElseIf (iButton == 4) ; Destiny     WorldEnable(DestinyX)    ElseIf (iButton == 5) ; Ancient City     WorldEnable(AncientCityX)    EndIfEndIfEndFunctionFunction GateClose()   PuddleX.Disable()   Puddle2X.Disable()   ForestWorldX.Disable()   DesertWorldX.Disable()   WaterWorldX.Disable()   DestinyX.Disable()   AncientCityX.Disable()EndFunctionFunction WorldEnable(ObjectReference akWorldRef)   Debug.Notification("...Connection Successful")   akWorldRef.Enable()   PuddleX.EnableNoWait(true)   Puddle2X.EnableNoWait(true)   RegisterForSingleUpdate(38)EndFunctionEvent OnUpdate()   GateClose()EndEvent



do you want this gate to always be closed? and you have to press the button each time to open it?


if so, add this (although it might not be necessary if the auto-close is working properly:





Event OnCellAttach()   If (PuddleX.IsEnabled())	  GateClose()   EndIfEndEvent

That looks perfect! Thanks for the fantastic response! I will test it out an get back to you :D
User avatar
Cedric Pearson
 
Posts: 3487
Joined: Fri Sep 28, 2007 9:39 pm

Post » Thu Jun 21, 2012 5:59 am

Well now it works, only a small problem now which is that the 2 puddlex's wont show the same time as the door appearing. Theres around a 7-8 second delay on it, is there anything I can do about this?
User avatar
Lalla Vu
 
Posts: 3411
Joined: Wed Jul 19, 2006 9:40 am

Post » Wed Jun 20, 2012 9:43 pm

i assume you still want the fade in effect right?

   PuddleX.EnableNoWait(true)   Puddle2X.Enable(true)   akWorldRef.Enable()

re-ordering the code this way will force the door to wait for the last puddle to finish fading in
User avatar
Calum Campbell
 
Posts: 3574
Joined: Tue Jul 10, 2007 7:55 am

Post » Thu Jun 21, 2012 3:36 am

i assume you still want the fade in effect right?

   PuddleX.EnableNoWait(true)   Puddle2X.Enable(true)   akWorldRef.Enable()

re-ordering the code this way will force the door to wait for the last puddle to finish fading in

Perfect thank you! Saved me a hell of a headache haha
User avatar
Veronica Martinez
 
Posts: 3498
Joined: Tue Jun 20, 2006 9:43 am


Return to V - Skyrim