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

Possible to edit this script with Reborn stages?

Marko999x

999x era
Premium User
Joined
Dec 14, 2017
Messages
2,835
Solutions
82
Reaction score
1,948
Location
Germany
Is it possible to add at this script reborn stages instead of level stages? Im using tfs 0.4 and storage 85987 for reborn ^^ here the script

Lua:
local monsters = {}



monsters["rotworm"] = 1000000000
monsters["cyclops"] = 800000000
monsters["dragon"] = 2400000000
monsters["dragon lord"] = 3000000000
monsters["frost dragon"] = 10000000000
monsters["hydra"] = 12000000000
monsters["bear"] = 102000000000













local exp = {
[0.9] = {min = 1,max = 1200000},   
[0.8] = {min = 1200001,max = 2000000},
[0.7] = {min = 1600001,max = 3100000},
    }


function onKill(cid, target, damage, flags)
    local lvl = monsters[string.lower(getCreatureName(target))]
    if isMonster(target) and lvl ~= nil then
        for i,v in pairs(exp) do
            if not exhaustion.check(cid, 9023) then
                if getPlayerLevel(cid) >= v.min and getPlayerLevel(cid) < v.max then
                        doSendAnimatedText(getThingPos(cid), ""..i*lvl.."", TEXTCOLOR_WHITE)
                        doPlayerAddExp(cid,  math.floor(i * lvl))
                end
            else
                if getPlayerLevel(cid) >= v.min and getPlayerLevel(cid) < v.max then
                    local extra = (i * lvl) * 0.10
                        doSendAnimatedText(getThingPos(cid), ""..math.floor((i*lvl) + extra).."", TEXTCOLOR_WHITE)
                        doPlayerAddExp(cid,  math.floor((i * lvl) + extra))
                end
            end
            end
        end
    return true
end
 
Solution
yes, just replace getPlayerLevel(cid) with getCreatureStorage(cid, your_rebirth_storage)
then replace the min, max values in the tables with the preferred rebirths
yes, just replace getPlayerLevel(cid) with getCreatureStorage(cid, your_rebirth_storage)
then replace the min, max values in the tables with the preferred rebirths
 
Solution
yes, just replace getPlayerLevel(cid) with getCreatureStorage(cid, your_rebirth_storage)
then replace the min, max values in the tables with the preferred rebirths

Wanted to the same but wasnt sure at all xD Thanks you really much :D
 
generally it's easier to just try it first before asking if it can be done, even if you aren't sure
+ it helps you start learning how to solve your own problems

Sorry if im annonying but is there a way to have in that script stages for reborn + level ? Since normal stages aint working for that script you know ( stages.xml )
 
Bump, is there anyway to add reborn stages and level stages at same time? tfs 0.4 my script which has reborn stages alredy

Lua:
local monsters = {}



monsters["rotworm"] = 1000000000000000
monsters["cyclops"] = 800000000
monsters["dragon"] = 2400000000
monsters["dragon lord"] = 3000000000
monsters["frost dragon"] = 10000000000
monsters["hydra"] = 12000000000
monsters["bear"] = 102000000000













local exp = {
[100.0] = {min = 0,max = 25},   
[90.0] = {min = 26,max = 50},
[80.0] = {min = 51,max = 100},
[70.0] = {min = 101,max = 150},
[60.0] = {min = 151,max = 200},
[50.0] = {min = 201,max = 250},
[40.8] = {min = 251,max = 350},
[25.0] = {min = 351,max = 500},
[15.0] = {min = 501,max = 600},
[10.0] = {min = 601,max = 800},
    }


function onKill(cid, target, damage, flags)
    local lvl = monsters[string.lower(getCreatureName(target))]
    if isMonster(target) and lvl ~= nil then
        for i,v in pairs(exp) do
            if not exhaustion.check(cid, 9023) then
                if getCreatureStorage(cid, 85987) >= v.min and getCreatureStorage(cid, 85987) < v.max then
                        doSendAnimatedText(getThingPos(cid), ""..i*lvl.."", TEXTCOLOR_WHITE)
                        doPlayerAddExp(cid,  math.floor(i * lvl))
                end
            else
                if getCreatureStorage(cid, 85987) >= v.min and getCreatureStorage(cid, 85987) < v.max then
                    local extra = (i * lvl) * 0.10
                        doSendAnimatedText(getThingPos(cid), ""..math.floor((i*lvl) + extra).."", TEXTCOLOR_WHITE)
                        doPlayerAddExp(cid,  math.floor((i * lvl) + extra))
                end
            end
            end
        end
    return true
