Common Patterns
Reusable snippets and inheritance tricks for Hytale packs.
Inheritance Patterns
Section titled “Inheritance Patterns”Minimal Override
Section titled “Minimal Override”Inherit everything, change one property:
{ "Parent": "Template_Weapon_Sword", "Quality": "Legendary"}Deep Override with InteractionVars
Section titled “Deep Override with InteractionVars”Change damage values without touching interaction chain:
{ "Parent": "Template_Weapon_Sword", "InteractionVars": { "Swing_Left_Damage": { "Interactions": [{ "Parent": "Weapon_Sword_Primary_Swing_Left_Damage", "DamageCalculator": { "BaseDamage": { "Physical": 50 } } }] } }}Inline Interaction Override
Section titled “Inline Interaction Override”Replace entire interaction without separate file:
{ "Interactions": { "Primary": { "Cooldown": { "Cooldown": 0.5 }, "Interactions": [{ "Type": "Simple", "RunTime": 0.3, "Effects": { "ItemAnimationId": "Swing" } }] } }}NPC Variant Pattern
Section titled “NPC Variant Pattern”{ "Type": "Variant", "Reference": "Template_Predator", "Modify": { "Appearance": "Wolf", "MaxHealth": 100 }}Damage Patterns
Section titled “Damage Patterns”Physical Only
Section titled “Physical Only”{ "DamageCalculator": { "BaseDamage": { "Physical": 20 } }}Physical + Elemental
Section titled “Physical + Elemental”{ "DamageCalculator": { "BaseDamage": { "Physical": 15, "Fire": 10 } }}With Critical Hits
Section titled “With Critical Hits”{ "DamageCalculator": { "BaseDamage": { "Physical": 20 }, "CriticalHitChance": 0.15, "CriticalHitMultiplier": 2.0 }}With Damage Variance
Section titled “With Damage Variance”{ "DamageCalculator": { "BaseDamage": { "Physical": 20 }, "RandomPercentageModifier": 0.2 }}This creates ±20% variance (16-24 damage).
DPS-Based (for effects/DoT)
Section titled “DPS-Based (for effects/DoT)”{ "DamageCalculator": { "Type": "Dps", "BaseDamage": { "Fire": 5 } }}Knockback Patterns
Section titled “Knockback Patterns”Light Knockback
Section titled “Light Knockback”{ "DamageEffects": { "Knockback": { "Force": 3.0 } }}Heavy Knockback with Direction
Section titled “Heavy Knockback with Direction”{ "DamageEffects": { "Knockback": { "Type": "Force", "Force": 10.0, "Direction": { "X": 0, "Y": 0.5, "Z": -1 } } }}Upward Launch
Section titled “Upward Launch”{ "DamageEffects": { "Knockback": { "Force": 8.0, "Direction": { "X": 0, "Y": 1, "Z": 0 } } }}Hit Detection Patterns
Section titled “Hit Detection Patterns”Wide Horizontal Arc
Section titled “Wide Horizontal Arc”{ "Selector": { "Id": "Horizontal", "EndDistance": 3.0, "Length": 120 }}Narrow Stab
Section titled “Narrow Stab”{ "Selector": { "Id": "Horizontal", "EndDistance": 4.0, "Length": 30 }}Vertical Overhead Swing
Section titled “Vertical Overhead Swing”{ "Selector": { "Id": "Vertical", "Direction": "ToDown", "EndDistance": 3.0, "Length": 90 }}Ground Pound (Sphere)
Section titled “Ground Pound (Sphere)”{ "Selector": { "Id": "Sphere", "EndDistance": 5.0 }}Ranged Raycast
Section titled “Ranged Raycast”{ "Selector": { "Id": "Raycast", "EndDistance": 50.0, "TestLineOfSight": true }}Projectile Patterns
Section titled “Projectile Patterns”Fast Bullet
Section titled “Fast Bullet”{ "MuzzleVelocity": 300, "Gravity": 5, "Damage": 50, "TimeToLive": 60}Arcing Arrow
Section titled “Arcing Arrow”{ "MuzzleVelocity": 60, "Gravity": 15, "Damage": 25, "SticksVertically": true, "PitchAdjustShot": true}Slow Magic Orb
Section titled “Slow Magic Orb”{ "MuzzleVelocity": 20, "Gravity": 0, "Damage": 30, "Radius": 0.3, "DeathParticles": { "SystemId": "Magic_Explosion" }}Bouncing Projectile
Section titled “Bouncing Projectile”{ "MuzzleVelocity": 40, "Gravity": 20, "Bounciness": 0.7, "ImpactSlowdown": 0.2, "TimeToLive": 15}Combo Patterns
Section titled “Combo Patterns”3-Hit Chain
Section titled “3-Hit Chain”{ "Type": "Chaining", "ChainingAllowance": 1.5, "Next": [ { "Var": "Hit1", "DefaultValue": { "Interactions": ["Attack1"] } }, { "Var": "Hit2", "DefaultValue": { "Interactions": ["Attack2"] } }, { "Var": "Hit3", "DefaultValue": { "Interactions": ["Attack3"] } } ]}Charge Attack (3 tiers)
Section titled “Charge Attack (3 tiers)”{ "Type": "Charging", "DisplayProgress": true, "Next": { "0": "QuickAttack", "0.5": "MediumAttack", "1.5": "FullyCharged" }}Conditional Branch
Section titled “Conditional Branch”{ "Type": "Condition", "Crouching": true, "Next": "CrouchAttack", "Failed": "StandingAttack"}Effects Patterns
Section titled “Effects Patterns”Basic Attack Effects
Section titled “Basic Attack Effects”{ "Effects": { "ItemAnimationId": "SwingLeft", "WorldSoundEventId": "SFX_Sword_Swing" }}With Screen Shake
Section titled “With Screen Shake”{ "Effects": { "ItemAnimationId": "SwingDown", "CameraEffect": "ScreenShake_Heavy", "WorldSoundEventId": "SFX_Impact_Heavy" }}With Particles
Section titled “With Particles”{ "Effects": { "ItemAnimationId": "Swing", "Particles": [{ "SystemId": "Fire_Swing", "Bone": "RightHand" }] }}With Trails
Section titled “With Trails”{ "Effects": { "ItemAnimationId": "Swing", "Trails": [{ "TrailId": "Sword_Trail", "TargetNodeName": "Blade_Tip" }] }}Delayed Start
Section titled “Delayed Start”{ "Effects": { "StartDelay": 0.1, "ItemAnimationId": "Attack" }}Ammo Consumption Pattern
Section titled “Ammo Consumption Pattern”{ "Type": "ModifyInventory", "ItemToRemove": { "Id": "Ammo_Arrow", "Quantity": 1 }, "Next": { "Type": "LaunchProjectile", "ProjectileId": "Arrow_Basic" }, "Failed": { "Type": "Simple", "Effects": { "WorldSoundEventId": "SFX_Empty_Click" } }}Status Effect Patterns
Section titled “Status Effect Patterns”Apply on Hit
Section titled “Apply on Hit”{ "Type": "Serial", "Interactions": [ { "Type": "DamageEntity", "DamageCalculator": { "BaseDamage": { "Physical": 10 } } }, { "Type": "ApplyEffect", "EffectId": "Poison", "Entity": "Target", "Duration": 5.0, "Stacks": 1 } ]}Self-Buff
Section titled “Self-Buff”{ "Type": "ApplyEffect", "EffectId": "AttackBoost", "Entity": "Self", "Duration": 10.0}Stat Modifiers Pattern
Section titled “Stat Modifiers Pattern”{ "Weapon": { "StatModifiers": { "MaxHealth": [{ "Amount": 50, "CalculationType": "Additive" }], "MovementSpeed": [{ "Amount": 0.2, "CalculationType": "Multiplicative" }], "DamageMultiplier": [{ "Amount": 0.1, "CalculationType": "Multiplicative" }] } }}Loot Table Patterns
Section titled “Loot Table Patterns”See Adding Drop Tables for the full drop table reference.
Guaranteed Drop
Section titled “Guaranteed Drop”{ "Container": { "Type": "Single", "Item": { "ItemId": "Raw_Meat", "QuantityMax": 2 } }}Chance Drop (50%)
Section titled “Chance Drop (50%)”{ "Container": { "Type": "Multiple", "Containers": [ { "Type": "Single", "Weight": 50, "Item": { "ItemId": "Rare_Drop" } } ] }}Weight on a Single inside Multiple is a percentage chance (0-100). The root container’s weight is never checked, so the Multiple wrapper is required.
Multiple Independent Drops
Section titled “Multiple Independent Drops”{ "Container": { "Type": "Multiple", "Containers": [ { "Type": "Single", "Weight": 100, "Item": { "ItemId": "Common_Item" } }, { "Type": "Single", "Weight": 30, "Item": { "ItemId": "Uncommon_Item" } }, { "Type": "Single", "Weight": 5, "Item": { "ItemId": "Rare_Item" } } ] }}Weighted Random (pick one)
Section titled “Weighted Random (pick one)”{ "Container": { "Type": "Choice", "Containers": [ { "Type": "Single", "Weight": 70, "Item": { "ItemId": "Common" } }, { "Type": "Single", "Weight": 25, "Item": { "ItemId": "Uncommon" } }, { "Type": "Single", "Weight": 5, "Item": { "ItemId": "Rare" } } ] }}File Location Reference
Section titled “File Location Reference”All paths are relative to your pack folder (mods/YourPackName/):
| What You’re Adding | Pack Location |
|---|---|
| Custom item | Server/Item/Items/ |
| Custom interaction | Server/Item/Interactions/ |
| Custom root interaction | Server/Item/RootInteractions/ |
| Custom projectile | Server/Projectiles/ |
| Custom NPC | Server/NPC/Roles/ |
| Custom drop table | Server/Drops/ |
| Custom status effect | Server/Entity/Effects/ |
| Custom model | Common/Items/ |
| Custom icon | Common/Icons/ |
| Custom sound | Common/Sounds/ |
Base Game Reference
Section titled “Base Game Reference”To find vanilla assets to inherit from or use as reference:
<Hytale Install>/release/package/game/latest/Assets.zip