Scripting

Script Structure

onThink(monster, interval)

Parameters:

  • monster: Monster that is thinking.

  • interval: Interval for each think execution (1000ms)

Return Value:

  • None

Example:

function onThink(monster, interval)
    print("I'm thinking")
end

onAppear(monster, creature)

Parameters:

  • monster: Monster that witnessed the appearance of the creature.

  • creature: Creature that has appeared into the monster's view.

Return Value:

  • None

Example:

function onAppear(monster, creature)
    if monster:getId() == creature:getId() then
        print(monster:getId(), creature:getId())
    end
end

onDisappear(monster, creature)

Parameters:

  • monster: Monster that witnessed the disappearance of the creature.

  • creature: Creature that has disappeared from the monster's view.

Return Value:

  • None

Example:

function onDisappear(monster, creature)
    if monster:getId() == creature:getId() then
        print(monster:getId(), creature:getId())
    end
end

onMove(monster, creature, fromPosition, toPosition)

Parameters:

  • monster: Monster watching the creature move.

  • creature: Creature that is moving.

  • fromPosition: Position the creature is moving from.

  • toPosition: Position the creature is moving to.

Return Value:

  • None

Example:

function onMove(monster, creature, fromPosition, toPosition)
    if monster:getId() == creature:getId() then
        print(monster:getId(), creature:getId(), fromPosition, toPosition)
    end
end

onSay(monster, creature, type, message)

Parameters:

  • monster: Monster seeing the message.

  • creature: Creature saying the message.

  • type: Message type (Type list can be found Here)

  • message: Message sent by the creature.

Return Value:

  • None

Example:

function onSay(monster, creature, type, message)
    print(monster:getId(), creature:getId(), type, message)
end

Last updated