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

Lua [TALKACTIONS] Rebirth Help!

_Arthur

Joined
Oct 22, 2009
Messages
2,190
Reaction score
143
Well, I've tried using Macryz~'s rebirth script, but this is what happens..

18:23 You see Strange Disease. He is on Ascension # 2. He is on Ascension # 3. He is on Ascension # 4 (Level 23). She is an elite knight.

After every rebirth, it will add the entire sentence +1 for the number value of rebirths after each rebirth.. ALSO, I would like the gender fixed on rebirths...

If anyone could help me, I would greatly appreciate it.

Rep++ for solution? :x

Solved. <3
 
Last edited:
ALSO, if you could edit it so when you rebirth, every time you only keep 20% of your current max hp and 20% your current max mana? D::::::::::: I'll PAY somebody to do this for me, that's how badly I need it.... >.<
 
Lua:
local t = {
	level=700, -- level required for rebirth
	RemainingLvl=8, -- {8} = level(normal) level you become after the rebirth
	skull=true, -- players with white skull can ascend?
	redskull=true, -- players with red skull can ascend?
	prot=true, -- players must be in protection zone to ascend?
	bat=true -- players must not have battle condition to ascend?
}

local function getResets(cid)
	return math.max(0, getPlayerStorageValue(cid, 1020))
end

function onSay(cid, words, param)
	local skull = getCreatureSkullType(cid)
	if (not t.skull and skull == SKULL_WHITE) or (not t.redskull and skull == SKULL_RED) then
		doPlayerSendTextMessage(cid, 22, 'You cannot ascend with a ' .. (skull == SKULL_WHITE and 'white' or 'red') .. ' skull.')
	end

	local pos = getThingPos(cid)
	if t.prot and not getTileInfo(pos).protection then
		return doPlayerSendTextMessage(cid, 22, 'You must be in a protection zone to ascend.')
	elseif t.bat and hasCondition(cid, CONDITION_INFIGHT) then
		return doPlayerSendTextMessage(cid, 22, 'You must lose your battle sign to ascend.')
	end

	local lvl = getPlayerLevel(cid)
	if lvl >= t.level then
		local new, newLvl = getResets(cid) + 1, math.max(t.RemainingLvl, t.RemainingLvl + lvl - t.level)
		setPlayerStorageValue(cid, 1020, new)
		doPlayerSetSpecialDescription(cid, '. ' .. (getPlayerSex(cid) == 0 and 'Sh' or 'H') .. 'e is on Ascension # ' .. new)
		doPlayerPopupFYI(cid, 'You have ascended, and you now have ' .. new .. ' reset' .. (new == 1 and '' or 's') .. ' in total.')
		doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
		local pid, hp, mana = getPlayerGUID(cid), math.ceil(getCreatureMaxHealth(cid) * 0.2), math.ceil(getCreatureMaxMana(cid) * 0.2)
		doRemoveCreature(cid)
		db.executeQuery('UPDATE `players` SET `level` = ' .. newLvl .. ', `experience` = ' .. getExperienceForLevel(newLvl) .. ', `promotion` = 0, `health` = ' .. hp ..', `healthmax` = ' .. hp .. ', `mana` = ' .. mana .. ', `manamax` = ' .. mana .. ' WHERE `id` = ' .. pid .. ' LIMIT 1;')
	else
		doPlayerSendCancel(cid, 'You need to reach level ' .. t.level .. ' or higher to ascend.')
		doSendMagicEffect(pos, CONST_ME_POFF)
	end
	return true
end
 
Lua:
local t = {
	level=700, -- level required for rebirth
	RemainingLvl=8, -- {8} = level(normal) level you become after the rebirth
	skull=true, -- players with white skull can ascend?
	redskull=true, -- players with red skull can ascend?
	prot=true, -- players must be in protection zone to ascend?
	bat=true -- players must not have battle condition to ascend?
}

local function getResets(cid)
	return math.max(0, getPlayerStorageValue(cid, 1020))
end

