Making Cursed Item

Post » Wed Feb 08, 2017 12:15 am

I'm wanting to make an item (an amulet) that is Cursed, and cannot be unequipped for a mod I'm developing. I've been trying some things and I came up with this, but I'm not sure this example works:



Also, it's standard Skyrim, not SE.




Event OnObjectEquipped(Form akBaseObject, ObjectReference akReference)
If akBaseObject as Armor == YourArmorItem
MakeImpossibleToRemove(akBaseObject)
ElseIf akBaseObject as Weapon == YourWeaponItem
MakeImpossibleToRemove(akBaseObject)
EndIf
EndEvent

Function MakeImpossibleToRemove(Form CurrentObject)
Self.GetActorReference().UnequipItem(CurrentObject,false,false)
Utility.Wait(0.1)
Self.GetActorReference().EquipItem(CurrentObject,true,false)
EndFunction

What exactly am I doing wrong here, it just isn't working in game.

User avatar
saharen beauty
 
Posts: 3456
Joined: Wed Nov 22, 2006 12:54 am

Post » Wed Feb 08, 2017 1:04 am

The CK Wiki is not working for me right now, so I can't provide exact code... But you could do two things :



One, whenever the item is unequipped (which should be... OnUnEquipped(Actor Target)I mem serves), the script triggers the 'Target' to re-equip the item.



Or Two, on first-equip, have a Script UnEquip and then Re-Equip with the 'Block UnEquip Flag' set (which I believe is what is set for the Werewolf transform, but I'm not at my CK to check.



Based on what you posted above (and given it's been AGES since I did any proper Skyrim Modding), I think the issue is that you are using the wrong event... Try what you have with "OnEquipped(Actor Target)" -- I *Think* on OnObjectEquipped applies to Actors, rather than the items themselves, which would mean your Function never fires (But without the Wiki working, I can't confirm :/ )

User avatar
Charity Hughes
 
Posts: 3408
Joined: Sat Mar 17, 2007 3:22 pm

Post » Tue Feb 07, 2017 6:01 pm



What I have done (which is part of what I wanted to do), is I got a warning message to pop up when equipping it, now I just need to make it so they can't unequip it if they say yes.



Scriptname scaCursedItem extends ObjectReference

Actor Property PlayerREF Auto
Armor Property scaCItem Auto
Message Property cursedWarning Auto

Event OnEquipped(Actor akActor)
if (akActor == PlayerREF)
menu()
EndIf
EndEvent

Function menu(Int aiButton = 0)
aiButton = cWarningMessage.Show()
if aiButton == 0
Debug.Notification("Do not equip Cursed Item.")
ElseIf aiButton == 1
Debug.Notification("Equip Cursed Item.")
EndIf
EndFunction

So, any hints on where I take it from here?

User avatar
Ymani Hood
 
Posts: 3514
Joined: Fri Oct 26, 2007 3:22 am


Return to V - Skyrim