im not good with creature commands because im not sure how they work, try this on an auto macro:
---
Self.Health()
att:=Creature.Attacking()
Creature.NameIn(!att!, Ghost)==1 [notghost]
Self.Inventory.LeftHand()<>IDFIRESWORD
Self.Equip.LeftHand(IDFIRESWORD)
Exit
{notghost}
Self.Inventory.LeftHand()<>IDBRIGHTSWORD
Self.Equip.LeftHand(IDBRIGHTSWORD)
---
replace IDFIRESWORD and IDBRIGHTSWORD with respective id
---
Self.Health()
att:=Creature.Attacking()
Creature.NameIn(!att!, Ghost)==1 [notghost]
Self.Inventory.LeftHand()<>IDFIRESWORD
Self.Equip.LeftHand(IDFIRESWORD)
Exit
{notghost}
Self.Inventory.LeftHand()<>IDBRIGHTSWORD
Self.Equip.LeftHand(IDBRIGHTSWORD)
---
replace IDFIRESWORD and IDBRIGHTSWORD with respective id