function onSay(cid, words, param)
	local skull = getCreatureSkullType(cid)
	if (not t.skull and skull == SKULL_WHITE) or (not t.redskull and skull == SKULL_RED) then
		doPlayerSendTextMessage(cid, 22, 'You cannot ascend with a ' .. (skull == SKULL_WHITE and 'white' or 'red') .. ' skull.')
	end

	local pos = getThingPos(cid)
	if t.prot and not getTileInfo(pos).protection then
		return doPlayerSendTextMessage(cid, 22, 'You must be in a protection zone to ascend.')
	elseif t.bat and hasCondition(cid, CONDITION_INFIGHT) then
		return doPlayerSendTextMessage(cid, 22, 'You must lose your battle sign to ascend.')
	end

	local lvl = getPlayerLevel(cid)
	if lvl >= t.level then
		local new, newLvl = getResets(cid) + 1, math.max(t.RemainingLvl, t.RemainingLvl + lvl - t.level)
		setPlayerStorageValue(cid, 1020, new)
		doPlayerSetSpecialDescription(cid, '. ' .. (getPlayerSex(cid) == 0 and 'Sh' or 'H') .. 'e is on Ascension # ' .. new)
		doPlayerPopupFYI(cid, 'You have ascended, and you now have ' .. new .. ' reset' .. (new == 1 and '' or 's') .. ' in total.')
		doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
		local pid, hp, mana = getPlayerGUID(cid), math.ceil(getCreatureMaxHealth(cid) * 0.2), math.ceil(getCreatureMaxMana(cid) * 0.2)
		doRemoveCreature(cid)
		db.executeQuery('UPDATE `players` SET `level` = ' .. newLvl .. ', `experience` = ' .. getExperienceForLevel(newLvl) .. ', `promotion` = 0, `health` = ' .. hp ..', `healthmax` = ' .. hp .. ', `mana` = ' .. mana .. ', `manamax` = ' .. mana .. ' WHERE `id` = ' .. pid .. ' LIMIT 1;')
	else
		doPlayerSendCancel(cid, 'You need to reach level ' .. t.level .. ' or higher to ascend.')
		doSendMagicEffect(pos, CONST_ME_POFF)
	end
	return true
end

LOSE. :<

Code:
[06/10/2010 05:38:22] [Error - LuaScriptInterface::loadFile] data/talkactions/scripts/ascention.lua:54: unfinished string near '"'UPDATE `players` SET `level` = ' .. newLvl .. ', `experience` = ' .. getExperienceForLevel(newLvl) .. ', `promotion` = 0, `health` = ' .. hp ..', `healthmax` = ' .. hp .. ', `mana` = ' .. mana .. ', `manamax` = ' .. mana .. ' WHERE `id` = ' .. pid .. ' LIMIT 1;')'
[06/10/2010 05:38:22] [Warning - Event::loadScript] Cannot load script (data/talkactions/scripts/ascention.lua)
[06/10/2010 05:38:22] data/talkactions/scripts/ascention.lua:54: unfinished string near '"'UPDATE `players` SET `level` = ' .. newLvl .. ', `experience` = ' .. getExperienceForLevel(newLvl) .. ', `promotion` = 0, `health` = ' .. hp ..', `healthmax` = ' .. hp .. ', `mana` = ' .. mana .. ', `manamax` = ' .. mana .. ' WHERE `id` = ' .. pid .. ' LIMIT 1;')'
 
Code:
local t = {
	level=700, -- level required for rebirth
	RemainingLvl=8, -- {8} = level(normal) level you become after the rebirth
	skull=true, -- players with white skull can ascend?
	redskull=true, -- players with red skull can ascend?
	prot=true, -- players must be in protection zone to ascend?
	bat=true -- players must not have battle condition to ascend?
}
 
local function getResets(cid)
	return math.max(0, getPlayerStorageValue(cid, 1020))
end
 
