Jump to content

Help with lockable object


Veladarius

Recommended Posts

Posted

So I am trying to figure put how to make an item like a collar of cuffs that when equipped could not be removed by the player until they found a key. The idea I had was that you would have the object locked on and when you found a key for it and equipped it then the two would be replaced by an unequipped and unlocked item then equipping the item again would replace the unlocked item with the locked item and the key again. I am thinking of using this for a starting quest of having the items locked on and have to find the keys or keyholder.

 

I have written several scripts which run but nothing happens and nothing shows in the papyrus log referencing the items. I have created 4 items:

 

Slave Collar Unlocked: Activating this should remove the unlocked collar, add the locked collar and make it unremovable by the player

[spoiler=Script 1]Scriptname playercollarlocking extends ObjectReference

MiscObject Property Collarlockingmaster Auto

ObjectReference Property Collarlockingnewkey Auto
{armor property slavecollarlocked auto
armor property slavecollarunlocked auto

Event onequipped()
If player().isequipped(SlaveCollarlocked)
endevent
endif
Additem(SlaveCollarLocked, 1, false)
Equipitem(SlaveCollarLocked,true)
Removeitem(SlaveCollarUnlocked, 1, false)
EndEvent}

ObjectReference[] Property IsColarlocked Auto

 

 

Slave Collar Locked: Should not be removable by player unless they use a key (no script)

 

Collar Key Rusty: Will allow the player to unlock the collar once. Script should remove the locked collar and the key and add an unlocked collar

 

[spoiler=Script 2]Scriptname CollarUnlocking1use extends objectreference

MiscObject Property Collarkeyrusty Auto

ObjectReference Property Collarunlocking1 Auto
{armor property slavecollarlocked auto
armor property slavecollarunlocked auto
armor property collarkey1use auto

Event onequiped()
If player.isequipped (SlaveCollarlocked)
additem (SlaveCollarUnlocked, 1, false)
removeitem(SlaveCollarLocked,1)
removeitem(Collarkeyrusty,1)
endevent
endif
Endevent}

 

 

Collar Key New: Should add a key that can unlock a collar any number of times. Script should remove the locked collar and replace it with an unlocked collar

 

[spoiler=Script 3]Scriptname CollarUnlockingmaster extends objectreference

MiscObject Property Collarkeyrusty Auto

ObjectReference Property Collarunlocking1 Auto
{armor property slavecollarlocked auto
armor property slavecollarunlocked auto
armor property collarkeymaster auto

Event onequiped()
If player.isequipped (SlaveCollarlocked)
additem (SlaveCollarUnlocked, 1, false)
removeitem(SlaveCollarLocked,1)
unequipitem(Collarkeynew,1)
endevent
endif
Endevent}

 

 

This is the first time creating any scripts from scratch so I have no idea if these are correct. Any help would be appreciated.

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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