What is wrong with this?

Post » Mon Jun 18, 2012 12:30 pm

What is wrong with this script? It's meant to unequip the amulet if the PCs level is not greater or equal to 50. I don't get this new scripting language. Any help? Thank you.

Scriptname RAVISamuletscript extends ObjectReference  ObjectReference Property RavisAmulet autoEvent OnEquipped(Actor akActor)  if akActor == Game.GetPlayer()   if Game.GetPlayer().getlevel() <= 50		 Game.GetPlayer().UnequipItem(RavisAmulet)endifendIfendEvent
User avatar
Gemma Archer
 
Posts: 3492
Joined: Sun Jul 16, 2006 12:02 am

Post » Mon Jun 18, 2012 2:54 am

Looks fine to me. Does it compile? Have you placed it on the amulet?
User avatar
Manuela Ribeiro Pereira
 
Posts: 3423
Joined: Fri Nov 17, 2006 10:24 pm

Post » Mon Jun 18, 2012 5:54 pm

Yes it compiles and saves without errors and I placed it on the amulet.
User avatar
Emma
 
Posts: 3287
Joined: Mon Aug 28, 2006 12:51 am

Post » Mon Jun 18, 2012 4:40 am

Looks fine to me. Does it compile? Have you placed it on the amulet?
if the answer to both of these is yes, try adding a debug.messagebox call to see if it is triggering the event and conditionals correctly.
User avatar
Sammykins
 
Posts: 3330
Joined: Fri Jun 23, 2006 10:48 am

Post » Mon Jun 18, 2012 3:39 pm

You made sure the property was set to the amulet?
User avatar
Melly Angelic
 
Posts: 3461
Joined: Wed Aug 15, 2007 7:58 am

Post » Mon Jun 18, 2012 5:04 pm

The if statements works, What do you mean by the is the properly set to the amulet?

I just added this \/ (RavisAmulet is the editor name for the Amulet) I don't know if that's right or if I am missing something.
ObjectReference Property RavisAmulet auto
User avatar
Kat Stewart
 
Posts: 3355
Joined: Sun Feb 04, 2007 12:30 am

Post » Mon Jun 18, 2012 3:52 pm

You should see a "Properties" button on the script list you added the script to.

Should look something like this:

http://i.imgur.com/GZyr6.jpg

And it should bring up something that looks like this:

http://i.imgur.com/wijIW.jpg

Should be able to set it to the amulet there.
User avatar
Markie Mark
 
Posts: 3420
Joined: Tue Dec 04, 2007 7:24 am

Post » Mon Jun 18, 2012 4:47 pm

It's already defined in the script though, that adds this \/ to the script.


ObjectReference Property RavisAmulet Auto
User avatar
Rebecca Clare Smith
 
Posts: 3508
Joined: Fri Aug 04, 2006 4:13 pm

Post » Mon Jun 18, 2012 3:26 am

Still, the property has to be pointed to the amulet form. The reference data is stored in the .esp only via filling of properties. The script itself has no idea what's in any plugins unless its properties are filled. You could attach the same exact script to two different forms with their properties set up differently and they'll do different things accordingly.

If the amulet's EditorID is the name of the property, you'll find "Properties" > "Auto-Fill All" will automatically find and point the property to RavisAmulet. Upon creation of a Property whose name matches exactly the EditorID of pre-existing form, it'll auto-fill the property all on its own.
User avatar
Baylea Isaacs
 
Posts: 3436
Joined: Mon Dec 25, 2006 11:58 am

Post » Mon Jun 18, 2012 10:41 am

So the scripting is like a object-oriented language? Got it thanks.
User avatar
Cameron Wood
 
Posts: 3384
Joined: Wed Oct 31, 2007 3:01 pm

Post » Mon Jun 18, 2012 12:08 pm

So the scripting is like a object-oriented language? Got it thanks.

Yup.

http://www.creationkit.com/Papyrus_Introduction does a good job of explaining.
User avatar
Peter lopez
 
Posts: 3383
Joined: Mon Sep 10, 2007 5:55 pm

Post » Mon Jun 18, 2012 6:00 pm

Thank you guys I fixed it, the property should have been `Armor` not `ObjectReference ` as it's a item not a IN GAME reference (I.E a marker or a NPC)

Scriptname RAVISamuletscript extends ObjectReference  Armor Property RavisAmulet autoEvent OnEquipped(Actor akActor)  if akActor == Game.GetPlayer()   if Game.GetPlayer().getlevel() <= 50		 Game.GetPlayer().UnequipItem(RavisAmulet)endifendIfendEvent
User avatar
Amy Masters
 
Posts: 3277
Joined: Thu Jun 22, 2006 10:26 am


Return to V - Skyrim