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

NPC Prestige/rebirth System with onlook working

Give me a few hours ill do it later just got my internet back up at home. got to get my ot running first then ill get on it bud.
 
mm thanks for this but actually it kinda doesnt work for me :/ i wanted to make rebirth from level 717217 and i dont need to be promoted and also no cost for rebirthing but i ruined the script when i made my edits and now even if i placed the npc on the map he doesnt show up where he should... can u fix me ur script to my likings? id appreciate it very much :)

EDIT : heres my script if u can tell me what i did wrong

Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
 
function onCreatureAppear(cid)				npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid)			npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg)			npcHandler:onCreatureSay(cid, type, msg) end
function onThink()					npcHandler:onThink() end
 
function creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return false
	end
 
	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
 
	if(msgcontains(msg, 'prestige')) then
		selfSay('Are you ready to prestige and start a new life?', cid)
		talkState[talkUser] = 1
	elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
		-------CONFIGS-------
		local level = 717217 
		local cost = 0
		------/CONFIGS-------
		-----LOCALS-----
		local id = getPlayerGUID(cid)
		local name = getCreatureName(cid)
		----/LOCALS-----
		if(getPlayerLevel(cid) >= level) then
			if(doPlayerRemoveMoney(cid, cost) == TRUE) then
				if(isInArray({1,2,3,4}, vocation)) then
					doCreatureSetStorage(cid, 85987, storage == -1 and 1 or storage + 1)
					doRemoveCreature(cid)
					db.executeQuery("UPDATE `players` SET `level` = 8, `experience` = 4200, `healthmax` = 2000, `manamax` = 2000, `promotion` = 0 WHERE `id` ='"..id.."';")
					db.executeQuery("UPDATE `players` SET `name` = '"..name.."' WHERE `id` ='"..id.."';")
				else
					selfSay('Please talk with Forgotten King and promote first.', cid)
					talkState[talkUser] = 0
				end
			else
				selfSay('You don't have enough money. You need to pay 10 mil to be rebirthed.', cid)
				talkState[talkUser] = 0
			end
		else
			selfSay('Only characters of level 100000 or higher can be rebirthed.', cid)
			talkState[talkUser] = 0
		end
	elseif(msgcontains(msg, 'no') and talkState[talkUser] == 1) then
		selfSay('Okey. Come back when you feel ready.', cid)
		talkState[talkUser] = 0
	end
 
	return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Here try this:
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
 
function onCreatureAppear(cid)				npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid)			npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg)			npcHandler:onCreatureSay(cid, type, msg) end
function onThink()					npcHandler:onThink() end
 
function creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return false
	end
 
	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
 
	if(msgcontains(msg, 'prestige')) then
		selfSay('Are you ready to prestige and start a new life?', cid)
		talkState[talkUser] = 1
	elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
		-------CONFIGS-------
		local level = 717217
		local cost = 0
		------/CONFIGS-------
		-----LOCALS-----
		local id = getPlayerGUID(cid)
		local name = getCreatureName(cid)
		local vocation = getPlayerVocation(cid)
		local storage = getCreatureStorage(cid, 85987)
		----/LOCALS-----
		if(getPlayerLevel(cid) >= level) then
			if(doPlayerRemoveMoney(cid, cost) == TRUE) then
				if(isInArray({1, 2, 3, 4}, vocation)) then
					doCreatureSetStorage(cid, 85987, storage == -1 and 1 or storage + 1)
					doRemoveCreature(cid)
					db.executeQuery("UPDATE `players` SET `level` = 8, `experience` = 4200, `healthmax` = 2000, `manamax` = 2000, `promotion` = 0 WHERE `id` ='"..id.."';")
					db.executeQuery("UPDATE `players` SET `name` = '"..name.."' WHERE `id` ='"..id.."';")
				else
					selfSay('Please talk with Forgotten King and promote first.', cid)
					talkState[talkUser] = 0
				end
			else
				selfSay('You don\'t have enough money. You need to pay 0 mil to be rebirthed.', cid)
				talkState[talkUser] = 0
			end
		else
			selfSay('Only characters of level 717217 or higher can be rebirthed.', cid)
			talkState[talkUser] = 0
		end
	elseif(msgcontains(msg, 'no') and talkState[talkUser] == 1) then
		selfSay('Okey. Come back when you feel ready.', cid)
		talkState[talkUser] = 0
	end
 
	return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Actually, with that new script i need Promotion, i it bugs e.e

