Jump to content

Photo

Weapon Switch Scripting Help


  • Please log in to reply
No replies to this topic

#1
LordSerathDarklands

LordSerathDarklands

    Journeyman

  • Members
  • Pip
  • 45 posts

I need some help with a script on a weapon. What I'd like to do is set it up so that when said weapon (let's say Weapon_A) is equipped, the player can press a button and Weapon_A will be removed from the player's inventory and another specific weapon that the player does not own (hereafter, Weapon_B) will be added and equipped on the player. Subsequently, Weapon_B will have a similar script where pressing the button will remove Weapon_B and add and equip Weapon_A on the player.

 

The idea that I'm going for here is that the player can 'toggle' one of the enchantments on the weapon, with the press of the button, the weapon switching out will make it look like the enchantment is simply turning on and off - in this case, it will be Soultrap - Weapon_A and Weapon_B will be identical except that Weapon_B will have a Soultrap effect added to its existing enchantments.

 

I was also thinking about expanding this to three weapons, to allow the player to toggle between a weapon that deals fire, ice, and shock damage.

 

I'm not worried about the weapon repairing itself and recovering lost enchantment points when it switches.

 

I've seen something similar done before in another mod (I believe it was Sea of Destiny), where a khopesh was able to switch orientation from inner curve to outer curve by holding the crouch button, so I know something like this is possible.

 

I'm almost completely inept when it comes to scripting, so a very clear, straightforward explanation would be appreciated, and the script completely written out would be adored.

 

Thanks in advance!


Edited by LordSerathDarklands, 25 March 2022 - 01:54 PM.





IPB skins by Skinbox
Page loaded in: 1.051 seconds