Since the game's LUA doesn't allow game objects to cast spells, I had the idea of making the game object summon a unit and then making the unit cast the spell on the target player.
I can't test it though, can somebody try this out?
Here's the LUA script:
Code:
function Object_CastSpell (pUnit, Event, pMisc)
local posx, posy, posz, poso = pMisc:GetX(), pMisc:GetY(), pMisc:GetZ(), pMisc:GetO();
pUnit:SpawnCreature(<PUT CREATURE ID HERE>, posx, posy, posz, poso, 35, 5000);
end
RegisterGameObjectEvent(<PUT OBJECT ID HERE>, 2, "Object_CastSpell")
function ObjectUnit_CastSpell (Unit)
Unit:CastSpellOnTarget(<PUT SPELL ID HERE>, Unit:GetClosestPlayer())
end
RegisterUnitEvent(<PUT CREATURE ID HERE>, 6, "ObjectUnit_CastSpell")
Now the SQL for the Unit and for the Object:
Object:
Code:
INSERT INTO gameobject_names
(entry, Type, DisplayID, Name, spellfocus, sound1, sound2, sound3, sound4, sound5, sound6, sound7, sound8, sound9, unknown1, unknown2, unknown3, unknown4, unknown5, unknown6, unknown7, unknown8, unknown9, unknown10, unknown11, unknown12, unknown13, unknown14)
VALUES
(ENTRY, 4, DISPLAYID, "NAME", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
Unit:
Code:
INSERT INTO creature_proto (entry, minlevel, maxlevel, faction, minhealth, maxhealth, mana, scale, npcflags, attacktime, mindamage, maxdamage, rangedattacktime, rangedmindamage, rangedmaxdamage, mountdisplayid, equipmodel1, equipinfo1, equipslot1, equipmodel2, equipinfo2, equipslot2, equipmodel3, equipinfo3, equipslot3, respawntime, armor, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, combat_reach, bounding_radius, auras, boss, money, invisibility_type, death_state)
VALUES (ENTRY, 100, 100, 814, 1, 1, 99999, 1, 0, 1800, 150, 250, 1800, 500, 650, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36000, 0, 0, 0, 0, 0, 0, 0, 1, 0, "MEMO", 0, 0, 5, 0); INSERT INTO creature_names (entry, `name`, Subname, Flags1, type, Family, Rank, unk4, SpellDataID, male_displayid, female_displayid, unknown_float1, unknown_float2, Civilian, Leader, info_str)
VALUES (," "," ",0,7,0,0,0,NULL,1,1,1, 1,1,NULL, '');
Plz test =D