23:43 You see yourself. You are a master sorcerer.
23:44 The Forgotten King: Welcome, Paralick! I have been expecting you.
23:44 Prestige Npc: Hello Paralick. Im in charge of the 'Prestige' system.
23:44 Paralick [54126: prestige
23:44 Prestige Npc: Are you ready to prestige and start a new life?
23:44 Paralick [54126: yes
23:44 Prestige Npc: Please talk with Forgotten King and promote first.
 
im using The Forgotten Server Version 0.3.4 and i have an error appear when i talk to npc would you plz fix for me rep++



[17/12/2011 03:04:53] Lua Script Error: [Npc interface]
[17/12/2011 03:04:53] data/npc/scripts/rebirth.lua:eek:nCreatureSay

[17/12/2011 03:04:53] data/npc/scripts/rebirth.lua:30: attempt to call global 'getCreatureStorage' (a nil value)
[17/12/2011 03:04:53] stack traceback:
[17/12/2011 03:04:53] data/npc/scripts/rebirth.lua:30: in function 'callback'
[17/12/2011 03:04:53] [string "?"]:374: in function 'onCreatureSay'
[17/12/2011 03:04:53] data/npc/scripts/rebirth.lua:8: in function <data/npc/scripts/rebirth.lua:8>
 
Last edited:
i have a question. with this system a char is going to be rebirth to 8 with lvl lvl 8 hp/mana + 2k hp/mana from rebirth? also how can i edit to be different for every vocation adding knights and paladin skills and mages magic lvl.

nvm didnt see second script
 
Last edited:
the onlook part of the code doesn't seem to be working for me? i could i have done wrong because i get no.
 
Last edited:
I think it is great I am going to try make it work with [8.70 - The Forgotten Server - Version 0.2.10 (Mystic Spirit) -win32gui] for my next release of Roxor Server.
 
Really annoying me now, i would love some help if i could,

23:07 Prestige Npc: Please talk with Forgotten King and promote first.

but yet i have promoted and there are no more promotions? :S

23:09 You see yourself. You are a elite knight.

Why cant i prestige? :( Is there anyway i can take the promotion required off?
 
[27/02/2012 05:02:09] Lua Script Error: [Npc interface]
[27/02/2012 05:02:09] data/npc/scripts/rebirth.lua:eek:nCreatureSay

[27/02/2012 05:02:09] data/npc/scripts/rebirth.lua:30: attempt to call global 'getCreatureStorage' (a nil value)
[27/02/2012 05:02:09] stack traceback:
[27/02/2012 05:02:09] data/npc/scripts/rebirth.lua:30: in function 'callback'
[27/02/2012 05:02:09] data/npc/lib/npcsystem/npchandler.lua:374: in function 'onCreatureSay'
[27/02/2012 05:02:09] data/npc/scripts/rebirth.lua:8: in function <data/npc/scripts/rebirth.lua:8>



I have tried and tried to find other scripts and even change bits of the script to make it work but nothing is working for me please help.
 
Sorry guys i recently moved and just got internet back. But im back again.

@ghost nice, if you need any help with it let me know im looking for to be apart of a team. Tired of running my last one on my own.
@johnjohn what server you trying to run it own?
@xiPlotPlick try this =Paste the following script below in your npc/scripts folder and save it as Rebirth.lua
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
 
function onCreatureAppear(cid)				npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid)			npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg)			npcHandler:onCreatureSay(cid, type, msg) end
function onThink()					npcHandler:onThink() end
 
function creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return false
	end
 
	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
 
	if(msgcontains(msg, 'prestige')) then
		selfSay('Are you ready to prestige and start a new life?', cid)
		talkState[talkUser] = 1
	elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
		-------CONFIGS-------
		local level = 100000 
		local cost = 10000000
		------/CONFIGS-------
		-----LOCALS-----
		local id = getPlayerGUID(cid)
		local name = getCreatureName(cid)
		local vocation = getPlayerVocation(cid)
		local storage = getCreatureStorage(cid, 85987)
		----/LOCALS-----
		if(getPlayerLevel(cid) >= level) then
			if(doPlayerRemoveMoney(cid, cost) == TRUE) then
				if(isInArray({5, 6, 7, 8}, vocation)) then
					doCreatureSetStorage(cid, 85987, storage == -1 and 1 or storage + 1)
					doRemoveCreature(cid)
					db.executeQuery("UPDATE `players` SET `level` = 8, `experience` = 4200, `healthmax` = 2000, `manamax` = 2000, `promotion` = 0 WHERE `id` ='"..id.."';")
					db.executeQuery("UPDATE `players` SET `name` = '"..name.."' WHERE `id` ='"..id.."';")
				else
					selfSay('Please talk with Forgotten King and promote first.', cid)
					talkState[talkUser] = 0
				end
			else
				selfSay('You don\'t have enough money. You need to pay 10 mil to be rebirthed.', cid)
				talkState[talkUser] = 0
			end
		else
			selfSay('Only characters of level 100000 or higher can be rebirthed.', cid)
			talkState[talkUser] = 0
		end
	elseif(msgcontains(msg, 'no') and talkState[talkUser] == 1) then
		selfSay('Okey. Come back when you feel ready.', cid)
		talkState[talkUser] = 0
	end
 
	return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Back
Top