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

TFS 1.X+ Pvpenforced Exp Tfs 1.2

abdala ragab

Veteran OT User
Joined
Aug 18, 2018
Messages
461
Solutions
11
Reaction score
340
Location
gamelaot.sytes.net
i use celohere tfs 1.2
How can I increase exp Pvpenfo
I tried a lot to modify the text and it didn't work, I only got a few levels
Does it work directly from the source?
Why is there not in config exppvpe rate like xml and otx
Do I need any modifications in the source in order to increase the level when fighting or can I just modify the text pvpenfo
Please help and thank you
Lua:
function onPrepareDeath(cid, deathList)
        local tile = getTileInfo(getPlayerPosition(cid))
        if(tile.hardcore == false) then
                local pl_count = table.getn(deathList)
                local j = 0
                for _, pid in ipairs(deathList) do
                        if (isPlayer(cid) and isPlayer(pid) and getPlayerLevel(cid) > getPlayerLevel(pid)) then
                                local priorita = 1 - (j * 0.1)
                                local exp = 0
                                if (pl_count > 2) then
                                        exp = math.floor((((1 - (getPlayerLevel(pid) * 1.0) / getPlayerLevel(cid)) * 0.05 * getPlayerExperience(cid)) / pl_count) * priorita)
                                else
                                        exp = math.floor((((1 - (getPlayerLevel(pid) * 1.0) / getPlayerLevel(cid)) * 0.05 * getPlayerExperience(cid)) / (pl_count + 2)) * priorita)
                                end
                                doPlayerAddExp(pid, exp)
                                local pos = getPlayerPosition(pid)
                                doPlayerSendTextMessage(pid, MESSAGE_EXPERIENCE, "You gained " .. exp .. " experience for killing higher level than you.", exp, COLOR_WHITE, pos)
                                for _, spec in ipairs(getSpectators(pos, 7, 5, false)) do
                                        if (isPlayer(spec) and spec ~= pid) then
                                                doPlayerSendTextMessage(spec, MESSAGE_EXPERIENCE, getCreatureName(pid) .. " gained " .. exp .. " experience for killing " .. getCreatureName(cid) .. ".", exp, COLOR_WHITE, pos)
                                        end
                                end

                        end
                        j = j + 1
                end
        end
        return true
end
 
you can make it something very simple and comfortable to choose the rates as you like exactly like this
under
if byPlayer == 1 then
add
Lua:
        local mLevel = killer:getLevel()
        local mExp = killer:getExperience()
        local mExpStage = Game.getExperienceStage(mLevel)
        local mNextExp = getExperienceForLevel(mLevel+50000)
        local mStaminaMinutes = killer:getStamina() 
        local requiredExp = mNextExp - mExp
        local protectionStorage = 472554
        local protectionPlayer = player:getId()
        local protectionCounterStorage = 472555
        local protectionCounter = killer:getStorageValue(protectionCounterStorage)
                                killer:addExperience(requiredExp, 1)

to change the exp gain you can do whatever you want in this formula in this example you add the same amount of levels

local mNextExp = getExperienceForLevel(mLevel+50000)
 
your sc
you can make it something very simple and comfortable to choose the rates as you like exactly like this
under

add
Lua:
        local mLevel = killer:getLevel()
        local mExp = killer:getExperience()
        local mExpStage = Game.getExperienceStage(mLevel)
        local mNextExp = getExperienceForLevel(mLevel+50000)
        local mStaminaMinutes = killer:getStamina()
        local requiredExp = mNextExp - mExp
        local protectionStorage = 472554
        local protectionPlayer = player:getId()
        local protectionCounterStorage = 472555
        local protectionCounter = killer:getStorageValue(protectionCounterStorage)
                                killer:addExperience(requiredExp, 1)

to change the exp gain you can do whatever you want in this formula in this example you add the same amount of levels
your script no work
Post automatically merged:

no work
Do you know which file in source for pvp enforced?
 
Last edited:
your sc

your script no work
Post automatically merged:


no work
Do you know which file in source for pvp enforced?
Its the same script that you want to use, you only need to change to another and write how much % you want to increase in this:
Lua:
local bonusPercentage = 7 -- % extra exp


Or just change this part of the original code, here:
Lua:
if (pl_count > 2) then
    exp = math.floor((((1 - (getPlayerLevel(pid) * 1.0) / getPlayerLevel(cid)) * 0.05 * getPlayerExperience(cid)) / pl_count) * priorita)
    else
    exp = math.floor((((1 - (getPlayerLevel(pid) * 1.0) / getPlayerLevel(cid)) * 0.05 * getPlayerExperience(cid)) / (pl_count + 2)) * priorita)
    end

this is the part where the experience calculation is done, you just need to modify the formula to the calculation that suits you best, for exemple, where is 1.0, modify to 2.0 and see whats hap
 
Last edited:
goto data/creaturescripts/scripts/
and send playerdeath.lua
Lua:
local deathListEnabled = true
local maxDeathRecords = 5
local killsToBan = 6
local killsBanLenght = 2

