NPC Prestige/rebirth System with onlook working

JohnJohn90

New Member
Joined
Apr 29, 2011
Messages
70
Best answers
0
Reaction score
4
Location
USA
[29/02/2012 14:50:14] The Forgotten Server, version 0.3.4 (Crying Damson) sry 4 the double post
 

Xazive

You're delusional
Joined
Dec 22, 2009
Messages
675
Best answers
0
Reaction score
4
Yo when i start using this like everything works fine but when i get to like prestige "4~5" and when i click "skills" Bam ERROR!

i dno if i have done anything wrong but everything does work great so i dno if its just my rev so "im using 0.4_DEV" "trunk.3884"
 

ssimon

New Member
Joined
Jun 24, 2009
Messages
3
Best answers
0
Reaction score
0
I made something to get every prestige more healing!

PHP:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)

function onGetFormulaValues(cid, level, maglevel)
	local min = getPlayerStorageValue(cid, 85987) * 10000
	local max = getPlayerStorageValue(cid, 85987) * 10000
	return min, max
end

setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(cid, var)
	doCreatureAddHealth(cid, 10000)
	return doCombat(cid, combat, var)
end
 

Bahaha

New Member
Joined
Jul 11, 2007
Messages
58
Best answers
0
Reaction score
1
I have an error with "db.executeQuery" (nil value)

I customized my script a bit, and need help around this error

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 = 100 
		local cost = 300000
		------/CONFIGS-------
		-----LOCALS-----
		local id = getPlayerGUID(cid)
		local name = getCreatureName(cid)
		local vocation = getPlayerVocation(cid)
		local storage = getPlayerStorageValue(cid, 85987)
		if storage < 0 then
			storage = 0
		end
		local bonus = getPlayerLevel(cid) / 10 - 1 + storage
		----/LOCALS-----
		if(getPlayerLevel(cid) >= level) then
			if getPlayerVocation(cid) == 5 then
				newhealth = (bonus * 5) + 185
				newmana = (bonus * 35) + (35 * 7)
				newcap = (bonus * 15) + 600 + (7 * 15)
				voc = 1
			elseif getPlayerVocation(cid) == 6 then
				newhealth = (bonus * 5) + 185
				newmana = (bonus * 35) + (35 * 7)
				newcap = (bonus * 15) + 600 + (7 * 15)
				voc = 2
			elseif getPlayerVocation(cid) == 7 then
				newhealth = (bonus * 10) + 185
				newmana = (bonus * 15) + (15 * 7)
				newcap = (bonus * 20) + 600 + (7 * 20)
				voc = 3
			elseif getPlayerVocation(cid) == 8 then
				newhealth = (bonus * 15) + 185
				newmana = (bonus * 5) + (5 * 7)
				newcap = (bonus * 35) + 600 + (7 * 35)
				voc = 4
			end
			if(doPlayerRemoveMoney(cid, cost) == TRUE) then
				if(isInArray({5, 6, 7, 8}, vocation)) then
					setPlayerStorageValue(cid, 85987, bonus)--storage == -1 and 1 or storage + 1)
					doRemoveCreature(cid)
					db.executeQuery("UPDATE `players` SET `level` = 8, `experience` = 4200, `healthmax` = '"..newhealth.."', `manamax` = '"..newmana.."', `cap` = '"..newcap.."', `vocation` = '"..voc.."' 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 300k to be rebirthed.', cid)
				talkState[talkUser] = 0
			end
		else
			selfSay('Only characters of level 100 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())
Since mystic spirit has no databse commands at all, is a script like this even possible? What kind of work-arounds could I use? I see no commands to change these values :(
 
Last edited:

warhawk

New Member
Joined
Jan 13, 2009
Messages
44
Best answers
0
Reaction score
0
Location
Sweden
Can someone help me to edit the script?

1. add coast Id == 2157 (scarab coins)
2. and when they have done rebirth it will add a item in theres backpack :)

plz help me :)

- - - Updated - - -

Bump!!
 

alekito

Archlord - Retired
Joined
Oct 21, 2008
Messages
148
Best answers
0
Reaction score
28
Location
Sweden
Onlook works fine . but i wonder if it's possible to make so when someone else is checking on me it says :he has rebirthed x times.
Becouse atm it only works if you check yourself not other players.

- - - Updated - - -

Yo when i start using this like everything works fine but when i get to like prestige "4~5" and when i click "skills" Bam ERROR!

i dno if i have done anything wrong but everything does work great so i dno if its just my rev so "im using 0.4_DEV" "trunk.3884"
I had the same problem 2 weeks ago but i just simply went to the Vocations.xml and changed the cap you gain every lvl.

It was at : gaincap="10"
but i changed it to : gaincap="0"

and it worked :)
 

Thorn

Spriting since 2013
Premium User
Joined
Sep 24, 2012
Messages
2,188
Best answers
1
Reaction score
853
Location
Chile
plz help, when i use look on other player it doesn't show the prestige thing :S!!!!

- - - Updated - - -

[Error - LuaScriptInterface::loadFile] data/creaturescripts/scripts/RebirthDescription.lua:1: '=' expected near 'onLook'
[05/11/2012 14:07:44] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/RebirthDescription.lua)
[05/11/2012 14:07:44] data/creaturescripts/scripts/RebirthDescription.lua:1: '=' expected near 'onLook'
plzzz help

- - - Updated - - -

man forget all i said, i just woudl like to know how to use look on other person and see the prestiges he has
 

Caisto

