This will switch to a Fire Sword if you're targeting a Ghost and then switch back again whenever you're not targeting a Ghost.
lua code:
local specialMonsters = {"Ghost"}
local defaultWeapon = "Mystic Blade"
local specialWeapon = "Fire Sword"
-----------------------------------------------
-----------------------------------------------
-----------------------------------------------
defaultWeapon = Item.GetID(defaultWeapon)
specialWeapon = Item.GetID(specialWeapon)
Module("Weapon changer", function(self)
local c = Creature(Self.TargetID())
local useSpecial = c and table.find(specialMonsters, c:Name())
if useSpecial and Self.Weapon().id ~= specialWeapon then
Self.Equip(specialWeapon, "weapon")
self:Delay(5000)
elseif not useSpecial and Self.Weapon().id ~= defaultWeapon then
Self.Equip(defaultWeapon, "weapon")
self:Delay(5000)
end
end)