Skip to content
This repository has been archived by the owner on Apr 3, 2024. It is now read-only.

Routines: Value Change

1cec0ld edited this page Sep 26, 2012 · 5 revisions

Summary:

This is the meat and potatoes of MD. This particular entry will NOT follow the usual format for Routine entries, as there are a large number of value-changing routines to go through here.

All value-changing routines have a basic rule: if the routine is signed (starting with -/+) then it is assumed that the routine will be additive, as opposed to an unsigned value-changing routine, which will set the event's value to its result.

Routines

  • Set/Add

    Simply adds or sets the number to a value.

    Damage: #Nerfs Creeper damage by 1 heart.
        - 'if attacker.type.creeper': '-2'
    Damage: # Gives a 10% chance to do more damage.
        - 'chance.10': '+2'
    Damage: # Slimes deal half their health in damage.
        - 'if attacker.type.Slime': '(attacker_health / 2)'
  • roll[.#value]

    Randomly sets the event value to a number whose absolute value is less than or equal to the current value, or randomly adds an integer whose absolute value is less than or equal to the defined value to the event value if a value is defined.

    Damage: #This example sets offensive output for a human attacking with no item in hand to a random value between the current event value and 0  (between 0 and 2 for AIR in vanilla MC at time of writing)
        - 'if attacker.wielding.air': 'roll'
        #else do 0-6 damage if not wielding air.
        - 'if !attacker.wielding.air': 'roll(6)'
  • '(div[ide]||/).#value

    What does it sound like?

    Damage: #Reduce fall damage for players!
       - 'if target.type.human and damage_type.is.fall': 'div.3' # Could also be 'divide.3', '\3', '/3'
    Damage: # Inflict x1.5 pain when a player has a Ghast Tear in their inventory. It should also be noted that two multiplications could be done, but this is simpler.p
       - 'if attacker.hasitem.GHAST_TEAR*1': '+divide.2' # Could also be '+div.2', '+\2', '+/2'
  • (mult[iply]|).#value*

    What does it sound like?

    Aliases:
        Material:
            axe:
                - 'WOOD_AXE'
                - 'STONE_AXE'
                - 'IRON_AXE'
                - 'GOLD_AXE'
                - 'DIAMOND_AXE'
    Damage: #5% chance to deal axe crits!
        - 'if attacker.wielding._axe and chance.5': 'mult.2' # Could also be '*2'
  • Literal Ranges: range(#lower,#upper)

    Literally uses a random value between #lower and #upper (inclusive)

    Spawn: #Assigns a pig a random health value between 3 and 7 upon spawn.
        - 'if target.type.Pig': 'range(3,7)'
    Damage: # Slight nerf for all damage just to make it unpredictable?
        - '-range(0,2)'
  • Interval-based ranges: range(#base,#max,#interval)

    Add a random integer defined as (base + interval * (Random % (range + 1))) to the event value.

    Spawn: #Assigns a Zombie 3, 6, 9, or 12 health upon spawn.
        - 'if target.type.Zombie': 'range(3,12,3)'

See also: Entity Type

Clone this wiki locally