Jump to content

Attaching Enable/Disable Script to object


bientje

Recommended Posts

For clarification:

I used a mod-free "clean" save from after finishing the Thieves Guild questline, loaded the save after adding my esp, and coc'ed into my created cell.
Tried leaving the Cistern, so it would load Riften as a cell as well befor coc'ing but it didn't make any difference last night.

 

 

I just fired up the CK and will take your advice when trying again. :)

Link to comment
Share on other sites

Edit:

 

I finally got it working. After some more googling and adapting, my script now looks like this:

Scriptname oc_EnableDisplay extends ObjectReference
Quest property QuestInQuestion auto

ObjectReference Property LinkedObject01 auto
ObjectReference Property LinkedObject02 auto
[...]

Event OnCellAttach()
	If self.IsDisabled() && QuestInQuestion.IsCompleted()
		self.Enable()
		LinkedObject01.Enable(true)
		LinkedObject02.Enable(true)
		[...]
	endif
EndEvent

Apparently, when I use a marker, I need to check and disable it, too. Who woulda thunk?

 

Thank you guys, for all the pointers and tipps. I just love this community! :dance:

Link to comment
Share on other sites

Glad you got it working :) as Maxaturo said, you should use a Done state to optimize your script, (make sure it's not firing when it doesn't need to.) Like so:

 

Scriptname oc_EnableDisplay extends ObjectReference
Quest property QuestInQuestion auto


ObjectReference Property LinkedObject01 auto
ObjectReference Property LinkedObject02 auto
[...]


Auto State Waiting
    Event OnCellAttach()
        If self.IsDisabled() && QuestInQuestion.IsCompleted()
            self.Enable()
            LinkedObject01.Enable(true)
            LinkedObject02.Enable(true)
            [...]
            GoToState("Done")
        endif
    EndEvent
EndState 

State Done
EndState
Link to comment
Share on other sites

Oh I am! :)

 

One more thing (just came up):

 

Can anyone tell me how I check the ownership of a house? Like, if I wanted to check if the owner owns i.e. Breezehome, and then make a door leading there.

I already set up the door and it teleports me there no problem. But now I want to restrict access, so it only allows teleport if the player actually owns the place.

 

I found this:

; Does the player own the sword?
Bool playerOwnsSword = SwordProperty.GetActorOwner() == Game.GetPlayer().GetActorBase()

But I've got no idea where in that example I would put Breezehome as a reference.

Link to comment
Share on other sites

Awesome! I'll check this out as soon as I'm done with work.

 

Fun fact: My boyfriend - after "having a quick look" at the creationkit wiki - came to the same conclusion.

I almost feel somewhat offended that he "takes a quick look" and has a better understanding already, than I have after reading it about 800 times. :laugh:

Link to comment
Share on other sites

  • Recently Browsing   0 members

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