Jump to content

Scripting Questions


ArekkusuStorm

Recommended Posts

I've been trying to create a script attached to a weapon I made where on equipping the weapon, swap armors.

I got it working for the player easily.

Begin OnEquip
 
player.AddItem ASArmor3B 1
player.EquipItem ASArmor3B
player.RemoveItem ASArmor3 1
 
End
 
Begin OnUnequip
 
player.AddItem ASArmor3 1
player.EquipItem ASArmor3
player.RemoveItem ASArmor3B 1
 
End

But how would I get it to work for NPCs, as in how would I add the armor to the wielder of the weapon? I tried it using the GetSelf reference but it didn't work, I'm guessing that's because the reference is the sword and the wielder is a parent?

 

---

 

The only other question I have is, is there a function that checks when a weapon is holstered/unholstered? (So I can say 'OnHolster', blah, blah, blah?)

Edited by ArekkusuStorm
Link to comment
Share on other sites

"I'm guessing that's because the reference is the sword" - That's true, GetSelf will return the weapon when used in this context, since the script is attached to the weapon.

 

Try GetContainer instead, it will return the reference to the container (or actor, in this context) that contains the weapon.

 

For your other question, you can use IsWeaponOut, it might work depending on what you want to do. There's no blocktype called OnHolster or OnWeaponOut, unfortunately.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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