New Member
Joined
Jan 12, 2009
Messages
18
Best answers
0
Reaction score
0
the onlook is working perfectlly, the only thing is that in the vocations onlook there is a mistake: 21:58 You see yourself. You are a elite knight. It suppose to be 21:58 You see yourself. You are an elite knight.

- - - Updated - - -

the onlook is working perfectlly, the only thing is that in the vocations onlook there is a mistake: 21:58 You see yourself. You are a elite knight. It suppose to be 21:58 You see yourself. You are an elite knight.

- - - Updated - - -

To correct the mistake I explain above you should use this onlook script, I'm using this for a ranking system on my server, not for a rebirth, I delete the time count because I don't need it and the getPlayerNameByGUID line because it wasn't working for me.

Code:
function onLook(cid, thing, position, lookDistance)
	if(isPlayer(thing.uid) and thing.uid ~= cid and getCreatureStorage(thing.uid, 99958) ~= -1) then
		doPlayerSetSpecialDescription(thing.uid, (getPlayerSex(thing.uid) == PLAYERSEX_FEMALE and "\nShe" or "\nHe") .. " is a Warrior of Asland.")
	elseif(thing.uid == cid and getCreatureStorage(cid, 99958) ~= -1) then
		local message = "You see yourself."
		if(getPlayerFlagValue(cid, PLAYERFLAG_SHOWGROUPINSTEADOFVOCATION)) then
			message = message .. " You are a " .. getPlayerGroupName(cid) .. "."
		elseif(getPlayerVocation(cid) == 1) then
			message = message .. " You are a " .. getPlayerVocationName(cid):lower() .. ""
		elseif(getPlayerVocation(cid) == 2) then
			message = message .. " You are a " .. getPlayerVocationName(cid):lower() .. ""
		elseif(getPlayerVocation(cid) == 3) then
			message = message .. " You are a " .. getPlayerVocationName(cid):lower() .. ""
		elseif(getPlayerVocation(cid) == 4) then
			message = message .. " You are a " .. getPlayerVocationName(cid):lower() .. ""
		elseif(getPlayerVocation(cid) == 6) then
			message = message .. " You are an " .. getPlayerVocationName(cid):lower() .. ""
		elseif(getPlayerVocation(cid) == 8) then
			message = message .. " You are an " .. getPlayerVocationName(cid):lower() .. ""
		elseif(getPlayerVocation(cid) == 0) then
			message = message .. " You have no vocation."
		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)) .. ", Client: " .. getClientVersion(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 are a Warrior of Asland ")
	end
 
	return true
end
What exactly does this script based on his rebirth? Well, first fixes the mistake when looking yourself with a vocation it says for example You see yourself. You are (a) Elite Knight. It should say You are (an) Elite Knight, It is fixed with Elder Druid too, and I also delete the time count because this script is more like a Ranking System for your ot, I hope you can handle how to put it in your server in your creaturescripts.
 

zomy2000

New Member
Joined
Dec 14, 2012
Messages
32
Best answers
0
Reaction score
0
Location
egypt
how to change the max reb and mana and hp each reb !? AND HOW TO MAKE IT FREE !?
 

ares413

New Member
Joined
Apr 1, 2010
Messages
129
Best answers
0
Reaction score
3
How would i make a spell where the attack increases as your amount of rebirths increases, using this system?
 

70011983

Ners
Joined
Nov 21, 2011
Messages
354
Best answers
1
Reaction score
51
Location
Croatia
Code:
[06/03/2013 19:58:19] [Error - CreatureScript Interface] 
[06/03/2013 19:58:19] data/creaturescripts/scripts/rebirthdescription.lua:onLook
[06/03/2013 19:58:19] Description: 
[06/03/2013 19:58:19] data/creaturescripts/scripts/rebirthdescription.lua:25: attempt to call global 'getClientVersion' (a nil value)
[06/03/2013 19:58:19] stack traceback:
[06/03/2013 19:58:19] 	data/creaturescripts/scripts/rebirthdescription.lua:25: in function <data/creaturescripts/scripts/rebirthdescription.lua:1>

how I fix it?

EDIT: I'm using cryingdamson 0.3.6 (8.60) V5 if it helps :p
 
Last edited:

Volerix

Jumper
Joined
Jul 19, 2012
Messages
8
Best answers
0
Reaction score
0
Code:
[06/03/2013 19:58:19] [Error - CreatureScript Interface] 
[06/03/2013 19:58:19] data/creaturescripts/scripts/rebirthdescription.lua:onLook
[06/03/2013 19:58:19] Description: 
[06/03/2013 19:58:19] data/creaturescripts/scripts/rebirthdescription.lua:25: attempt to call global 'getClientVersion' (a nil value)
[06/03/2013 19:58:19] stack traceback:
[06/03/2013 19:58:19] 	data/creaturescripts/scripts/rebirthdescription.lua:25: in function <data/creaturescripts/scripts/rebirthdescription.lua:1>

how I fix it?

EDIT: I'm using cryingdamson 0.3.6 (8.60) V5 if it helps :p
I have the same problem. ;/
 

WiLDTuRTLE

Member
Joined
Feb 26, 2011
Messages
478
Best answers
0
Reaction score
5
Could someone edit me the script to | When reborn, keep 25% of max hp/mp, & change vocation] | ?
 

hohosanta

Banned User
Joined
Jul 24, 2013
Messages
10
Best answers
0
Reaction score
0
I did all then I summoned the NPC, but then he says 'Are you ready to start a new life?' then I typed 'yes' and he did nothing, can you help??
 
Top