Revscriptsys

Script Structure

Constructor:

  • Game.createMonsterType(mTypeName)

  • mTypeName: Name for the monster type, equivalent to the name tag in monsters.xml.

Events:

  • onThink(monster, interval)

  • onAppear(monster, creature)

  • onDisappear(monster, creature)

  • onMove(monster, creature, fromPosition, toPosition)

  • onSay(monster, creature, type, message)

Methods:

  • register(): Finalizes the Monster Type definition and registers it.

  • name(newName):

  • newName: Name shown above the monster when created in-game.

  • nameDescription(desc):

  • desc: Name description for the monster (You see "a demon").

  • health(hp):

  • hp: Health the monster spawns at.

  • maxHealth(maxHp):

  • maxHp: Maximum health the monster can have.

  • runHealth(runHp):

  • runHp: Once the monster reaches the runHp threshold, it will run away from players.

  • experience(exp):

  • exp: Base experience gained by players who kill it.

  • combatImmunities(immunity):

  • immunity:

    physical

    energy

    fire

    poison or earth

    drown

    ice

    holy

    death

    lifedrain

    manadrain

  • conditionImmunities(immunity):

  • immunity:

    physical

    energy

    fire

    poison or earth

    drown

    ice

    holy

    death

    paralyze

    outfit

    drunk

    invisible or invisibility

    bleed

  • addAttack(spell):

  • spell: MonsterSpell userdata, see function documentation.

  • addDefense(spell):

  • spell: MonsterSpell userdata, see function documentation.

  • addElement(type, percent):

  • type: Element type (use the enums from Here)

    percent: Resistance percent.

  • addVoice(sentence, interval, chance, yell):

  • sentence: Sentence (text) to say.

    interval: Milliseconds between each attempt to say the sentence.

    chance: Chance to say the sentence.

    yell: Boolean, true will make the sentence a yell, otherwise it won't.

  • addLoot(loot):

  • loot: Loot userdata, see function documentation.

  • registerEvent(eventName):

  • eventName: Event name from creaturescripts to register to the monster.

  • eventType(type):

  • type: Event types found Here.

  • addSummon(name, interval, chance):

  • name: Monster name to summon.

    interval: Milliseconds between each attempt to spawn the summon.

    chance: Chance to summon.

  • maxSummons(amount):

  • amount: Amount of maximum summons the monster can spawn.

  • armor(arm):

  • arm: Base monster armor.

  • defense(def):

  • def: Base monster defense.

  • outfit(outfit):

  • outfit: Table containing outfit data

    lookMount

    lookAddons

    lookFeet

    lookLegs

    lookBody

    lookHead

    lookType

    lookTypeEx

  • race(race):

  • race:

    venom: Green damage numbers, green splash, CONST_ME_HITBYPOISON damage effect.

    blood: Red damage numbers, red splash, CONST_ME_DRAWBLOOD damage effect.

    undead: Grey damage numbers, CONST_ME_HITAREA damage effect.

    fire: Orange damage numbers, CONST_ME_DRAWBLOOD damage effect.

    energy: Purple damage numbers, CONST_ME_ENERGYHIT damage effect.

  • corpseId(id):

  • id: Corpse item ID for when the monster dies.

  • manaCost(cost):

  • cost: Mana cost to summon the monster via a spell such as utevo res.

  • baseSpeed(speed):

  • speed: Base speed at which the monster runs at with no buffs or debuffs.

  • light(color, level):

  • color: Color number.

    level: Level of intensity.

  • staticAttackChance(chance):

  • chance: Chance to use a static / basic attack.

  • targetDistance(distance):

  • distance: Distance in sqm that the monster will attempt to stay at between targets.

  • yellChance(chance):

  • chance: Chance to yell at each interval.

  • yellSpeedTicks(rate):

  • rate: Interval at which the monster tries to yell.

  • changeTargetChance(chance):

  • chance: Chance to swap targets at each interval.

  • changeTargetSpeed(speed):

  • speed: Interval at which the monster tries to change target.

Examples

These examples use a table to mask the definition without having to manually call each method, which makes the registration much easier for things like loot and spells.

Default TFS example:

Last updated

Was this helpful?