ArekkusuStorm Posted December 30, 2014 Share Posted December 30, 2014 (edited) 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 EndBut 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 December 30, 2014 by ArekkusuStorm Link to comment Share on other sites More sharing options...
Ladez Posted December 30, 2014 Share Posted December 30, 2014 "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 More sharing options...
ArekkusuStorm Posted December 30, 2014 Author Share Posted December 30, 2014 (edited) Awh yeah, thanks Ladez GetContainer worked perfectly. As for IsWeaponOut, I think I'll just use Begin Gamemode instead and use IsWeaponOut in a if statement, hmm, I'll experiment a bit with it. Edited December 30, 2014 by ArekkusuStorm Link to comment Share on other sites More sharing options...
Recommended Posts