function onDeath(player, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified)
    local playerId = player:getId()
    if nextUseStaminaTime[playerId] ~= nil then
        nextUseStaminaTime[playerId] = nil
    end

    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You are dead.")

    local byPlayer = 0
    local killerName
    if killer ~= nil then
        if killer:isPlayer() then
            byPlayer = 1
        else
            local master = killer:getMaster()
            if master and master ~= killer and master:isPlayer() then
                killer = master
                byPlayer = 1
            end
        end
        killerName = killer:getName()
    else
        killerName = "field item"
    end

    local byPlayerMostDamage = 0
    local mostDamageKillerName
    if mostDamageKiller ~= nil then
        if mostDamageKiller:isPlayer() then
            byPlayerMostDamage = 1
        else
            local master = mostDamageKiller:getMaster()
            if master and master ~= mostDamageKiller and master:isPlayer() then
                mostDamageKiller = master
                byPlayerMostDamage = 1
            end
        end
        mostDamageName = mostDamageKiller:getName()
    else
        mostDamageName = "field item"
    end

    local playerGuid = player:getGuid()
    db.query("INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `is_player`, `mostdamage_by`, `mostdamage_is_player`, `unjustified`, `mostdamage_unjustified`) VALUES (" .. playerGuid .. ", " .. os.time() .. ", " .. player:getLevel() .. ", " .. db.escapeString(killerName) .. ", " .. byPlayer .. ", " .. db.escapeString(mostDamageName) .. ", " .. byPlayerMostDamage .. ", " .. (unjustified and 1 or 0) .. ", " .. (mostDamageUnjustified and 1 or 0) .. ")")
    local resultId = db.storeQuery("SELECT `player_id` FROM `player_deaths` WHERE `player_id` = " .. playerGuid)

    local deathRecords = 0
    local tmpResultId = resultId
    while tmpResultId ~= false do
        tmpResultId = result.next(resultId)
        deathRecords = deathRecords + 1
    end

    if resultId ~= false then
        result.free(resultId)
    end

    local limit = deathRecords - maxDeathRecords
    if limit > 0 then
        db.asyncQuery("DELETE FROM `player_deaths` WHERE `player_id` = " .. playerGuid .. " ORDER BY `time` LIMIT " .. limit)
    end

    if byPlayer == 1 then
        local targetGuild = player:getGuild()
        targetGuild = targetGuild and targetGuild:getId() or 0
        if targetGuild ~= 0 then
            local killerGuild = killer:getGuild()
            killerGuild = killerGuild and killerGuild:getId() or 0
            if killerGuild ~= 0 and targetGuild ~= killerGuild and isInWar(playerId, killer:getId()) then
                local warId = false
                resultId = db.storeQuery("SELECT `id` FROM `guild_wars` WHERE `status` = 1 AND ((`guild1` = " .. killerGuild .. " AND `guild2` = " .. targetGuild .. ") OR (`guild1` = " .. targetGuild .. " AND `guild2` = " .. killerGuild .. "))")
                if resultId ~= false then
                    warId = result.getDataInt(resultId, "id")
                    result.free(resultId)
                end

                if warId ~= false then
                    db.asyncQuery("INSERT INTO `guildwar_kills` (`killer`, `target`, `killerguild`, `targetguild`, `time`, `warid`) VALUES (" .. db.escapeString(killerName) .. ", " .. db.escapeString(player:getName()) .. ", " .. killerGuild .. ", " .. targetGuild .. ", " .. os.time() .. ", " .. warId .. ")")
                end
            end
        end

        local skullTime = killer:getSkullTime()
        if skullTime > 0 then
            local kills = math.ceil(skullTime / configManager.getNumber(configKeys.FRAG_TIME))
            if kills >= killsToBan then
                local timeNow = os.time()
                                db.query("INSERT INTO `player_bans` (`player_id`, `reason`, `banned_at`, `expires_at`, `banned_by`) VALUES (" .. killer:getGuid() .. ", " .. db.escapeString("Excessive Unjustified Player Killing.") .. ", " .. timeNow .. ", " .. timeNow + (killsBanLenght * 86400) .. ", 1)")
                killer:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
                killer:remove()
            end
        end
    end
    if killer == nil then
        broadcastMessage(player:getName().."["..player:getLevel().."] died. ")
    else
        if killer:isPlayer() then
            broadcastMessage(player:getName().."["..player:getLevel().."] was killed by "..killer:getName().."["..killer:getLevel().."].")
        else
            broadcastMessage(player:getName().."["..player:getLevel().."] was killed by a "..killer:getName()..".")
        end
    end
end
 
try changing this:

Lua:
local j = 0

increase 1 by 1, test and see if is good... for exemple, try j = 1 and after test, try j = 2
 
yes:

change 0.75 to higher number and recompile
Can it be added in config to control combat levels?
Post automatically merged:

yes:

change 0.75 to higher number and recompile
will need to add something similar to ConfigManager::EXP_FROM_PLAYERS_LEVEL_RANGE in source
like ConfigManager::pVPENFO_CONFIG
and i can add something like PVPENFO_CONFIG = 0.75
and in script return std::max<uint64_t>(0, std::floor(getLostExperience() * getDamageRatio(attacker) * ConfigManager::pVPENFO_CONFIG));

but i need to declare something before it will work
ConfigManager::EXP_FROM_PLAYERS_LEVEL_RANGE
later i will dont need to recompile everytime when u want to change this 0.75

cuz it will be changable in config.lua
I hope so
 
Last edited:
Back
Top