saintgrimm92 Posted February 20, 2015 Share Posted February 20, 2015 I'm currently attempting to make an activator that looks like a keyhole require a key. I have a message I want displayed if the player does not have the key as well as one displayed if they do have it. My current script looks like this:Scriptname AALockScript extends ObjectReference Key Property LockKey Auto message property NoKey Auto Message Property YesKey Auto Event OnAcivate(ObjectReference akActionRef) If (game.getplayer().getitemcount(Lockkey) == 0) Nokey.Show() EndIf If (game.getplayer().getitemcount(Lockkey) == 1) YesKey.Show() EndIf EndEvenHowever, when I activate the activator, no message appears. Link to comment Share on other sites More sharing options...
Mattiewagg Posted February 20, 2015 Share Posted February 20, 2015 Make sure all your properties are filled correctly, and that your message has been created. I recommend changing the script to his, just to clean it up real quick: Scriptname AALockScript Extends objectReference Key Property LockKey Auto message property NoKey Auto Message property YesKey Auto Event onActivate(ObjectReference akActionRef) if (game.getPlayer().Getitemcount(lockkey) == 0) nokey.show() else yeskey.show() EndEvent Link to comment Share on other sites More sharing options...
Mattiewagg Posted February 20, 2015 Share Posted February 20, 2015 My updatedscirpt is missing an EndIf, that should be added after the Else check. Link to comment Share on other sites More sharing options...
saintgrimm92 Posted February 20, 2015 Author Share Posted February 20, 2015 thank you very very much. All properties are filled. I completely forgot about the else function, but when I was researching the issue, I found this on the ck wiki and not sure if it would be the reason: If the argument akItem is a keyword and the object reference contains CK-defined items (Object References) then this function will fail to operate properly (Source) : it fails to include the CK-defined inventory when GetItemCount tries to calculate its count. I'm not sure if that would be include my key or not. I'm a very novice scripter >.> lol Link to comment Share on other sites More sharing options...
Terra Nova Posted February 20, 2015 Share Posted February 20, 2015 Should be fine, since you're not looking for something based on a keyword. GetItemCount just borks when you try checking for keywords along with a property. Link to comment Share on other sites More sharing options...
saintgrimm92 Posted February 20, 2015 Author Share Posted February 20, 2015 (edited) Hmm... I'm still not getting the message though... I haven't tried activating it with the key in inventory however. Let me go into deeper details here. I simply renamed and re-wrote the message from the shrine blessings (blessing removal and blessing messages) ID: AAArgothKeyMessage01 Message Box (NOT checked) Auto-display (NOT checked)Icon: NONE Owner Quest: NONE Display Time: 2Title: (blank)Message Text:Used Key of Argoth (everything else left blank) Other message is identical, however the test says You do not have the correct key. The activator uses the same mesh as RiftenRWArmoryDoorLock01, I just made it into an activator. ID: AAArgothLock01Name: LockModel: Dungeons\Riften\ThievesGuild\RiftenRWArmoryDoorLock01.nifSounds - Activate: QSTTG07VaultLockEnterSD Looping: (none selected)NavMesh Generation Import Option - Collision Geometry slectedWater Type: NONEActivate Text Override: Unlock On Local Map checked, all other boxes not checked.No Keywords.Default Primitive Color - DefaultsScripts - AALockScript Script: Scriptname AALockScript Extends objectReference Key Property LockKey Auto message property NoKey Auto Message property YesKey Auto Event onActivate(ObjectReference akActionRef) if (game.getPlayer().Getitemcount(lockkey) == 0) nokey.show() else yeskey.show() Endif EndEventScript Properties: NoKey - Message - AAArgothKeyMessage02LockKey - Key - AAArgothLockKey01YesKey - Message - AAArgothKeyMessage01 The sound plays when activated, I just don't get the "you do not have the correct key" message. Edited February 20, 2015 by saintgrimm92 Link to comment Share on other sites More sharing options...
saintgrimm92 Posted February 22, 2015 Author Share Posted February 22, 2015 bump. still can't get it to work. I used debug notification function, the script isn't firing at all :( Link to comment Share on other sites More sharing options...
Recommended Posts