NPC NPC Reseter with look player

Stewie

Family Guy # ;3
Joined
May 3, 2010
Messages
786
Best answers
0
Reaction score
11
Location
TV
NPC Reseter with Look

Hi,

Im have a server 999x and i have this NPC and i decided share with Otland.net

First go to data\npc\scripts and make a reset.lua and put this:

Lua:
-- 
-- config
local minlevel = 3000 -- level to reset
local minlevel_vip = 2500 --  level for VIP
local price = 100000 Price of reset
local newlevel = 10 -- level after reset
local newexp = 9300 -- Exp after reset
-- end config

function addReset(cid)
	return setPlayerStorageValue(cid, 36874, getResets(cid) + 1)
end

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

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

	if msgcontains(msg, 'reset') then
		selfSay('Voce aceita o reset? se voce confirmar tera que deslogar para que o reset tenha efeito. voce tera que pagar a quantia de '..price..' GP para o reset.', cid)
		talkState[cid] = 1
	elseif(msgcontains(msg, 'yes') and talkState[cid] == 1) then
		if getPlayerMoney(cid) < price then
			selfSay('You must pay '..price..' gold coins to reset.', cid)
		elseif getPlayerLevel(cid) < (vip.hasVip(cid) and minlevel_vip or minlevel) then
			selfSay('Voce precisa ter no minimo level '.. minlevel ..' para o reset.', cid)
		else
			doPlayerRemoveMoney(cid,price)
			addReset(cid)
			playerid = getPlayerGUID(cid)
			doRemoveCreature(cid)
			db.executeQuery("UPDATE `players` SET `level`="..newlevel..",`experience`="..newexp.." WHERE `players`.`id`= ".. playerid .."")
		end
		talkState[cid] = 0
	elseif msgcontains(msg, 'no') and isInArray({1}, talkState[cid]) then
		talkState[cid] = 0
		selfSay('Yes', cid)
	elseif msgcontains(msg, 'resets') then
		selfSay('You Have '..getResets(cid)..' reset(s).', cid)
	end

	return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
now go to data\npc make reset.xml and put this:

Lua:
<?xml version="1.0"?>
<npc name="Reseter" script="data/npc/scripts/reset.lua" walkinterval="0" floorchange="0">
<health now="100" max="100"/>
<look type="133" head="10" body="122" legs="19" feet="10"/>
<parameters>
<parameter key="message_greet" value="Hello, |PLAYERNAME|. for reset say {reset}, or you wanna see how many resets you have say {resets}."/>
</parameters>
</npc>
Now for look how many resets have player.

Go to data/creaturescript/scripts and make resetlook.lua and put this:

Lua:
function onLook(cid, thing, position, lookDistance)
if isPlayer(thing.uid) then
doPlayerSetSpecialDescription(thing.uid, (getPlayerSex(thing.uid) == 0 and ".\nShe" or ".\nHe") .." has "..math.max(0, getPlayerStorageValue(thing.uid, 36874)).." resets")
return true
end
return true
end
Now go to login.lua with other registrations put this:

Lua:
registerCreatureEvent(cid, 'ResetLook')
Now go to data/creaturescript and open creaturescripts.xml and put this:

Lua:
<event type="look" name="ResetLook" event="script"  value="resetlook.lua"/>
Now have FUN.

DONT FORGET TO REP ME
 
Last edited:

Roykuss

Teh Best
Joined
Mar 30, 2009
Messages
40
Best answers
0
Reaction score
0
The problem I get when trying to summon the npc is this :

[13/08/2010 17:12:49] [Error - LuaScriptInterface::loadFile] data/npc/scripts/reset.lua:4: '=' expected near 'of'
[13/08/2010 17:12:49] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/reset.lua
[13/08/2010 17:12:49] data/npc/scripts/reset.lua:4: '=' expected near 'of'
 

OwnerDurk

Well-Known Member
Joined
May 5, 2014
Messages
51
Best answers
0
Reaction score
2
Have you figure it out mine is still doing it
The problem I get when trying to summon the npc is this :

