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

How to change SKILLS losses on death

luccagomes

New Member
Joined
Jul 30, 2015
Messages
153
Reaction score
1
How to change skill losses when player die?
I want to increase 5 times more than the current

But i don't want change exp on death... Only SKILLS and ML

In my config.lua my deathlosspercent is
Code:
deathLostPercent = 20

I'm using 0.4
 
creaturescript.xml
Code:
<event type="death" name="onDeath" script="onDeath.lua"/>
then build a script from this
Code:
function onDeath(cid, corpse)
if isPlayer(cid) then
-- remove xp / skills etc
end
return true
end
this may not be entirely correct since ive never really used 0.4, but it should be something like this
 
Last edited:
creaturescript.xml
Code:
<event type="death" name="onDeath" script="onDeath.lua"/>
then build a script from this
Code:
function onDeath(cid, corpse)
if isPlayer(cid) then
-- remove xp / skills etc
end
return true
end
this may not be entirely correct since ive never really used 0.4, but it should be something like this

Oh i know make onplayerdeath base

I asked about lua functions change xp/skills rates
 
im not sure what theyre called in 0.4, but in 1.x you can use
doPlayerAddSkillTry(cid, skillid, -(tries))
doPlayerAddExp(cid, -(exp))
etc
just regular add xp/skills but negative values
 
im not sure what theyre called in 0.4, but in 1.x you can use
doPlayerAddSkillTry(cid, skillid, -(tries))
doPlayerAddExp(cid, -(exp))
etc
just regular add xp/skills but negative values

There is a way to get
doPlayerAddSkillTry
doPlayerAddExp
ML?

And get for exemple:
Code:
if(skills >= 1 && <= 50)
{
    when die -1 skills
}
else if(skills >= 51 && <= 60)
{
    when die -2 skills
}
....
 
http://tibia.wikia.com/wiki/Formulae
theres formulas on how many tries / mana spent is required per lvlup, you'd have to write ur own functions to calculate how much to lose
for example if a player has 50 sword and you want them to lose 50% of the skill tries (not 50% skill value) you could do like
Code:
local tries = 0
for i=1,skill,1 do
tries = tries + (50*(y^(skill-10)))
end
and then you can do -(tries/2) for example, Y is vocation constant which you can see in the linked page

i dont think theres an "easy" way to make someone lose x% of skill progress however
 
I'm on right way?
Code:
local value_shield
if (getPlayerSkill(cid, SKILL_SHIELD) >= 1 and getPlayerSkill(cid, SKILL_SHIELD) <= 20 ) then
   value_shield = 0
elseif (getPlayerSkill(cid, SKILL_SHIELD) >= 21 and getPlayerSkill(cid, SKILL_SHIELD) <= 40 ) then
   value_shield = 1
elseif (getPlayerSkill(cid, SKILL_SHIELD) >= 41 and getPlayerSkill(cid, SKILL_SHIELD) <= 50 ) then
   value_shield = 2
elseif (getPlayerSkill(cid, SKILL_SHIELD) >= 51 and getPlayerSkill(cid, SKILL_SHIELD) <= 70 ) then
   value_shield = 3
elseif (getPlayerSkill(cid, SKILL_SHIELD) >= 71 and getPlayerSkill(cid, SKILL_SHIELD) <= 80 ) then
   value_shield = 4
elseif (getPlayerSkill(cid, SKILL_SHIELD) >= 81 and getPlayerSkill(cid, SKILL_SHIELD) <= 99 ) then
   value_shield = 5
elseif (getPlayerSkill(cid, SKILL_SHIELD) >= 100 ) then
   value_shield = 6
end

local value_sword
if (getPlayerSkill(cid, SKILL_SWORD) >= 1 and getPlayerSkill(cid, SKILL_SWORD) <= 20 ) then
   value_sword = 0
elseif (getPlayerSkill(cid, SKILL_SWORD) >= 21 and getPlayerSkill(cid, SKILL_SWORD) <= 40 ) then
   value_sword = 1
elseif (getPlayerSkill(cid, SKILL_SWORD) >= 41 and getPlayerSkill(cid, SKILL_SWORD) <= 50 ) then
   value_sword = 2
elseif (getPlayerSkill(cid, SKILL_SWORD) >= 51 and getPlayerSkill(cid, SKILL_SWORD) <= 70 ) then
   value_sword = 3
