Jump to content

Shoutout to Modders and patience with scripts


Arkadaemus

Recommended Posts

I'd like to thank all the modders whose tireless efforts have given us such wonderful paths to run down in an already extraordinary game. That said...


Just spent the last two hours searching Google, Nexus Forums, CK wiki, and youtube for tutorials on using a lever to enable/disable objects. Sounds like it would be simple, eh?


Sadly, everything I found was convoluted, misleading or hard to follow. So many different approaches to the scripts, which to use, what to reference. Nothing clear and concise, always blah blah this should work.


So in the end, after piecing together many works and taking notes, I finally got my "simple" project working.


In the basement of my home, I wanted a crafting area. Not a huge space, so I didn't want to use the standard forge. In place of this, I used a Dwemer incense burner, topped with a Sovngarde fire (looks really hot). Set a plain crafting anvil and bucket next to it. But, I didn't want the fire burning all the time, just when I'm down there crafting.



Scriptname ArkFireForgeLever1 extends ObjectReference


ObjectReference Property ArkForgeLever01 auto

ObjectReference Property ArkForgeFire01 auto


Event OnActivate(ObjectReference akActionRef)

If (ArkForgeFire01.IsDisabled())

ArkForgeFire01.Enable()

Else

ArkForgeFire01.Disable()

EndIf

EndEvent



Set the fire initially disabled, and added a Dwemer lever next to the fire to switch it on and off. FINALLY got the scripting sorted out so it works. One Event, using OnActivate with one If-Else. No OnInit, Trigger, states, boolcrap <-(see that?) lol :cool: Now maybe I didn't need to define the property for the lever, and won't know because it works as is and I'm not changing anything.


Anyway, thanks for reading. And may Azura watch over your papyrus.


Link to comment
Share on other sites

Only reason for anyone to have used OnInit and that other stuff is if their script was intended to do more than just turn the fire on and off. Sometimes this is the case, sometimes it is not. There is a default script that you could have used without writing a completely new one. Only thing different is that the placed instance of the fire would be linked to the lever by being assigned to the Linked Ref section of the placed instance of the lever. There is also a bool variable but that is solely for changing whether or not the object fades or pops when it is disabled/enabled. But since it has a default value, it could be ignored.

 

 

 

scriptName defaultActivateToggleLinkedRef extends ObjectReference
{
- Toggles the state of the linked ref when this object is activated.
}

ObjectReference myLinkedRef

bool property fade = False Auto

Event OnActivate(ObjectReference triggerRef)
	myLinkedRef = GetLinkedRef() as ObjectReference
	if (myLinkedRef.IsEnabled())
		myLinkedRef.Disable(fade)
	Else
		myLinkedRef.Enable(fade)
	EndIf
EndEvent 

 

 

 

At any rate, congrats on creating your first working script.

Link to comment
Share on other sites

Well that would have made things go a lot quicker lol. Never saw any reference to that particular script. I initially linked the fire to the lever, but after researching didn't see how that would be used.

 

Thanks for the reply :laugh:

 

10210860-1476478787.gif

Link to comment
Share on other sites

  • Recently Browsing   0 members

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