Megizen Documentation

website·Indexed 31 days ago

https://0tickpulse.github.io/megizen-docs

Documentation for Megizen, an addon plugin for Denizen that provides interoperability with the ModelEngine API. It allows users to control, animate, and manage models via commands like megmodel, megmount, and megstate, as well as specialized tags and events for modeled entities.

Tokens
6.1K
Snippets
34
Records
53
Agent score
73%

What's inside Megizen

  1. Overview of Megizen functionality

    Megizen is an addon plugin for Denizen that enables interoperability with the ModelEngine API. It allows developers to control models and trigger animations directly using Denizen scripts.
  2. Handle the meg adds <model> event

    The meg adds <model> event is fired when a model is about to be added to a MegModeledEntityTag. This event is cancellable, meaning you can prevent the model from being added using the - determine 'cancelled' command or filter the event using the cancelled:<true/false> or ignorecancelled:true switches.
    # Example of cancelling the event
    - determine 'cancelled'
    
  3. Access context tags for the meg removes <model> event

    When the meg removes <model> event is triggered, the following context tags are available to retrieve information about the removal and interaction:
    # Available Context Tags:
    <context.action>          # ElementTag: The interaction cause (ATTACK, INTERACT, or INTERACT_ON)
    <context.active_model>     # MegActiveModelTag: The model being removed
    <context.click_position>   # LocationTag: World-less vector relative to model center (if applicable)
    <context.item>             # ItemTag: The item used to interact with the model
    <context.is_secondary>      # ElementTag(Boolean): True if the player was crouching during interaction
  4. Handle the meg removes <model> event

    The meg removes <model> event is fired when a model is about to be removed from a MegModeledEntityTag. This event is cancellable, meaning you can prevent the model from being removed using the - determine 'cancelled' command. When using this event, you can utilize the cancelled:<true/false> or 'ignorecancelled:true' event switches, and check the <context.cancelled> tag.
    meg removes model: # Example event trigger
      - determine 'cancelled'
    
  5. Use context tags for the meg adds <model> event

    When the meg adds <model> event fires, the following context tags are available to retrieve information about the operation:
    <context.active_model>   # Returns the MegActiveModelTag of the model that is about to be added.
    <context.modeled_entity> # Returns the MegModeledEntityTag of the entity that the model is about to be added to.
  6. Identify and reference a MegBoneTag

    A MegBoneTag represents a specific bone on a model. To identify or reference a bone, use the prefix megbonetag@ followed by the entity, model blueprint, and bone ID in the following format:

    megbonetag@<entity>,<model_blueprint>,<bone_id>

  7. Use context tags for the meg <entity> mounts <'model'> event

    When the meg <entity> mounts <'model'> event fires, the following context tags are available to retrieve information about the mount action:
    ContextDescription
    <context.model>Returns the MegActiveModelTag of the model that the entity is mounting.
    <context.entity>Returns the EntityTag of the entity that is mounting the model.
    <context.is_driver>Returns a Boolean (ElementTag) indicating whether the entity is mounting the model as a driver.
  8. Access contexts for the entity dismounts model event

    When the meg <entity> dismounts <model> event fires, the following context tags are available to retrieve information about the dismount action:
    ContextDescription
    <context.model>Returns the MegActiveModelTag of the model that the entity is dismounting.
    <context.entity>Returns the EntityTag of the entity that is dismounting the model.
    <context.was_driver>Returns a Boolean (ElementTag) indicating whether the dismounting entity was the driver.
  9. Retrieve bone properties using MegBoneTag tags

    Use the following tags to retrieve information about a bone:
    MegBoneTag.children       # Returns MapTag(MegBoneTag): A map of children bones (key: bone id, value: bone)
    MegBoneTag.damage_tint    # Returns ColorTag: The damage tint of the bone
    MegBoneTag.default_tint    # Returns ColorTag: The default tint of the bone
    MegBoneTag.global_position # Returns LocationTag: The position of the bone as a vector
    MegBoneTag.glow_color      # Returns ColorTag: The glow color of the bone
    MegBoneTag.id             # Returns ElementTag: The ID of the bone
    MegBoneTag.item           # Returns ItemTag: The underlying item the bone uses
    MegBoneTag.is_glowing      # Returns ElementTag(Boolean): Whether the bone is glowing
    MegBoneTag.location       # Returns LocationTag: The location of the bone
    MegBoneTag.scale          # Returns LocationTag: The scale of the bone as a vector
    MegBoneTag.skin_texture    # Returns ElementTag: The skin texture in format `UUID|Texture|Name` (null if none)
  10. Modify bone properties using MegBoneTag mechanisms

    Use the following mechanisms to modify bone properties. Note that MegBoneTag.item should only be used if you have specific knowledge of the underlying item requirements.
    MegBoneTag.damage_tint   # Input: ColorTag - Sets the damage tint
    MegBoneTag.default_tint  # Input: ColorTag - Sets the default tint
    MegBoneTag.glow_color    # Input: ColorTag - Sets the glow color
    MegBoneTag.item          # Input: ItemTag - Sets the underlying item
    MegBoneTag.is_glowing    # Input: ElementTag(Boolean) - Sets whether the bone is glowing
    MegBoneTag.scale         # Input: ElementTag(Number) - Sets the scale of the bone
    MegBoneTag.skin_texture  # Input: ElementTag - Sets the skin texture (Format: `UUID|Texture|Name`)