RPGFigurine

RPGFigurine is a special Object type that has access to animations for RPG Figurines from the RPG Kit. Once you have a reference to an Object you can call these functions like this: obj.RPGFigurine.attack().

Using the RPGFigurine events:


elf_guid = “7d884d”
elf = {}
knight_guid = “d08759”
knight = {}
ogre_guid = “604e4b”
ogre = {}
function onLoad()
    elf = getObjectFromGUID(elf_guid)
    knight = getObjectFromGUID(knight_guid)
    ogre = getObjectFromGUID(ogre_guid)

    function ogre.RPGFigurine.onAttack(hit_list)
        for i, v in ipairs(hit_list) do
            print(‘Ogre attacked ‘ .. i .. ‘: ‘ .. v.name)
        end
    end

    function elf.RPGFigurine.onHit(attacker)
        print(‘Elf hit by ‘ .. attacker.name)
    end

    function knight.RPGFigurine.onHit(attacker)
        print(‘Knight hit by ‘ .. attacker.name)
    end
end

Functions

Return ValueFunction NameDescription
boolattack()Plays a random attack animation.
boolchangeMode()Changes the RPG Figurine’s current mode. This can either be a different idle animation or changing held weapons depending on the RPG Figurine.
booldie()Plays the death animation. Call die() again to reset the RPG Figurine.
noneonAttack(Table hit_list)This function is called, if it exists in your script, when this RPGFigurine attacks another RPGFigurine. The parameter hit_list will be an indexed list of all the RPGFigurines that were hit during the attack. This function should be defined after a reference is retrieved to the RPGFigurine – see example above defining the onAttack() inside of the onLoad() function.
noneonHit(Object attacker)This function is called, if it exists in your script, when this RPGFigurine is attacked by another RPGFigurine. This function should be defined after a reference is retrieved to the RPGFigurine – see example above defining the onHit() inside of the onLoad() function.