end
 
More informations? Like what should be done while you put both stages?

I do not understand your question at all to be honest but the script should be simple, there should be reborn stages ( based on storage ) and one states for standart level ( like on stages.xml ) like

( [100.0] <- is the stage ) min & max = level and reborn

  1. local exp = {
  2. [100.0] = {min = 0,max = 25},
  3. [90.0] = {min = 26,max = 50}, <- For reborn as explain
  1. local exp = {
  2. [100.0] = {min = 100000,max = 125000},
  3. [90.0] = {min = 125001,max = 150000}, <- For level
Thats all :x
 
Try:
Code:
local monsters = {}
 
monsters["rotworm"] = 1000000000000000
monsters["cyclops"] = 800000000
monsters["dragon"] = 2400000000
monsters["dragon lord"] = 3000000000
monsters["frost dragon"] = 10000000000
monsters["hydra"] = 12000000000
monsters["bear"] = 102000000000
 
local expReborn = {
[100.0] = {min = 0,max = 25}, 
[90.0] = {min = 26,max = 50},
[80.0] = {min = 51,max = 100},
[70.0] = {min = 101,max = 150},
[60.0] = {min = 151,max = 200},
[50.0] = {min = 201,max = 250},
[40.8] = {min = 251,max = 350},
[25.0] = {min = 351,max = 500},
[15.0] = {min = 501,max = 600},
[10.0] = {min = 601,max = 800},
    }
   
local expLevel = {
[100.0] = {min = 0,max = 25}, 
[90.0] = {min = 26,max = 50},
[80.0] = {min = 51,max = 100},
[70.0] = {min = 101,max = 150},
[60.0] = {min = 151,max = 200},
[50.0] = {min = 201,max = 250},
[40.8] = {min = 251,max = 350},
[25.0] = {min = 351,max = 500},
[15.0] = {min = 501,max = 600},
[10.0] = {min = 601,max = 800},
    }

function onKill(cid, target, damage, flags)

    local lvlExp = monsters[string.lower(getCreatureName(target))]
    if isMonster(target) and lvlExp ~= nil then
        for i,v in pairs(expLevel) do
            if not exhaustion.check(cid, 9023) then
                if getCreatureStorage(cid, 85987) >= v.min and getCreatureStorage(cid, 85987) < v.max then
                        doSendAnimatedText(getThingPos(cid), ""..i*lvlExp.."", TEXTCOLOR_WHITE)
                        doPlayerAddExp(cid,  math.floor(i * lvlExp))
                end
               
            else
           
                if getCreatureStorage(cid, 85987) >= v.min and getCreatureStorage(cid, 85987) < v.max then
                    local extra = (i * lvlExp) * 0.10
                        doSendAnimatedText(getThingPos(cid), ""..math.floor((i*lvlExp) + extra).."", TEXTCOLOR_WHITE)
                        doPlayerAddExp(cid,  math.floor((i * lvlExp) + extra))
                end
            end
            end
        end


    local lvlReborn = monsters[string.lower(getCreatureName(target))]
    if isMonster(target) and lvlReborn ~= nil then
        for i,v in pairs(expReborn) do
            if not exhaustion.check(cid, 9023) then
                if getCreatureStorage(cid, 85987) >= v.min and getCreatureStorage(cid, 85987) < v.max then
                        doSendAnimatedText(getThingPos(cid), ""..i*lvlReborn.."", TEXTCOLOR_WHITE)
                        doPlayerAddExp(cid,  math.floor(i * lvlReborn))
                end
               
            else
           
                if getCreatureStorage(cid, 85987) >= v.min and getCreatureStorage(cid, 85987) < v.max then
                    local extra = (i * lvlReborn) * 0.10
                        doSendAnimatedText(getThingPos(cid), ""..math.floor((i*lvlReborn) + extra).."", TEXTCOLOR_WHITE)
                        doPlayerAddExp(cid,  math.floor((i * lvlReborn) + extra))
                end
            end
            end
        end
       
    return true
end

It could be done in one table and should be shorter but I don't have time at this moment :p
It's longer version with additional table but should work.
 
Try:
Code:
local monsters = {}
 
monsters["rotworm"] = 1000000000000000
monsters["cyclops"] = 800000000
monsters["dragon"] = 2400000000
monsters["dragon lord"] = 3000000000
monsters["frost dragon"] = 10000000000
monsters["hydra"] = 12000000000
monsters["bear"] = 102000000000
 
local expReborn = {
[100.0] = {min = 0,max = 25},
[90.0] = {min = 26,max = 50},
[80.0] = {min = 51,max = 100},
[70.0] = {min = 101,max = 150},
[60.0] = {min = 151,max = 200},
[50.0] = {min = 201,max = 250},
[40.8] = {min = 251,max = 350},
[25.0] = {min = 351,max = 500},
[15.0] = {min = 501,max = 600},
[10.0] = {min = 601,max = 800},
    }
  
local expLevel = {
[100.0] = {min = 0,max = 25},
[90.0] = {min = 26,max = 50},
[80.0] = {min = 51,max = 100},
[70.0] = {min = 101,max = 150},
[60.0] = {min = 151,max = 200},
[50.0] = {min = 201,max = 250},
[40.8] = {min = 251,max = 350},
[25.0] = {min = 351,max = 500},
[15.0] = {min = 501,max = 600},
[10.0] = {min = 601,max = 800},
    }

function onKill(cid, target, damage, flags)

    local lvlExp = monsters[string.lower(getCreatureName(target))]
    if isMonster(target) and lvlExp ~= nil then
        for i,v in pairs(expLevel) do
            if not exhaustion.check(cid, 9023) then
                if getCreatureStorage(cid, 85987) >= v.min and getCreatureStorage(cid, 85987) < v.max then
                        doSendAnimatedText(getThingPos(cid), ""..i*lvlExp.."", TEXTCOLOR_WHITE)
                        doPlayerAddExp(cid,  math.floor(i * lvlExp))
                end
              
            else
          
                if getCreatureStorage(cid, 85987) >= v.min and getCreatureStorage(cid, 85987) < v.max then
                    local extra = (i * lvlExp) * 0.10
                        doSendAnimatedText(getThingPos(cid), ""..math.floor((i*lvlExp) + extra).."", TEXTCOLOR_WHITE)
                        doPlayerAddExp(cid,  math.floor((i * lvlExp) + extra))
                end
            end
            end
        end


    local lvlReborn = monsters[string.lower(getCreatureName(target))]
    if isMonster(target) and lvlReborn ~= nil then
        for i,v in pairs(expReborn) do
            if not exhaustion.check(cid, 9023) then
                if getCreatureStorage(cid, 85987) >= v.min and getCreatureStorage(cid, 85987) < v.max then
                        doSendAnimatedText(getThingPos(cid), ""..i*lvlReborn.."", TEXTCOLOR_WHITE)
                        doPlayerAddExp(cid,  math.floor(i * lvlReborn))
                end
              
            else
          
                if getCreatureStorage(cid, 85987) >= v.min and getCreatureStorage(cid, 85987) < v.max then
                    local extra = (i * lvlReborn) * 0.10
                        doSendAnimatedText(getThingPos(cid), ""..math.floor((i*lvlReborn) + extra).."", TEXTCOLOR_WHITE)
                        doPlayerAddExp(cid,  math.floor((i * lvlReborn) + extra))
                end
            end
            end
        end
      
    return true
end

It could be done in one table and should be shorter but I don't have time at this moment :p
It's longer version with additional table but should work.


Working perfect thanks but there just one small thing which is weird, why do i get two times exp when I kill a monster? xD

04:11 You advanced from Level 623205 to Level 670950.
04:11 You advanced from Level 670950 to Level 712722. killed the monster once but received double exp
 
Working perfect thanks but there just one small thing which is weird, why do i get two times exp when I kill a monster? xD

04:11 You advanced from Level 623205 to Level 670950.
04:11 You advanced from Level 670950 to Level 712722. killed the monster once but received double exp

Its maybe.. because you have an extra exp if or got reborn storage and level at the same time. I think its second option.
Code:
else                        
 if getCreatureStorage(cid, 85987) >= v.min and getCreatureStorage(cid, 85987) < v.max then
local extra = (i * lvlReborn) * 0.10
doSendAnimatedText(getThingPos(cid), ""..math.floor((i*lvlReborn) + extra).."", TEXTCOLOR_WHITE)
doPlayerAddExp(cid,  math.floor((i * lvlReborn) + extra))                end
You reading your scripts or you asking for help and you have dumped balls on this and just copy and paste into data? xD
Just modify it by yourself.
Download Notepad++ or Sublime and do something. It's easy to make LUA scripts (specially for TFS who's version 1.X+)
Only thing is that you must understand that one if must have end, etc.
 
Back
Top