Skip to content

spell_script_target

killerwife edited this page May 14, 2023 · 10 revisions

Back to world database list of tables.

The `spell_script_target` table

Used to control SpellEffect with ImplicitTargetA-B. The target, either GO or Creature can be utilized to supply either itself or its XYZ.

ID Name
2 TARGET_UNIT_ENEMY_NEAR_CASTER
3 TARGET_UNIT_FRIEND_NEAR_CASTER
4 TARGET_UNIT_NEAR_CASTER
7 TARGET_ENUM_UNITS_SCRIPT_AOE_AT_SRC_LOC
8 TARGET_ENUM_UNITS_SCRIPT_AOE_AT_DEST_LOC
38 TARGET_UNIT_SCRIPT_NEAR_CASTER
40 TARGET_GAMEOBJECT_SCRIPT_NEAR_CASTER
46 TARGET_LOCATION_SCRIPT_NEAR_CASTER
51 TARGET_ENUM_GAMEOBJECTS_SCRIPT_AOE_AT_SRC_LOC
52 TARGET_ENUM_GAMEOBJECTS_SCRIPT_AOE_AT_DEST_LOC
60 TARGET_ENUM_UNITS_SCRIPT_IN_CONE_60

These spell effects require a specific target in either alive or dead state (for creatures).

Structure

Field Type Null Key Default Extra
entry int(6) unsigned NO PRI
type int(8) unsigned NO PRI 0
targetEntry int(11) unsigned NO PRI 0
inverseEffectMask mediumint(8) unsigned NO 0

Description of the fields

entry

The spell ID. spell_template#id

When adding a new entry, be sure to check to see if the spell triggers another spell. If it does, don’t forget to check that spell as well to see if it has ImplictTargetA-B = 38 || ImpliciteTargetA-B == 7 and if it does, add an entry in this table for it as well.

NOTE: The only valide targets for ImpliciteTargetA-B == 7 are creatures(dead or alive).

type

ID Type Comment
0 Gameobject
1 Creature by Entry
2 Creature which must be dead (killed by Player or Npc)
3 Creature by Guid OBSOLETE – use StringId instead
4 Gameobject by Guid OBSOLETE – use StringId instead
5 WorldObject by StringId string_id#id

Supply through Guid now utilizes Map wide fetching when range of spell is 50000yd. This can be used for many map wide scripts, but remember the target still has to be loaded in grid.

NOTE: A creature corpse and a creature that looks dead are two different things. One is actually dead and the other is just using an emote or spell to appear dead.

targetEntry

Can be: creature_template.entry or gameobject_template.entry depending on the choosen type.

This specified entry will be automatically targeted if it is near the unit casting the spell.

inverseEffectMask

A mask value defining if the target is only applicable for specifiq effect indexes by the spell.
This is an inverseMask, so you need to filter effects for which you don’t want the target to be valid.
The mask is 1 << EffectIndex (EffectIndex going from 0 to 2)

Example:
(Spell, 1, NpcA, 2^0), — NpcA will NOT be chosen for spell-effect 0, so it will be chosen for effects 1 or 2
(Spell, 1, NpcB, 2^1|2^2), — NpcB will NOT be chosen for spell-effects 1, 2, so it will be chosen for effect 0.

So with this we can define targets for a spell (assuming that the targets for the effects can make use of spell_script_target!) in a way that Effect0 will hit NpcB, and Effect1,2 will hit NpcA

ID Description
0 All effects
1 effects 1 and 2
2 effects 0 and 2
3 effect 2
4 effects 0 and 1
5 effect 1
6 effect 0
Clone this wiki locally