Jump to content

Simple Activator Script Help please


saintgrimm92

Recommended Posts

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
EndEven

However, when I activate the activator, no message appears.

Link to comment
Share on other sites

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

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

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: 2

Title: (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: AAArgothLock01

Name: Lock

Model: Dungeons\Riften\ThievesGuild\RiftenRWArmoryDoorLock01.nif

Sounds - Activate: QSTTG07VaultLockEnterSD Looping: (none selected)

NavMesh Generation Import Option - Collision Geometry slected

Water Type: NONE

Activate Text Override: Unlock

 

On Local Map checked, all other boxes not checked.

No Keywords.

Default Primitive Color - Defaults

Scripts - 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
EndEvent

Script Properties:

 

NoKey - Message - AAArgothKeyMessage02

LockKey - Key - AAArgothLockKey01

YesKey - Message - AAArgothKeyMessage01

 

 

 

 

The sound plays when activated, I just don't get the "you do not have the correct key" message.

Edited by saintgrimm92
Link to comment
Share on other sites

  • Recently Browsing   0 members

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