Jump to content

Create a Loop Script


morrowind1979

Recommended Posts

Need help with another script. trying to make a lightning spell be cast from an xmarker to a static object every 5 seconds, This is what I have so far:

Scriptname DWKBlightningScript extends ObjectReference  

ObjectReference Property KBG  Auto  

ObjectReference Property Xmrk  Auto  

SPELL Property LBolt  Auto  

Event OnCellAttach()
    Utility.wait(5.0)
    LBolt.Cast(Xmrk, KBG)
EndEvent

I cant figure out how to make the spell cast every 5 seconds instead of just once. Does anyone know how to do this???

Edited by morrowind1979
Link to comment
Share on other sites

Ok so made some progress with the loop I now have this:

Scriptname DWKBlightningScript extends ObjectReference  

ObjectReference Property KBG  Auto  

ObjectReference Property Xmrk  Auto  

Actor Property XH  Auto 

SPELL Property LBolt  Auto  

Function SomeFunction()                       
  RegisterForUpdateGameTime(10)
endFunction

Event OnUpdateGameTime()
	LBolt.RemoteCast(Xmrk, XH, KBG)
EndEvent

Now in theory according to that script (which compiles with no errors) Every 10 seconds of real time the Xmarker (object reference) should cast the lightning bolt spell (spell) at the Keyblade grave (object reference) and XH (actor) gets the blame.

 

But in reality nothing happens, no spell is cast at all anytime in the game. I am seriously confounded and at a loss.

Link to comment
Share on other sites

UGH!!! Just had to redo the whole system and achieve a lesser result by hacky and workaround methods. So sick of the CK not doing what its supposed to and having to resort to these methods. But hey I beat it with a wooden stick. F$@* the Creation Kit and all its persnickety pish!

Link to comment
Share on other sites

Ok so made some progress with the loop I now have this:

Scriptname DWKBlightningScript extends ObjectReference  

ObjectReference Property KBG  Auto  

ObjectReference Property Xmrk  Auto  

Actor Property XH  Auto 

SPELL Property LBolt  Auto  

Function SomeFunction()                       
  RegisterForUpdateGameTime(10)
endFunction

Event OnUpdateGameTime()
	LBolt.RemoteCast(Xmrk, XH, KBG)
EndEvent

Now in theory according to that script (which compiles with no errors) Every 10 seconds of real time the Xmarker (object reference) should cast the lightning bolt spell (spell) at the Keyblade grave (object reference) and XH (actor) gets the blame.

 

But in reality nothing happens, no spell is cast at all anytime in the game. I am seriously confounded and at a loss.

RegisterForUpdateGameTime counts in hours, not seconds. Your spell should be cast every 10 hours in your example.

Link to comment
Share on other sites

According to the CK WIKI RegisterForUpdateGameTime (0.5) equals 30 mins game time , so tried setting it to 0.05 and it didn't work, then on another section of the WIKI it says 10 is ten minutes (in real time not game time). So tried setting it to 10 that didn't work either.

 

In the end i just placed random trigger boxes in the cell that fired the lightning spell whenever any actor enters them.

 

And all this just took a full day lol. That's modding for you lol

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...