• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

RevScripts strength/life based on skull

NicolasCRP

New Member
Joined
Jul 22, 2022
Messages
3
Reaction score
0
I'm using google translate so the text might be weird. I'm studying about tibias and I'm interested about tibias pokemons, on my server the pokemons have skulls, I would like to change the strength and life of these pokemons based on their skulls, but I have no idea how to do that.
Simply put, Red skull 10% more health
White skull 10% more hp.
 
Something like this? Not sure if the onLogin/onSpawn register are both required.
Lua:
local ec = EventCallback

function ec.onSpawn(monster, position, startup, artificial)
    if monster:getSkull() == SKULL_RED then
        monster:registerEvent("redSkullHp")
        monster:registerEvent("redSkullMana")
    end
    local monsterMaxHp = monster:getMaxHealth()
    if monster:getSkull() == SKULL_WHITE then
        monster:setMaxHealth(monsterMaxHp * 1.1)
        monster:setHealth(monsterMaxHp * 1.1)
    end
    return true
end

ec:register(-555)

local redSkullHp = CreatureEvent("redSkullHp")

function redSkullHp.onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
    if attacker and attacker:isMonster() then
        if attacker:getSkull() == SKULL_RED then
            primaryDamage = primaryDamage * 1.1
        end
    end
    return primaryDamage, primaryType, secondaryDamage, secondaryType, origin
end

redSkullHp:register()

local redSkullMana = CreatureEvent("redSkullMana")

function redSkullMana.onManaChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
    if attacker and attacker:isMonster() then
        if attacker:getSkull() == SKULL_RED then
            primaryDamage = primaryDamage * 1.1
        end
    end
    return primaryDamage, primaryType, secondaryDamage, secondaryType, origin
end

redSkullMana:register()

local creatureEvent = CreatureEvent("monsterRS")

function creatureEvent.onLogin(player)
    player:registerEvent("redSkullHp")
    player:registerEvent("redSkullMana")
    return true
end

creatureEvent:register()
Edited the script, Didn't notice you have them already spawning with skulls (Kept only skull checks).
 
Last edited:
I'm using google translate so the text might be weird. I'm studying about tibias and I'm interested about tibias pokemons, on my server the pokemons have skulls, I would like to change the strength and life of these pokemons based on their skulls, but I have no idea how to do that.
Simply put, Red skull 10% more health
White skull 10% more hp.
I think you'll have to create a Creatuscripts, which checks if the player has the skull at the moment, otherwise it returns true.
Do something like this, and creates a record in creaturescript.xml but look for the skull check in the source.
Lua:
function onThink(player, interval)
     if not player:getSkullType() >= 1 then
          return true
     end
     if player:getSkullType() == 3 then
        player:setLifeMax(getLife(), +100)
     end
     if player:getSkullType() == 2 then
         player:setLifeMax(getLife(), +50)
     else
        player:setLifeMax(getLife(), +10)
     end
     return true
end
I didn't pay attention to the monsters that have skulls lol. i don't understand anything about pokemon.
 
Back
Top