• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua Why it dont work? (ADD ML)

maikons

Member
Joined
Aug 1, 2015
Messages
227
Reaction score
17
Code:
local mlqnt
mlqnt = math.ceil(getPlayerRequiredSkillTries(cid, SKILL_MAGIC, getPlayerSkillLevel(cid, SKILL_MAGIC) + 1)/3000) * (getPlayerStorageValue(cid, storages.length)) * (getPlayerStorageValue(cid, storages.difficult))


local shieldqnt
shieldqnt = math.ceil(getPlayerRequiredSkillTries(cid, SKILL_SHIELD, getPlayerSkillLevel(cid, SKILL_SHIELD) + 1)/3000) * (getPlayerStorageValue(cid, storages.length)) * (getPlayerStorageValue(cid, storages.difficult))

Code:
      local mlstages
local shieldstages
       mlstages = 40
shieldstages = 10

Code:
doPlayerAddSpentMana(cid, SKILL_MAGIC, (mlqnt / 2) * mlstages)
doPlayerAddSkillTry(cid, SKILL_SHIELD, (shieldqnt / 5) * shieldstages)
 
% of mana spent for their ml?
Code:
doPlayerAddSpentMana(cid, getPlayerRequiredMana(cid, getPlayerMagLevel(cid, true)) * 0.3, false)
 
% of mana spent for their ml?
Code:
doPlayerAddSpentMana(cid, getPlayerRequiredMana(cid, getPlayerMagLevel(cid, true)) * 0.3, false)

No i dont want give 3%..

I wanted it to be a function like this my AXE, only to ML

local axeqnt
Code:
axeqnt = math.ceil(getPlayerRequiredSkillTries(cid, SKILL_AXE, getPlayerSkillLevel(cid, SKILL_AXE) + 1)/3000) * (getPlayerStorageValue(cid, storages.length)) * (getPlayerStorageValue(cid, storages.difficult))

Code:
doPlayerAddSkillTry(cid, SKILL_AXE, axeqnt * 10)
 
What I posted is quite similar but then for ml, what I posted is 30% instead of 0.03%, so you can do * 0.0003 or / 3000 and add the storage values to the calculation if needed.
 
What I posted is quite similar but then for ml, what I posted is 30% instead of 0.03%, so you can do * 0.0003 or / 3000 and add the storage values to the calculation if needed.

Oh! Ty, then
It:
Code:
local mlqnt
mlqnt = math.ceil(doPlayerAddSpentMana( (cid, getPlayerRequiredMana(cid, getPlayerMagLevel(cid, true)) / 3000) * (getPlayerStorageValue(cid, storages.length)) * (getPlayerStorageValue(cid, storages.difficult)), false) )

=

it?

Code:
local axeqnt
axeqnt = math.ceil(getPlayerRequiredSkillTries(cid, SKILL_AXE, getPlayerSkillLevel(cid, SKILL_AXE) + 1)/3000) * (getPlayerStorageValue(cid, storages.length)) * (getPlayerStorageValue(cid, storages.difficult))
 
No, the function doPlayerAddSpentMana actually adds the mana spent, the getPlayerRequiredMana and the rest with the storage values gets the number how much, so if it should be also a number there with math.ceil, remove the parts that belong to the function doPlayerAddSpentMana.
 
No, the function doPlayerAddSpentMana actually adds the mana spent, the getPlayerRequiredMana and the rest with the storage values gets the number how much, so if it should be also a number there with math.ceil, remove the parts that belong to the function doPlayerAddSpentMana.

LOL, how i will do it without this function?
 
I mean, if you want to make a variable called mlqnt for the amount first with math.ceil, then only add the amount there and not the actual function that adds the mana spent, that should be used where it should add the mana spent.

Same as with axeqnt, that is used later with doPlayerAddSkillTry.
 
I mean, if you want to make a variable called mlqnt for the amount first with math.ceil, then only add the amount there and not the actual function that adds the mana spent, that should be used where it should add the mana spent.

Same as with axeqnt, that is used later with doPlayerAddSkillTry.

Sorry, i have so bad english
And ty to help me

Is it?
Code:
mlqnt = math.ceil(doPlayerAddSkillTry( (cid, getPlayerRequiredMana(cid, getPlayerMagLevel(cid, true)) / 3000) * (getPlayerStorageValue(cid, storages.length)) * (getPlayerStorageValue(cid, storages.difficult)) )
 
Code:
mlqnt = math.ceil(getPlayerRequiredMana(cid, getPlayerMagLevel(cid, true)) / 3000) * getPlayerStorageValue(cid, storages.length) * getPlayerStorageValue(cid, storages.difficult)
Code:
doPlayerAddSpentMana(cid, mlqnt, false)
 
Code:
mlqnt = math.ceil(getPlayerRequiredMana(cid, getPlayerMagLevel(cid, true)) / 3000) * getPlayerStorageValue(cid, storages.length) * getPlayerStorageValue(cid, storages.difficult)
Code:
doPlayerAddSpentMana(cid, mlqnt, false)

Code:
        doPlayerAddSpentMana(cid, (mlqnt / 2) * mlstages, false)
         doPlayerAddSkillTry(cid, SKILL_SHIELD, (shieldqnt / 5) * shieldstages)

When i test
WFonPBV.png
 
This is how percentages work
10% = 0.10
50% = 0.50
100% = 1.0
150% = 1.50
see the pattern here

So lets say you wanted to give a 10% bonus to a ml of 23
Code:
local ml = 23
local percentage = .10
print(ml * percentage) -- 2.3 ml
print(math.floor(ml * percentage)) -- 2 ml
print(math.ceil(ml * percentage)) -- 3 ml

Using the same values as above, you would add the current ml to the results
Code:
local ml = 23
local percentage = .10
print(ml * percentage) -- 2.3 ml
print(ml * percentage + ml ) -- 25.3 ml
print(math.floor(ml * percentage + ml)) -- 25 ml
print(math.ceil(ml * percentage + ml)) -- 26 ml
 
This is how percentages work
10% = 0.10
50% = 0.50
100% = 1.0
150% = 1.50
see the pattern here

So lets say you wanted to give a 10% bonus to a ml of 23
Code:
local ml = 23
local percentage = .10
print(ml * percentage) -- 2.3 ml
print(math.floor(ml * percentage)) -- 2 ml
print(math.ceil(ml * percentage)) -- 3 ml

Using the same values as above, you would add the current ml to the results
Code:
local ml = 23
local percentage = .10
print(ml * percentage) -- 2.3 ml
print(ml * percentage + ml ) -- 25.3 ml
print(math.floor(ml * percentage + ml)) -- 25 ml
print(math.ceil(ml * percentage + ml)) -- 26 ml

Lol... Read the topic, he dont want it
 
This is how percentages work
10% = 0.10
50% = 0.50
100% = 1.0
150% = 1.50
see the pattern here

So lets say you wanted to give a 10% bonus to a ml of 23
Code:
local ml = 23
local percentage = .10
print(ml * percentage) -- 2.3 ml
print(math.floor(ml * percentage)) -- 2 ml
print(math.ceil(ml * percentage)) -- 3 ml

Using the same values as above, you would add the current ml to the results
Code:
local ml = 23
local percentage = .10
print(ml * percentage) -- 2.3 ml
print(ml * percentage + ml ) -- 25.3 ml
print(math.floor(ml * percentage + ml)) -- 25 ml
print(math.ceil(ml * percentage + ml)) -- 26 ml


I dont understand it
How to getPlayerMagLevel(cid), and give 10%, idependet he ml?
 
Back
Top