Simple Weapon Script help needed.

Post » Mon Jun 18, 2012 4:17 pm

I'm having a lot of fun trying to get papyrus to play along -.-

I was wondering if someone would be kind enough to help out with a quick script and an explaination to how I implement it.

It's quite simple in theory - We have 2 weapons - DaggerA and DaggerB.

When DaggerA is unequipped, it adds the item DaggerB to the invintory and removes DaggerA from the invintory. Then when DaggerB is unequipped, it adds DaggerA to the invintory and removes DaggerB from the invintory.


I'm like an ape with a plastic bag over my head when it comes to scripting...

This was my attempt. Needless to say it does nothing. It compiles without a problem, and it's attached to the weapons in the CK but yerr...

Scriptname DaggerSwapout extends ObjectReferenceWEAPON property DaggerA autoEvent Onunequip(Actor target, Actor Caster)target.additem(DaggerB, 1, false)EndEventWEAPON property DaggerB autoEvent Onequip(Actor target, Actor Caster)target.removeitem(DaggerA, 1, false)EndEvent

And I set up the weapon property to point to the respective daggers. As mentioned - compiles without errors but nothing happening ingame.


Thanks for any help in advance
User avatar
Susan
 
Posts: 3536
Joined: Sun Jun 25, 2006 2:46 am

Post » Mon Jun 18, 2012 11:39 am

You should be able to use a script like this on both daggers, if you set your properties up well:
ScriptName SwapOnUnequip extends ObjectReferenceForm property Partner auto ; You could change the type here to a more derived one, but it probably isn't necessaryEvent OnUnequipped(Actor akActor)	akActor.AddItem(Partner) ; To not show a message, use akActor.AddItem(Partner, 1, true)	akActor.RemoveItem(GetBaseObject())EndEvent

Cipscis
User avatar
Daniel Holgate
 
Posts: 3538
Joined: Tue May 29, 2007 1:02 am

Post » Mon Jun 18, 2012 12:21 pm

Thanks a ton! :) had to edit it slightly to use a second reference instead of the getbaseobject function - but now it works brilliantly! I'll be sure to slap your name in the credits.
User avatar
Andres Lechuga
 
Posts: 3406
Joined: Sun Aug 12, 2007 8:47 pm


Return to V - Skyrim