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

TalkAction Reborn System - w/ stages and look

Fire Element

Member
Joined
Sep 10, 2010
Messages
193
Reaction score
22
Location
Brazil
Based: http://otland.net/f81/reset-system-82456/

I added stages and look.

Thanks for fix conde2.

Lua:
    stage = {
        {level = 350, reborn = 4},
        {level = 355, reborn = 9},
        {level = 360, reborn = 14}
    }
1-4 reborns, level 350
5-9 reborns, level 355
10-14 reborns, level 360

lib/050-function.lua
Lua:
function getReborns(cid)
    local reborn = getPlayerStorageValue(cid, 1020)
    return reborn < 0 and 0 or reborn
end

talkactions/talkactions.xml
Code:
<talkaction words="!reborn" event="script" value="reborn.lua"/>

talkactions/scripts/reset.lua
Lua:
function onSay(cid, words, param)
    config = {
        RemainingLvl = 8, -- That level will be reborn after.
        exp = 4200, -- Experience that will be reborn after.
        pid = getPlayerGUID(cid), 
        skull = true, -- Players with white skull can reborn? (true or false).
        redskull = true, -- Players with red skull can reborn? (true or false).
        prot = true, -- Players need to be in protection zone to reborn? (true or false).
        bat = true, -- Players must be no fight to reborn (true or false).
        vip = true -- Vip system (true or false).
    }
 
    stage = {
        {level = 350, reborn = 4},
        {level = 355, reborn = 9},
        {level = 360, reborn = 14}
    }
 
    if(config.skull == false) and (getCreatureSkullType(cid) == 3) then
        doPlayerSendTextMessage(cid, 22, "Only players without white skull can reborn.")
        return true
    end
 
    if(config.redskull == false) and (getCreatureSkullType(cid) == 4) then
        doPlayerSendTextMessage(cid, 22, "Only player without red skull can reborn.")
        return true
    end
 
    if(config.prot == true) and (getTilePzInfo(getCreaturePosition(cid)) == false) then
        doPlayerSendTextMessage(cid, 22, "You need stay in PZ to reborn.")
        return true
    end
 
    if(config.bat == true) and (getCreatureCondition(cid, CONDITION_INFIGHT) == true) then
        doPlayerSendTextMessage(cid, 22, "Players without battle can reborn.")
        return true
    end
 
    for _, k in ipairs(stage) do
        if getReborns(cid) <= k.reborn then
            if getPlayerLevel(cid) >= k.level then
               setPlayerStorageValue(cid, 1020, getReborns(cid)+1)
               doPlayerPopupFYI(cid, "You now was reborn, you have "..getReborns(cid)+(1).." reborn\'s.")
               doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
               doRemoveCreature(cid)
               db.executeQuery("UPDATE `players` SET `level` = "..config.RemainingLvl..", `experience` = "..config.exp.." WHERE `id` = "..config.pid)
            else
               doPlayerSendCancel(cid, "You need to have level "..k.level.." or more you may be reborn.")
               doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
            end
        end
    end
    return true
end

creaturescripts/scripts/reborn.lua
Lua:
function onLook(cid, thing, position, lookDistance)
    if(not isPlayer(thing.uid)) then
        return true
    end

    if (isPlayer(thing.uid) == true) then	
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You see "..getCreatureName(thing.uid).."(Level "..getPlayerLevel(thing.uid)..") [Reset "..getReborns(thing.uid).."]. "..(getPlayerSex(thing.uid) == 0 and "She" or "He").." is a "..getVocationInfo(getPlayerVocation(thing.uid)).name..".")
    end
    return false
end

creautrescripts/creaturescripts.xml
Code:
    <event type="look" name="reborn" event="script" value="reborn.lua"/>
 
Last edited:
a little improvement:

Code:
function getReborns(cid)
    local reborn = getPlayerStorageValue(cid, 1020)
    return reborn < 0 and 0 or reborn
