Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

Constant-run script initialization


ThomasKaira
 Share

Recommended Posts

Right now, I'm just keeping things as simple as possible: the script will print a message into a message box once it initializes. Trouble is, it does not function, and I haven't the slightest idea why. I'm pretty sure I'm missing something, since I have to learn the language all over again and the CK Wiki is extremely unhelpful. Here's the code that does not work.

ScriptName aaTKFillInLater extends Actor


ReferenceAlias Property Player auto


Quest Property FillInLater  Auto 


Event OnInit()

	RegisterForUpdate(1)

	Debug.MessageBox("Script aaTKFillInLater is now active")

EndEvent

Link to comment
Share on other sites

Its currently being attached to a container quest (as it would be under the old scripting), but I wonder if that doesn't work anymore.

Would it be possible to attach the script to the player, in that case? Since it is pretty much guaranteed for the player to be in the current active cell.

Edited by ThomasKaira
Link to comment
Share on other sites

I don't know what a container quest is.

Here is an 'object' script that you can attach to an activator, door, etc.. It will run the OnInit code as soon as the object loads into the cell.

Scriptname LevelersEntranceDoor extends ObjectReference  
{Script on entrance door to towers}

Event OnInit()
Debug.messagebox("Door initalized")
endEvent
[/code] I am using this type of code to initially block activation of my door, until the player accepts responsibility for entering the door. [spoiler]
[code]Scriptname LevelersEntranceDoor extends ObjectReference
{Script on entrance door to towers}

SPELL Property VoiceUnrelentingForce3 Auto

ObjectReference Property LevelersDoorShoutREF Auto

Message Property MesgQuestionBox1 Auto
Message Property MesgOkay Auto
Message Property MesgNo Auto

int Button
int myState

Event OnInit()
if myState == 0
BlockActivation()
; Debug.messagebox("Door initalized as blocked")
else
BlockActivation(false)
; Debug.messagebox("Door initalized as unblocked")
endif
endEvent

EVENT onActivate(objectReference akActionRef)

If akActionRef == Game.GetPlayer()
if myState == 0
button = MesgQuestionBox1.show()
if Button == 0
myState = 1
MesgOkay.show()
BlockActivation(false)
Activate(Game.GetPlayer())
; Debug.messagebox("Answered yes")
elseif Button == 1
MesgNo.show()
; Debug.messagebox("Answered no")
VoiceUnrelentingForce3.RemoteCast(LevelersDoorShoutREF, Game.GetPlayer(), Game.GetPlayer())
endif
else
BlockActivation(false)
; Activate(Game.GetPlayer())
; Debug.messagebox("Open, already answered yes")
endif
EndIf

endEVENT

Link to comment
Share on other sites

Its currently being attached to a container quest (as it would be under the old scripting), but I wonder if that doesn't work anymore.

Would it be possible to attach the script to the player, in that case? Since it is pretty much guaranteed for the player to be in the current active cell.

If you're attaching your script to a Quest, it needs to extend Quest. Otherwise nothing will happen.

@WillieSea: I think by container quest he means he's using a dummy quest to attach his script so he doesn't have to attach it directly to a vanilla record (compatibility reasons, I'm guessing).

Edited by trira
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...