Keyword problems

Post » Wed Jun 20, 2012 8:21 pm

I would like to have a script that puts up a message box if the player equips a heavy armor. This is my attempt



Scriptname heavyarmordetector extends activemagiceffect  ConditionalKeyword Property ArmorHeavy AutoEvent OnObjectEquipped(Form akBaseObject, ObjectReference akReference)string playersHealth = Game.GetPlayer().GetActorValue("health") as string  Debug.MessageBox("Hello world" )If akBaseObject As ArmorDebug.MessageBox("It is an armor")If (akBaseObject.HasKeyword(ArmorHeavy)==1)		   Debug.MessageBox("It is a heavy armor")		EndIfEndIfendEvent

Right now it identifies if the player equips an armor but not if it is heavy, what am I doing wrong?
User avatar
Laura-Lee Gerwing
 
Posts: 3363
Joined: Fri Jan 12, 2007 12:46 am

Post » Thu Jun 21, 2012 6:58 am

If akBaseObject.Haskeyword(ArmorHeavy)
without the '==1' . True is not equal to 1 in papirus.

You could use ( ) around the check but it's not needed. You could also use a '== true' , but it's implicit.
User avatar
A Lo RIkIton'ton
 
Posts: 3404
Joined: Tue Aug 21, 2007 7:22 pm

Post » Thu Jun 21, 2012 2:56 am

Thanks, I altered it but that was not the error.

I think that I might not be assigning the value to ArmorHeavy correctly. Whenever I set it up in the properties menu and then saves it resets to default value. Is this likely to be the error? (sorry if I seem stupid I'm completely new at creation kit)

Scriptname heavyarmordetector extends activemagiceffect  ConditionalKeyword Property ArmorHeavy AutoEvent OnObjectEquipped(Form akBaseObject, ObjectReference akReference)string playersHealth = Game.GetPlayer().GetActorValue("health") as stringDebug.MessageBox("Hello world" )If akBaseObject As Armor Debug.MessageBox("It is an armor") If akBaseObject.HasKeyword(ArmorHeavy)  Debug.MessageBox("It is a heavy armor") EndIfEndIfendEvent
User avatar
victoria gillis
 
Posts: 3329
Joined: Wed Jan 10, 2007 7:50 pm

Post » Wed Jun 20, 2012 11:26 pm

Once you have set the property, all the forms you'll need to close need to be closed by OK. If you close any of them with cancel, the change will be cancelled. Not sure of another possible cause of the value being resetted.
User avatar
Tammie Flint
 
Posts: 3336
Joined: Mon Aug 14, 2006 12:12 am

Post » Thu Jun 21, 2012 2:56 am

Ok, thats what I thought I wwas doing but that fixed the problem. Thanks.

YOu wouldn't also know how to acces the armor rating of an armor object?
User avatar
Alexander Lee
 
Posts: 3481
Joined: Sun Nov 04, 2007 9:30 pm


Return to V - Skyrim