end

In look function don't use doPlayerSendTextMessage use doPlayerSetSpecialDescription(cid, desc)
 
@up
Only remove this line.
Lua:
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))

Added vip system.
 
Cool, does this work for TFS 0.3.6? :)

EDIT: Tried it but it did'nt work properly for me.. When I type !reborn nothing happens and I gets no error(s) in the console.. What could possible be wrong?
 
Last edited:
like 80% of scripts here, you didnt write what it doing
 
look don't work, could someone help me? i add creatureevents
 
chance

Lua:
function onLook(cid, thing, position, lookDistance)
    if(not isPlayer(thing.uid)) then
        return true
    end
 
    if (isPlayer(thing.uid) == true) then	
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You see "..getCreatureName(thing.uid).."(Level "..getPlayerLevel(thing.uid)..") [Reset "..getReborns(thing.uid).."]. "..(getPlayerSex(thing.uid) == 0 and "She" or "He").." is a "..getVocationInfo(getPlayerVocation(thing.uid)).name..".")
    end
    return false
end


to


Lua:
function onLook(cid, thing, position, lookDistance)
	if(isPlayer(thing.uid) and thing.uid ~= cid and getCreatureStorage(thing.uid, 1020) ~= -1) then
		doPlayerSetSpecialDescription(thing.uid, (getPlayerSex(thing.uid) == PLAYERSEX_FEMALE and ".\nShe" or ".\nHe") .. " has Rebirth " .. getCreatureStorage(thing.uid, 1020) .. " " .. (getCreatureStorage(thing.uid, 1020) == 1 and "time" or "times"))
	elseif(thing.uid == cid and getCreatureStorage(cid, 1020) ~= -1) then
		local message = "You see yourself."
		if(getPlayerFlagValue(cid, PLAYERFLAG_SHOWGROUPINSTEADOFVOCATION)) then
			message = message .. " You are " .. getPlayerGroupName(cid) .. "."
		elseif(getPlayerVocation(cid) ~= 0) then
			message = message .. " You are a " .. getPlayerVocationName(cid):lower() .. "."
		else
			message = message .. " You have no vocation."
		end
 
		if(getPlayerNameByGUID(getPlayerPartner(cid), false, false) ~= nil) then
			message = message .. " You are " .. (getPlayerSex(cid) == PLAYERSEX_FEMALE and "wife" or "husband") .. " of " .. getPlayerNameByGUID(getPlayerPartner(cid)) .. "."
		end
		
		if(getPlayerGuildId(cid) > 0) then
			message = message .. " You are " .. (getPlayerGuildRank(cid) == "" and "a member" or getPlayerGuildRank(cid)) .. " of the " .. getPlayerGuildName(cid)
			message = getPlayerGuildNick(cid) ~= "" and message .. " (" .. getPlayerGuildNick(cid) .. ")." or message .. "."
		end
 
		if(getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEECREATUREDETAILS)) then
			message = message .. "\nHealth: [" .. getCreatureHealth(cid) .. " / " .. getCreatureMaxHealth(cid) .. "], Mana: [" .. getCreatureMana(cid) .. " / " .. getCreatureMaxMana(cid) .. "]."
			message = message .. "\nIP: " .. doConvertIntegerToIp(getPlayerIp(cid)) .. "."
		end
 
		if(getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEEPOSITION)) then
			message = message .. "\nPosition: [X: " .. position.x .. "] [Y: " .. position.y .. "] [Z: " .. position.z .. "]."
		end
 
		return false, doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, message .. " \nYou have rebirth " .. getCreatureStorage(cid, 1020) .. " " .. (getCreatureStorage(cid, 1020) == 1 and "time." or "times."))
	end
 
	return true
end


reb if this work
 
be added to this script every time you reset, you will add hp and mana?
example:
190 hp + 1 reset = 205 hp
35 mana + 1 reset = 95 mana
 
Back
Top