mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-29 21:32:52 +01:00
Core/SmartAI: Allow SMART_ACTION_SUMMON_GO and SMART_ACTION_SUMMON_CREATURE to use x, y, z and o parameters as relative offsets for a summoning position (example, summon creature 20 yards in front of the invoker)
Signed-off-by: Subv <s.v.h21@hotmail.com>
This commit is contained in:
@@ -1119,12 +1119,13 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
{
|
||||
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
|
||||
{
|
||||
if (!IsUnit(*itr))
|
||||
continue;
|
||||
|
||||
(*itr)->GetPosition(x, y, z, o);
|
||||
x += e.target.x;
|
||||
y += e.target.y;
|
||||
z += e.target.z;
|
||||
o += e.target.o;
|
||||
if (Creature* summon = GetBaseObject()->SummonCreature(e.action.summonCreature.creature, x, y, z, o, (TempSummonType)e.action.summonCreature.type, e.action.summonCreature.duration))
|
||||
if (unit && e.action.summonCreature.attackInvoker)
|
||||
if (e.action.summonCreature.attackInvoker)
|
||||
summon->AI()->AttackStart((*itr)->ToUnit());
|
||||
}
|
||||
|
||||
@@ -1154,6 +1155,10 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
continue;
|
||||
|
||||
(*itr)->GetPosition(x, y, z, o);
|
||||
x += e.target.x
|
||||
y += e.target.y
|
||||
z += e.target.z
|
||||
o += e.target.o
|
||||
GetBaseObject()->SummonGameObject(e.action.summonGO.entry, x, y, z, o, 0, 0, 0, 0, e.action.summonGO.despawnTime);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user