What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal

Swap Weapon Code

tuanha

Well-Known Member
Joined
Nov 29, 2011
Messages
6,998
Reaction score
124
Hey guys,

Can you help me a sample code for Swapping Weapon.

I want to:

If can cast Spell Reflection -> Equip shield

Else equip 2h weapon

Thank you
 
you cant swap weapons in combat.
i swap between fishing pole and my staff just fine in combat while fishing with AutoAngler, but shield might be different. IDK since i only fish on my mage
 
you have to switch first the mainhandweapon. you cant equip a shield while wielding a 2 hand wappen.
 
Hey guys,

I'm sure warriors can swap weapon during combat.

I found the sample code here >http://www.thebuddyforum.com/archives/36113-equip-item-combat-2.html<

I'll try my new code when US server up, hope it work.
Code:
		#region Swap Weapon
		public string mainHandItemName = "Ruthless Gladiator's Hacker";
		public string offHandItemName = "Ruthless Gladiator's Shield Wall";
		public string TwoHandItemName = "Ruthless Gladiator's Decapitator";

		public static void EquipWeaponSet(string mainHandItemName, string offHandItemName)
		{
			EquipItem(16, mainHandItemName);
			EquipItem(17, offHandItemName);
		}

		public static void EquipItem(uint slot, string TwoHandItemName)
		{
			if(StyxWoW.Me.Inventory.Equipped.GetItemBySlot(slot - 1).Name != TwoHandItemName)
				Lua.DoString("RunMacroText(\"/equipslot {0} {1}\")", slot, TwoHandItemName);
		}
		
		#endregion

PS: If EU Server still up, can you pls test it for me. Thank you in advance :)
 
I've done my work, hope it help you guys.

Here my code

Code:
public string mainHandItemName = "Ruthless Gladiator's Hacker";//Name of the mainHandItemName
public string offHandItemName = "Ruthless Gladiator's Shield Wall";//Name of the offHandItemName
public string TwoHandItemName = "Ruthless Gladiator's Decapitator";//Name of the TwoHandItemName

//If No OffHand Weapon Equiped -> Equip Mainhand + OffHand
if(StyxWoW.Me.Inventory.Equipped.OffHand == null)
{
	Lua.DoString("RunMacroText(\"/equipslot 16 " + mainHandItemName + "\")");
	Lua.DoString("RunMacroText(\"/equipslot 17 " + offHandItemName + "\")");
}


//If OffHand Weapon Equiped -> Equip Two Hand Weapon
if(StyxWoW.Me.Inventory.Equipped.OffHand != null)
{
	Lua.DoString("RunMacroText(\"/equipslot 16 " + TwoHandItemName + "\")");
}
 
No offense to those attempting to help. But it would be of everyones best interest, if you didn't respond unless you ACTUALLY know.
 
for weapon switching take a look into autoangler 2, it does switch between fishing pole and weapon, but the logic how to switch should be the same and could be done by ID instead of weapon name
 
public string mainHandItemName = "Ruthless Gladiator's Hacker";//Name of the mainHandItemName
public string offHandItemName = "Ruthless Gladiator's Shield Wall";//Name of the offHandItemName
public string TwoHandItemName = "Ruthless Gladiator's Decapitator";//Name of the TwoHandItemName

//If No OffHand Weapon Equiped -> Equip Mainhand + OffHand
if(StyxWoW.Me.Inventory.Equipped.OffHand == null)
{
Lua.DoString("RunMacroText(\"/equipslot 16 " + mainHandItemName + "\")");
Lua.DoString("RunMacroText(\"/equipslot 17 " + offHandItemName + "\")");
}


//If OffHand Weapon Equiped -> Equip Two Hand Weapon
if(StyxWoW.Me.Inventory.Equipped.OffHand != null)
{
Lua.DoString("RunMacroText(\"/equipslot 16 " + TwoHandItemName + "\")");
}

If you have a 2 handed equipped is CanCast returning false for Spell Reflect and Shield Wall? Also if it is returning false is it viable to switch to shield and then check CanCast?
 
Back
Top