function onSay(cid, words, param)
	local skull = getCreatureSkullType(cid)
	if (not t.skull and skull == SKULL_WHITE) or (not t.redskull and skull == SKULL_RED) then
		doPlayerSendTextMessage(cid, 22, 'You cannot ascend with a ' .. (skull == SKULL_WHITE and 'white' or 'red') .. ' skull.')
	end
 
	local pos = getThingPos(cid)
	if t.prot and not getTileInfo(pos).protection then
		return doPlayerSendTextMessage(cid, 22, 'You must be in a protection zone to ascend.')
	elseif t.bat and hasCondition(cid, CONDITION_INFIGHT) then
		return doPlayerSendTextMessage(cid, 22, 'You must lose your battle sign to ascend.')
	end
 
	local lvl = getPlayerLevel(cid)
	if lvl >= t.level then
		local new, newLvl = getResets(cid) + 1, math.max(t.RemainingLvl, t.RemainingLvl + lvl - t.level)
		setPlayerStorageValue(cid, 1020, new)
		doPlayerSetSpecialDescription(cid, '. ' .. (getPlayerSex(cid) == 0 and 'Sh' or 'H') .. 'e is on Ascension # ' .. new)
		doPlayerPopupFYI(cid, 'You have ascended, and you now have ' .. new .. ' reset' .. (new == 1 and '' or 's') .. ' in total.')
		doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
		local pid, hp, mana = getPlayerGUID(cid), math.ceil(getCreatureMaxHealth(cid) * (0.2 * new)), math.ceil(getCreatureMaxMana(cid) * (0.2 * new))
		doRemoveCreature(cid)
		db.executeQuery('UPDATE `players` SET `level` = ' .. newLvl .. ', `experience` = ' .. getExperienceForLevel(newLvl) .. ', `promotion` = 0, `health` = ' .. hp ..', `healthmax` = ' .. hp .. ', `mana` = ' .. mana .. ', `manamax` = ' .. mana .. ' WHERE `id` = ' .. pid .. ' LIMIT 1;')
	else
		doPlayerSendCancel(cid, 'You need to reach level ' .. t.level .. ' or higher to ascend.')
		doSendMagicEffect(pos, CONST_ME_POFF)
	end
	return true
end
 
Code:
local t = {
	level=700, -- level required for rebirth
	RemainingLvl=8, -- {8} = level(normal) level you become after the rebirth
	skull=true, -- players with white skull can ascend?
	redskull=true, -- players with red skull can ascend?
	prot=true, -- players must be in protection zone to ascend?
	bat=true -- players must not have battle condition to ascend?
}
 
local function getResets(cid)
	return math.max(0, getPlayerStorageValue(cid, 1020))
end
 
function onSay(cid, words, param)
	local skull = getCreatureSkullType(cid)
	if (not t.skull and skull == SKULL_WHITE) or (not t.redskull and skull == SKULL_RED) then
		doPlayerSendTextMessage(cid, 22, 'You cannot ascend with a ' .. (skull == SKULL_WHITE and 'white' or 'red') .. ' skull.')
	end
 
	local pos = getThingPos(cid)
	if t.prot and not getTileInfo(pos).protection then
		return doPlayerSendTextMessage(cid, 22, 'You must be in a protection zone to ascend.')
	elseif t.bat and hasCondition(cid, CONDITION_INFIGHT) then
		return doPlayerSendTextMessage(cid, 22, 'You must lose your battle sign to ascend.')
	end
 
	local lvl = getPlayerLevel(cid)
	if lvl >= t.level then
		local new, newLvl = getResets(cid) + 1, math.max(t.RemainingLvl, t.RemainingLvl + lvl - t.level)
		setPlayerStorageValue(cid, 1020, new)
		doPlayerSetSpecialDescription(cid, '. ' .. (getPlayerSex(cid) == 0 and 'Sh' or 'H') .. 'e is on Ascension # ' .. new)
		doPlayerPopupFYI(cid, 'You have ascended, and you now have ' .. new .. ' reset' .. (new == 1 and '' or 's') .. ' in total.')
		doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
		local pid, hp, mana = getPlayerGUID(cid), math.ceil(getCreatureMaxHealth(cid) * (0.2 * new)), math.ceil(getCreatureMaxMana(cid) * (0.2 * new))
		doRemoveCreature(cid)
		db.executeQuery('UPDATE `players` SET `level` = ' .. newLvl .. ', `experience` = ' .. getExperienceForLevel(newLvl) .. ', `promotion` = 0, `health` = ' .. hp ..', `healthmax` = ' .. hp .. ', `mana` = ' .. mana .. ', `manamax` = ' .. mana .. ' WHERE `id` = ' .. pid .. ' LIMIT 1;')
	else
		doPlayerSendCancel(cid, 'You need to reach level ' .. t.level .. ' or higher to ascend.')
		doSendMagicEffect(pos, CONST_ME_POFF)
	end
	return true
end

doPlayerSetSpecialDescription = no work

doPlayerSetNameDescription(cid, '. ' .. (getPlayerSex(cid) == 0 and 'Sh' or 'H') .. 'e is on Ascension # ' .. new) = work


all = 06:38 You see Eh. He is on Ascension # 3. He is on Ascension # 4. He is on Ascension # 5 (Level 8). He is a knight.

= no work :S :S
 
Back
Top