[13/08/2010 17:12:49] [Error - LuaScriptInterface::loadFile] data/npc/scripts/reset.lua:4: '=' expected near 'of'
[13/08/2010 17:12:49] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/reset.lua
[13/08/2010 17:12:49] data/npc/scripts/reset.lua:4: '=' expected near 'of'
 

Itutorial

Premium User
Premium User
Joined
Dec 23, 2014
Messages
1,534
Best answers
35
Reaction score
374
Lua:
--
-- config
local minlevel = 3000 -- level to reset
local minlevel_vip = 2500 --  level for VIP
local price = 100000 --Price of reset
local newlevel = 10 -- level after reset
local newexp = 9300 -- Exp after reset
-- end config

function addReset(cid)
    return setPlayerStorageValue(cid, 36874, getResets(cid) + 1)
end

function getResets(cid)
    return getPlayerStorageValue(cid, 36874)
end

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

    if msgcontains(msg, 'reset') then
        selfSay('Voce aceita o reset? se voce confirmar tera que deslogar para que o reset tenha efeito. voce tera que pagar a quantia de '..price..' GP para o reset.', cid)
        talkState[cid] = 1
    elseif(msgcontains(msg, 'yes') and talkState[cid] == 1) then
        if getPlayerMoney(cid) < price then
            selfSay('You must pay '..price..' gold coins to reset.', cid)
        elseif getPlayerLevel(cid) < (vip.hasVip(cid) and minlevel_vip or minlevel) then
            selfSay('Voce precisa ter no minimo level '.. minlevel ..' para o reset.', cid)
        else
            doPlayerRemoveMoney(cid,price)
            addReset(cid)
            playerid = getPlayerGUID(cid)
            doRemoveCreature(cid)
            db.executeQuery("UPDATE `players` SET `level`="..newlevel..",`experience`="..newexp.." WHERE `players`.`id`= ".. playerid .."")
        end
        talkState[cid] = 0
    elseif msgcontains(msg, 'no') and isInArray({1}, talkState[cid]) then
        talkState[cid] = 0
        selfSay('Yes', cid)
    elseif msgcontains(msg, 'resets') then
        selfSay('You Have '..getResets(cid)..' reset(s).', cid)
    end

    return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Joined
Mar 1, 2018
Messages
41
Best answers
0
Reaction score
0
Lua:
--
-- config
local minlevel = 3000 -- level to reset
local minlevel_vip = 2500 --  level for VIP
local price = 100000 --Price of reset
local newlevel = 10 -- level after reset
local newexp = 9300 -- Exp after reset
-- end config

function addReset(cid)
    return setPlayerStorageValue(cid, 36874, getResets(cid) + 1)
end

function getResets(cid)
    return getPlayerStorageValue(cid, 36874)
end

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

    if msgcontains(msg, 'reset') then
        selfSay('Voce aceita o reset? se voce confirmar tera que deslogar para que o reset tenha efeito. voce tera que pagar a quantia de '..price..' GP para o reset.', cid)
        talkState[cid] = 1
    elseif(msgcontains(msg, 'yes') and talkState[cid] == 1) then
        if getPlayerMoney(cid) < price then
            selfSay('You must pay '..price..' gold coins to reset.', cid)
        elseif getPlayerLevel(cid) < (vip.hasVip(cid) and minlevel_vip or minlevel) then
            selfSay('Voce precisa ter no minimo level '.. minlevel ..' para o reset.', cid)
        else
            doPlayerRemoveMoney(cid,price)
            addReset(cid)
            playerid = getPlayerGUID(cid)
            doRemoveCreature(cid)
            db.executeQuery("UPDATE `players` SET `level`="..newlevel..",`experience`="..newexp.." WHERE `players`.`id`= ".. playerid .."")
        end
        talkState[cid] = 0
    elseif msgcontains(msg, 'no') and isInArray({1}, talkState[cid]) then
        talkState[cid] = 0
        selfSay('Yes', cid)
    elseif msgcontains(msg, 'resets') then
        selfSay('You Have '..getResets(cid)..' reset(s).', cid)
    end

    return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
I would like something like this but works with magic level.
Example: reach magic 200 and reset, go backlvl 0 but starts with more mana.
 
Top