• 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!

Action [TFS 1.X] Shrines

el Santuario de la Sabiduría que te da exp, no me da + 25% de experiencia adicional será que estoy haciendo algo mal?
Post automatically merged:

the Wisdom Shrine that gives you exp, does not give me + 25% bonus experience will be that I am doing something wrong?
 
Post data/events/events.xml and data/events/scripts/player.lua
[/CITAR]

sorry at what step should you say something about data / events / scripts / player.lua.


or what should I do in data / events / scripts / player.lua
 
sorry at what step should you say something from data / events / scripts / player.lua.

or what should I do in sorry at what step should you say something from data / events / scripts / player.lua ??
Nevermind, asked for wrong files.
Inside data/creaturescripts/creaturescripts.xml you have added <event type="kill" name="ShrinesKill" script="shrines.lua" />?
 
Nevermind, asked for wrong files.
Inside data/creaturescripts/creaturescripts.xml you have added <event type="kill" name="ShrinesKill" script="shrines.lua" />?
[/CITAR]

my mistake must be here ..

I really don't know much about lua ..

Can you explain to me how I add it in creaturescripts.xml?
 
Found a bug in your code with protection shrine
Lua:
    [12355] = { -- Protection shrine
        effect = CONST_ME_HOLYAREA,
        storage = SHRINES_STORAGE_BASE + 2,
        spawnChance = 100,
        duration = 300,
        bonus = 10,
        text = "Protection Shrine",
        message = "Protection shrine activated, +25% damage protection for 5 minutes."

Code:
if creature:isPlayer() then
        if creature:getStorageValue(SHRINES_STORAGE_BASE + 2) > 0 then
            if primaryDamage > 0 then
                primaryDamage = math.floor(primaryDamage - (primaryDamage * SHRINES_CONFIG[12355].bonus / 100))
            end
            if secondaryDamage > 0 then
                secondaryDamage = math.floor(secondaryDamage - (secondaryDamage * SHRINES_CONFIG[12355].bonus / 100))
            end
        end
    end

Basically this will change the players healing abilities, if player casts exura for example, it will remove 10% from exura healing. If bonus is 100, exura does 0 healing. This does not function as "protection" at all.
 
Found a bug in your code with protection shrine
Lua:
    [12355] = { -- Protection shrine
        effect = CONST_ME_HOLYAREA,
        storage = SHRINES_STORAGE_BASE + 2,
        spawnChance = 100,
        duration = 300,
        bonus = 10,
        text = "Protection Shrine",
        message = "Protection shrine activated, +25% damage protection for 5 minutes."

Code:
if creature:isPlayer() then
        if creature:getStorageValue(SHRINES_STORAGE_BASE + 2) > 0 then
            if primaryDamage > 0 then
                primaryDamage = math.floor(primaryDamage - (primaryDamage * SHRINES_CONFIG[12355].bonus / 100))
            end
            if secondaryDamage > 0 then
                secondaryDamage = math.floor(secondaryDamage - (secondaryDamage * SHRINES_CONFIG[12355].bonus / 100))
            end
        end
    end

Basically this will change the players healing abilities, if player casts exura for example, it will remove 10% from exura healing. If bonus is 100, exura does 0 healing. This does not function as "protection" at all.
Yup.
 

Attachments

i see you added
Lua:
if primaryType == COMBAT_HEALING or secondaryType == COMBAT_HEALING then return primaryDamage, primaryType, secondaryDamage, secondaryType end
however it still does not function as protection against anything. I tested using print functions with monster and player attacks.
 
i see you added
Lua:
if primaryType == COMBAT_HEALING or secondaryType == COMBAT_HEALING then return primaryDamage, primaryType, secondaryDamage, secondaryType end
however it still does not function as protection against anything. I tested using print functions with monster and player attacks.
It does. Now it won't reduce healing. Maybe you just didn't configure it properly. This is tested, damage is reduced.

@Edit
TFS thing again, primaryDamage is negative for you when you are damaged. Change if primaryDamage > 0 then to if primaryDamage < 0 then, same with secondaryDamage > to <.
 
im getting this error
shrine.png



Lua:
function onLogin(player)
    for aid, shrine in pairs(SHRINES_CONFIG) do
        local storage = player:getStorageValue(shrine.storage)
        if storage > 0 then
            player:setStorageValue(shrine.storage, 0)
        end
    end
    player:registerEvent("ShrinesDeath")
    player:registerEvent("ShrinesHealth")
    player:registerEvent("ShrinesKill")
    return true
end

function onLogout(player)
    for aid, shrine in pairs(SHRINES_CONFIG) do
        local storage = player:getStorageValue(shrine.storage)
        if storage > 0 then
            player:setStorageValue(shrine.storage, 0)
        end
    end
    return true
end

function onDeath(player, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified)
    for aid, shrine in pairs(SHRINES_CONFIG) do
        local storage = player:getStorageValue(shrine.storage)
        if storage > 0 then
            player:setStorageValue(shrine.storage, 0)
        end
    end
    return true
end

function onKill(player, target, lastHit)
    return Shrines_onKill(player, target, lastHit)
end

function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
    return Shrines_onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
end


Lua:
function onThink(cid, interval, lastExecution)
    for _, data in ipairs(SHRINES_DATA) do
        if data.active == 0 or data.active == nil then
            for key, value in pairs(SHRINES_CONFIG) do
                if math.random(1, 100) <= value.spawnChance then
                    local tile = Tile(data.pos)
                    if tile then
                        for _, item in ipairs(tile:getItems()) do
                            if item:getId() == SHRINES_ITEM_ID then
                                item:setActionId(key)
                                data.active = 1
                            end
                        end
                    end
                end
            end
        end
    end
    return true
end
 
Anyone has any idea what am doing wrong? I got it all working and has set spawn chance to 100% on all 4 shrines but i only get power shrine on all 4 all the time?


EDIT: Nvm i thought it was possible to have 1,2,3,4 shrines activated with all 4 bonuses at the same time.. possible maybe? So that shrine 1 always gives Power , shrine 2 always gives Protection etc etc..?
 
Last edited:
Back
Top