Jump to content

Request: Scripting Help for new mod


Badassfreakinoverlord

Recommended Posts

So I'm newish to Creation Kit and have been working on a mod. Been using a youtube series to learn the basics, but it doesn't cover what i want to do with code.

Basically I am recreating the original NES Zelda dungeons in Skyrim. But seeing as big empty rooms are no fun, I've decided to also bring them up to the level of detail that one could find in any average skyrim dungeon. It'll be more than just a direct bland port.

 

Right now I'm working on "Eagle" and if its popular enough i'll make more.

 

Screenshots of varrying ages can be seen:

http://imgur.com/a/puGHF#0

 

The help I have come seeking today lies in the age old tradition of crappily forged keys.

Basically I want to code my doors to check if i have the key, unlock, eat a single copy of the key, and display a message saying something like "The old rusty key snapped in the lock, at least it worked." The player would then have to click an OK or w/e and continue on. This way I could distribute any number of copies of "Old Rusty Key" and not have any one key tied to any one door (cept the boss door.)

I could techncially just make a whole bunch of keys (old rusty blah 01, old rusty blah 02, etc) but that seems overly tedious in play and then you have to collect specific keys for each specific door. Basically i think its a better idea to ask for help for the coding.

 

So... can I get some assistance?

Link to comment
Share on other sites

You can link multiple doors to a single key. Do so. Give the player the keys, like you want. Then put this script on each door (it might need tweaked/fixed, but the basic idea should work). Note that I can't test this so I don't know if the door's normal unlocking would happen first or if this script would run first. I'm assuming it'll unlock first. If that's not the case, this might need changed, but I gave it a delay, so it should work.

ScriptName KeyEater Extends ObjectReference

Key Property KeyRef Auto

State Locked
Event OnActivate(ObjectReference akActionRef)
	Utility.Wait(0.5)
	If !IsLocked()
		akActionRef.RemoveItem(KeyRef)
		GoToState("Unlocked")
	EndIf
EndEvent
EndState

State Unlocked
Event OnActivate(ObjectReference akActionRef)
EndEvent
EndState

This will wait half a second after the door is activated, then if it's unlocked, it'll remove a key from whoever activated it IF it's still in the locked state, then it'll put itself in the unlocked state. The state change prevents it from running multiple times (so each door only removes one key), and it's more efficient than changing and checking a variable. Just fill the key property with your key and you should be good to go.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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