VFX - Ticxo/Model-Engine-Wiki GitHub Wiki

What is VFX?

In R2.5.0, Model Engine has added support on VFX models. Compare to normal models, you have a lot more control over the movement and rotation, but due to how VFX works, you lose complexity and can only use 1 bone.

Creating a VFX model is the same as creating a normal entity model. With that being said, you can totally use a bone of an entity model as a VFX. For example, turning the weapon model into a projectile.

vfx_demo

Why use VFX?

Before this system is introduced, adding custom VFX is a pain for both the pack maker and the user. The pack maker needs to create a separate resource pack and assign a custom model data ID to an item model that hopefully nobody is using, especially when they are tinted. If the buyer finds a conflict between the packs, they have to painstakingly move all the IDs to a different model or offset the IDs themselves, then change all the mechanics using that custom model data ID.

So why not let Model Engine handle all of that?

Not only will you always get a spot to make your VFX colorable, but the assets are also generated from the bbmodel, just like the entity models. Plus, since the VFX is referenced using a part ID, the custom model data IDs are recorded and handled by Model Engine, no more remembering and changing IDs. Furthermore, you get all the benefits of using a Model Engine model, where your VFX would be following your projectiles accurately without delays, and you have advanced controls over how the VFX moves and rotates. Finally, because of how manual this system is, it does not affect server performance at all. You get to decide everything about the VFX, so make it as optimized (or unoptimized if you are evil) as you can.

Mechanic

VFX

Set the VFX of the mob.
This does not spawn the VFX immediately so you can edit its properties.

Attribute Aliases Description Default
modelid m, mid, model The model id of the VFX
partid p, pid, part The part id of the VFX
remove r Is this mechanic used for removing a VFX false
radius rad The view radius of the VFX base entity default
color c The color of the VFX FFFFFF
enchant en If the VFX is enchanted false

Example

- vfx{m=knight;p=sword;en=true} @self ~onSpawn
Apply the VFX to the entity executing the skill. In this case, it would be the sword from the knight model.


Spawn

Spawn the VFX if the mob has a VFX.

Example

- vfxspawn{delay=20} @self ~onSpawn
Show the VFX 1 second after spawning.


Set Visibility

Control the visibility of the VFX.

Attribute Aliases Description Default
visible v false

Example

- vfxsetvis{delay=100} @self ~onSpawn
Hide the VFX 5 seconds after spawn.


Tint

Set the color of the VFX.

Attribute Aliases Description Default
colora c, ca, color The first color FFFFFF
colorb cb The second color FFFFFF
duration d How long it takes to transition from color A to color B 0

Example

- vfxtint{ca=FF0000;cb=00FF00;duration=60} @self ~onSpawn
The color of the VFX would transition from red to green in 3 seconds after spawning.


Enchant

Set if the VFX has the enchant glint.

Attribute Aliases Description Default
enchant en true

Example

- vfxenchant{delay=40} @self ~onSpawn
Give the VFX an enchant glint 2 seconds after spawn.


Update Position

Update the position of the VFX.
If you do not use this mechanic, your VFX would not move even after moving the base entity.

Attribute Aliases Description Default
ignorerotation i, ir, ignore Whether the VFX would also ignore yaw false

Example

- vfxpos{i=true} @Forward{f=5} ~onTimer:5
Move the VFX to 5 blocks in front of the base entity every 0.25 second, ignoring the yaw rotation.


Update Rotation

Update the rotation of the VFX.
The rotation is cumulative, meaning each call of this mechanic does not overwrite the original rotation, but add to it.

Attribute Aliases Description Default
angle a The euler angle of the rotation (format: a=x,y,z)
neworigin o, origin Whether the rotation would be added globally(false) or locally(true) false

Example

vfxrot_demo

- skill{s=[
  - vfxrot{a=72,0,0;o=true}
  - vfxrot{a=0,0,1}
  ]} @self ~onTimer:1

The skill above is used to create the rotational effect seen in the GIF. The first vfxrot rotate the VFX by its local X axis, creating the fast spin effect.
The second vfxrot rotate the VFX by its global Z axis, which slowly tilts the VFX.

Note that "global axis" are still relative to the base entity, not the world axis, so -Z would be the forward direction of the base entity.


Reset Rotation

Reset the VFX rotation to 0 0 0

Example

- vfxrotreset{delay=50} @self ~onSpawn
Reset the VFX rotation 2.5 seconds after spawn.


Point

Aim the VFX towards the target, where the forward direction in game is North in BlockBench.

Note: Be careful when using this mechanic together with vfxrot. vfxpoint would overwrite all previous rotation, while vfxrot only adds.

Attribute Aliases Description Default
useyaw y, yaw Whether the rotation on Y axis would be using yaw or armor stand head angle. true

Example

- vfxpoint @PIR{r=16} ~onTimer:20
Point towards the nearest player in a 16 block radius, updating every second.


Copy Rotation

Copy the rotation of a bone of the target. Useful for making a bone "leave" the model and become a projectile.

Attribute Aliases Description Default
modelid m, mid, model The model id of the copied model
partid p, pid, part The part id of the copied model

Example

- vfxcopy{m=reaper;p=scythe} @parent ~onSpawn
Copy the rotation of scythe bone from the parent's reaper model.