Elite Script Relative Vectors
What they are for
Relative vectors are vectors that are relative to a specific but dynamic location.
To best explain what these are, let's consider the following case: you want to push a player towards the boss as a part of a power. Since both the boss and the player move around during combat, it is not possible to rely of a specific vector to accomplish this effect - you will need a vector that goes from the player towards the boss. (Imagine a short line with an arrow going from the player towards the boss.)
Relative vectors can be use in so many ways that it would be impossible to list them all, but among them are: shooting entities (like projectiles) towards a specific player or mob; spawning reinforcements behind a player; shooting a falling block in a specific direction; creating rays that are shot towards a player, and so much more.
Usage Context
Relative vectors are used in action contexts with the YAML key RelativeVector:. This includes actions like:
SUMMON_ENTITY- Sets the velocity (movement direction and speed) of the spawned entitySPAWN_PARTICLE- Sets the direction particles movePUSH- Sets the push velocitySPAWN_FALLING_BLOCK- Sets the falling block velocitySET_FACING- Sets the direction an entity faces
For target contexts (modifying target positions), use relativeOffset: instead. See the Elite Script Relative Offset section below for details on how relativeOffset works differently.
How do vectors work?
If you don't know or don't remember what vectors are or how they work, you can think of vectors as arrows that point from one point to another point.
As such, one of the properties of vectors is their length. This length is important; in the case of arrows, this length is the speed at which an arrow is shot, in the case of trying to get offset points from a specific location it is the distance from that point. Things farther away will have greater vector lengths, and closer things will have shorter lengths.
For some mechanics, you will probably not want to rely on how far apart two points are, as you just want to get a direction. Fortunately you are able to use vector normalization, which guarantees that the direction is preserved but changes the length to be 1.0. You can then use multipliers to easily modify the vector until you are satisfied with the offset that it provides or the velocity it gives.
Properties
| Value | Details | Mandatory? | Default value |
|---|---|---|---|
SourceTarget | Target at the point from which the vector will start from | ✅ | none |
DestinationTarget | Target at the end point for the vector | ✅ | none |
normalize | Sets if the vector should be normalized | ❌ | false |
multiplier | Multiplies the vector's length. You can randomize this value by using ~. Example: 1.0~2.5. | ❌ | 1.0 |
offset | Allows inserting a manual fixed offset to this offset. You can randomize this value by using ~. Example: 0~5,0~2,0~10. | ❌ | none |
Randomization
Both multiplier and offset support randomization using the tilde (~) delimiter:
- For multiplier: Use format
min~max(e.g.,1.0~2.5). Each time the script runs, a random value between 1.0 and 2.5 (inclusive) will be selected. - For offset: Use format
x1~x2,y1~y2,z1~z2(e.g.,0~5,0~2,0~10). Each component (X, Y, Z) is randomized independently.
Randomization values are regenerated each time the vector is calculated, allowing for dynamic and varied effects.
Example
eliteScript:
ShootChicken:
Events:
- EliteMobDamagedByPlayerEvent
Actions:
- action: SUMMON_ENTITY
sValue: CHICKEN
Target:
targetType: SELF
RelativeVector:
SourceTarget:
targetType: SELF
DestinationTarget:
targetType: DIRECT_TARGET
normalize: true
multiplier: 2.0
Shoots a chicken
eliteScript:
ShootArrow:
Events:
- EliteMobDamagedByPlayerEvent
Actions:
- action: SUMMON_ENTITY
sValue: ARROW
Target:
targetType: SELF
RelativeVector:
SourceTarget:
targetType: SELF
DestinationTarget:
targetType: DIRECT_TARGET
normalize: true
multiplier: 2.0
Shoots an arrow
eliteScript:
SpawnReinforcement:
Events:
- EliteMobDamagedByPlayerEvent
Actions:
- action: SUMMON_ENTITY
sValue: ZOMBIE
Target:
targetType: SELF
relativeOffset:
SourceTarget:
targetType: SELF
DestinationTarget:
targetType: DIRECT_TARGET
normalize: true
multiplier: 2.0
Spawns a zombie 2 blocks behind the player, relative to the boss.
eliteScript:
Example:
Events:
- EliteMobDamagedByPlayerEvent
Zone:
Shape: SPHERE
target:
targetType: SELF_SPAWN
offset: 0,0,0
track: false
filter: PLAYER
radius: 6
Actions:
- action: SPAWN_PARTICLE
repeatEvery: 38
times: 5
Target:
targetType: ZONE_FULL
track: false
coverage: 0.9
particles:
- particle: FLAME
RelativeVector:
SourceTarget:
targetType: ACTION_TARGET
track: true
DestinationTarget:
targetType: SELF_SPAWN
offset: 0,-0.5,0
speed: 0.05
Creates an animated flame sphere that shrinks to the spawn location.
How it works:
- The zone targets all players within a 6-block sphere around the boss spawn location.
- Particles spawn at random points throughout the sphere (coverage: 0.9 means 90% of points are used).
- Each particle moves from its spawn point (ACTION_TARGET with track: true) toward the boss spawn location (SELF_SPAWN).
- The
track: trueon SourceTarget means the particle continuously updates its direction as it moves. - This creates an inward motion effect, making the sphere appear to collapse toward the center.
- The effect repeats 5 times (times: 5) with 38 ticks between each iteration (repeatEvery: 38).
Order of operations
The order of operations when applying the properties goes as follows:
Vector calculation -> normalize -> multiplier -> offset
Technical Notes
Vector Normalization: Normalization preserves the direction of the vector but sets its length to exactly 1.0. This is useful when you need consistent behavior regardless of distance.
Negative Multipliers: The multiplier can be negative to reverse the direction of the vector. For example, a multiplier of -1.0 will point in the opposite direction.
Offset Coordinates: The offset is applied in world coordinates, not relative to the vector direction. It is added after all other calculations.
World Validation: The source and destination targets must be in the same world. If they are in different worlds, a zero vector (0, 0, 0) is returned, which may cause actions to fail or behave unexpectedly.
Zero Vectors: When targets are invalid or in different worlds, the system returns a zero vector. This can cause entities to spawn without velocity or actions to have no effect.
Velocity vs Position Context: In action contexts like SUMMON_ENTITY, RelativeVector sets the velocity (movement) of the entity. In target contexts, relativeOffset sets a position offset (location adjustment). The same underlying system is used, but the interpretation differs based on context.
Elite Script Relative Offset
What Are They For?
Relative offsets function similarly to relative vectors, but with the goal being of adding flexibility to offsets. They allow you to adjust positions dynamically when scripting, making it easier to fine-tune target positions or effects based on context.
How Do Relative Offsets Work?
Relative offsets are additive, meaning whatever the offset resolves to will be added to the base value (such as a location or vector).
Let’s break down an example:
You have a ray zone:
Target 1isSELF(the boss).Target 2isNEARBY_PLAYERSwith a range of 10.
If a player is found 8 blocks away, the ray will be 8 blocks long, ending at the player.
Now let’s apply a relative offset:
Case 1: normalize = false, multiplier = 1
- The original distance is 8.
- Offset value becomes
8 × 1 = 8. - Final ray length:
8 + 8 = 16.
The ray will pass through the player and continue for 8 additional blocks.
Case 2: normalize = false, multiplier = 2
- Offset value becomes
8 × 2 = 16. - Final ray length:
8 + 16 = 24.
Case 3: normalize = true, multiplier = 1
- The distance is normalized to 1.
- Offset value becomes
1 × 1 = 1. - Final ray length:
8 + 1 = 9.
Case 4: normalize = true, multiplier = 2
- Offset value becomes
1 × 2 = 2. - Final ray length:
8 + 2 = 10.
Summary
normalize = falseuses the actual distance between the targets.normalize = truealways starts from a base of 1, regardless of actual distance.- The offset is always added to the original value.
- When
multiplieris set to0withnormalize = true, the offset becomes0(since1 × 0 = 0), and withnormalize = false, the offset also becomes0(since any number multiplied by0is0), effectively disabling the relative offset in both cases.
This system allows you to easily extend or shrink distances dynamically when building more complex skill logic in EliteMobs scripting.
Properties
| Value | Details | Mandatory? | Default value |
|---|---|---|---|
SourceTarget | Target at the point from which the vector will start from | ✅ | none |
DestinationTarget | Target at the end point for the vector | ✅ | none |
normalize | Sets if the vector should be normalized | ❌ | false |
multiplier | Multiplies the vector's length. You can randomize this value by using ~. Example: 1.0~2.5. | ❌ | 1.0 |
Example
eliteScript:
MakeStaticRay:
Events:
- EliteMobDamagedByPlayerEvent
Zone:
shape: STATIC_RAY
Target:
targetType: SELF
offset: 0,1,0
Target2:
targetType: NEARBY_PLAYERS
range: 10
offset: 0,1,0
relativeOffset:
sourceTarget:
targetType: SELF
destinationTarget:
targetType: NEARBY_PLAYERS
range: 10
multiplier: 5
normalize: true
Actions:
- action: SPAWN_PARTICLE
Target:
targetType: ZONE_FULL
particles:
- particle: ELECTRIC_SPARK
amount: 1
repeatEvery: 1
times: 400
This will create a static ray between the boss and the player, with a relative offset that extends the ray 5 blocks beyond the player. Note that regular offsets are also applied to Target and Target2 to ensure the ray is drawn from the center of the boss to the center of the player, rather than from their feet.
Note: Even though this example uses relative offset on a zone, keep in mind that relative offsets are not limited to zones, they can be applied to other targets as well.