elseif (getPlayerSkill(cid, SKILL_SWORD) >= 71 and getPlayerSkill(cid, SKILL_SWORD) <= 80 ) then
   value_sword = 4
elseif (getPlayerSkill(cid, SKILL_SWORD) >= 81 and getPlayerSkill(cid, SKILL_SWORD) <= 99 ) then
   value_sword = 5
elseif (getPlayerSkill(cid, SKILL_SWORD) >= 100 ) then
   value_sword = 6
end

local value_axe
if (getPlayerSkill(cid, SKILL_AXE) >= 1 and getPlayerSkill(cid, SKILL_AXE) <= 20 ) then
   value_axe = 0
elseif (getPlayerSkill(cid, SKILL_AXE) >= 21 and getPlayerSkill(cid, SKILL_AXE) <= 40 ) then
   value_axe = 1
elseif (getPlayerSkill(cid, SKILL_AXE) >= 41 and getPlayerSkill(cid, SKILL_AXE) <= 50 ) then
   value_axe = 2
elseif (getPlayerSkill(cid, SKILL_AXE) >= 51 and getPlayerSkill(cid, SKILL_AXE) <= 70 ) then
   value_axe = 3
elseif (getPlayerSkill(cid, SKILL_AXE) >= 71 and getPlayerSkill(cid, SKILL_AXE) <= 80 ) then
   value_axe = 4
elseif (getPlayerSkill(cid, SKILL_AXE) >= 81 and getPlayerSkill(cid, SKILL_AXE) <= 99 ) then
   value_axe = 5
elseif (getPlayerSkill(cid, SKILL_AXE) >= 100 ) then
   value_axe = 6
end

local value_axe
if (getPlayerSkill(cid, SKILL_CLUB) >= 1 and getPlayerSkill(cid, SKILL_CLUB) <= 20 ) then
   value_club = 0
elseif (getPlayerSkill(cid, SKILL_CLUB) >= 21 and getPlayerSkill(cid, SKILL_CLUB) <= 40 ) then
   value_club = 1
elseif (getPlayerSkill(cid, SKILL_CLUB) >= 41 and getPlayerSkill(cid, SKILL_CLUB) <= 50 ) then
   value_club = 2
elseif (getPlayerSkill(cid, SKILL_CLUB) >= 51 and getPlayerSkill(cid, SKILL_CLUB) <= 70 ) then
   value_club = 3
elseif (getPlayerSkill(cid, SKILL_CLUB) >= 71 and getPlayerSkill(cid, SKILL_CLUB) <= 80 ) then
   value_club = 4
elseif (getPlayerSkill(cid, SKILL_CLUB) >= 81 and getPlayerSkill(cid, SKILL_CLUB) <= 99 ) then
   value_club = 5
elseif (getPlayerSkill(cid, SKILL_CLUB) >= 100 ) then
   value_club = 6
end


local value_lvl
local value_ml


local bless = {1, 2, 3, 4, 5}
for i = 1, table.maxn(bless) do
   if(getPlayerBlessing(cid, bless[i])) then
     value_shield = value_shield / 2
     value_sword = value_sword / 2
     value_club = value_club / 2
     value_axe = value_axe / 2
     -- value_ml
     -- value_lvl
   end
end


function onDeath(cid, corpse)
if isPlayer(cid) then
   doPlayerAddSkillTry(cid, SKILL_SHIELD, -value_shield)
   doPlayerAddSkillTry(cid, SKILL_SWORD,-value_sword)
   doPlayerAddSkillTry(cid, SKILL_CLUB, -value_club)
   doPlayerAddSkillTry(cid, SKILL_AXE,  -value_axe)
   -- value_ml
   -- value_lvl
end
return true
end
 
how much do you want people to lose on death? do you want them to lose a different % of total tries at higher skill?

also
Code:
local tries = 0
local skill = 50
for i=10,skill,1 do
tries = tries + (50*(y^(skill-10)))
end
gives the total amount of tries they have done to acquire their current lvl (does not count current skill progress)

30 = 7063, 40 = 27046 for example, then you can remove half or w/e etc

meanwhile mana spent in total is
Code:
1600 * (((b^mlvl)-1) / (b-1))
where b is vocation constant said on formulae page
 
Last edited:
Back
Top