Ir para conteúdo
  • 0

Epic Promotion Some Quando O Char Desloga...


calemai

Pergunta

Meu NPC que vende promotion tem este Scripit...

 

local keywordHandler = KeywordHandler:new()

local npcHandler = NpcHandler:new(keywordHandler)

NpcSystem.parseParameters(npcHandler)

 

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

 

 

local node2 = keywordHandler:addKeyword({'epic'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can epicize you for 200000 gold coins. Do you want me to epicize you?'})

node2:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 200000, level = 120, promotion = 2, text = 'Congratulations! You are now epicized.'})

node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})

 

npcHandler:addModule(FocusModule:new())

 

 

 

Alguem me ajuda resolver porque quando o player desloga a promotion some??? ele volta a ser o que ele era antes da promotion....

 

Me ajudem por favor....

 

Alguem???

Editado por calemai
Link para o comentário
Compartilhar em outros sites

  • Respostas 31
  • Created
  • Última resposta

Top Posters For This Question

Posts Recomendados

  • 0

<?xml version="1.0" encoding="UTF-8"?>
<vocations>
	<vocation id="0" name="None" description="none" needpremium="0" gaincap="5" gainhp="5" gainmana="5" gainhpticks="6" gainhpamount="1" gainmanaticks="6" gainmanaamount="1" manamultiplier="4.0" attackspeed="2000" soulmax="100" gainsoulticks="120" fromvoc="0" attackable="no">
			<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
			<skill fist="1.5" club="2.0" sword="2.0" axe="2.0" distance="2.0" shielding="1.5" fishing="1.1" experience="1.0"/>
	</vocation>
	<vocation id="1" name="Sorcerer" description="a sorcerer" needpremium="0" gaincap="10" gainhp="5" gainmana="30" gainhpticks="3" gainhpamount="10" gainmanaticks="2" gainmanaamount="20" manamultiplier="1.1" attackspeed="1200" soulmax="100" gainsoulticks="120" fromvoc="1">
			<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
			<skill fist="1.5" club="2.0" sword="2.0" axe="2.0" distance="2.0" shielding="1.5" fishing="1.1" experience="1.0"/>
	</vocation>
	<vocation id="2" name="Druid" description="a druid" needpremium="0" gaincap="10" gainhp="5" gainmana="30" gainhpticks="3" gainhpamount="10" gainmanaticks="2" gainmanaamount="20" manamultiplier="1.1" attackspeed="1200" soulmax="100" gainsoulticks="120" fromvoc="2">
			<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
			<skill fist="1.5" club="1.8" sword="1.8" axe="1.8" distance="1.8" shielding="1.5" fishing="1.1" experience="1.0"/>
	</vocation>
	<vocation id="3" name="Paladin" description="a paladin" needpremium="0" gaincap="20" gainhp="10" gainmana="15" gainhpticks="3" gainhpamount="15" gainmanaticks="3" gainmanaamount="15" manamultiplier="1.4" attackspeed="1200" soulmax="100" gainsoulticks="120" fromvoc="3">
			<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
			<skill fist="1.2" club="1.2" sword="1.2" axe="1.2" distance="1.1" shielding="1.1" fishing="1.1" experience="1.0"/>
	</vocation>
	<vocation id="4" name="Knight" description="a knight" needpremium="0" gaincap="25" gainhp="15" gainmana="5" gainhpticks="3" gainhpamount="20" gainmanaticks="4" gainmanaamount="10" manamultiplier="3.0" attackspeed="1200" soulmax="100" gainsoulticks="120" fromvoc="4">
			<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
			<skill fist="1.1" club="1.1" sword="1.1" axe="1.1" distance="1.4" shielding="1.1" fishing="1.1" experience="1.0"/>
	</vocation>
	<vocation id="5" name="Master Sorcerer" description="a master sorcerer" needpremium="0" gaincap="10" gainhp="5" gainmana="30" gainhpticks="3" gainhpamount="30" gainmanaticks="2" gainmanaamount="70" manamultiplier="1.1" attackspeed="900" soulmax="200" gainsoulticks="15" fromvoc="1" lessloss="30">
			<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
			<skill fist="1.5" club="2.0" sword="2.0" axe="2.0" distance="2.0" shielding="1.5" fishing="1.1" experience="1.0"/>
	</vocation>
	<vocation id="6" name="Elder Druid" description="an elder druid" needpremium="0" gaincap="10" gainhp="5" gainmana="30" gainhpticks="3" gainhpamount="30" gainmanaticks="2" gainmanaamount="70" manamultiplier="1.1" attackspeed="900" soulmax="200" gainsoulticks="15" fromvoc="2" lessloss="30">
			<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
			<skill fist="1.5" club="1.8" sword="1.8" axe="1.8" distance="1.8" shielding="1.5" fishing="1.1" experience="1.0"/>
	</vocation>
	<vocation id="7" name="Royal Paladin" description="a royal paladin" needpremium="0" gaincap="20" gainhp="10" gainmana="15" gainhpticks="3" gainhpamount="40" gainmanaticks="3" gainmanaamount="40" manamultiplier="1.4" attackspeed="900" soulmax="200" gainsoulticks="15" fromvoc="3" lessloss="30">
			<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
			<skill fist="1.2" club="1.2" sword="1.2" axe="1.2" distance="1.1" shielding="1.1" fishing="1.1" experience="1.0"/>
	</vocation>
	<vocation id="8" name="Elite Knight" description="an elite knight" needpremium="0" gaincap="25" gainhp="15" gainmana="5" gainhpticks="3" gainhpamount="50" gainmanaticks="4" gainmanaamount="40" manamultiplier="3.0" attackspeed="900" soulmax="200" gainsoulticks="15" fromvoc="4" lessloss="30">
			<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
			<skill fist="1.1" club="1.1" sword="1.1" axe="1.1" distance="1.4" shielding="1.1" fishing="1.1" experience="1.0"/>
	</vocation>
	<vocation id="9" name="Epic Master Sorcerer" description="an epic master sorcerer" needpremium="0" gaincap="10" gainhp="5" gainmana="30" gainhpticks="3" gainhpamount="60" gainmanaticks="2" gainmanaamount="140" manamultiplier="1.1" attackspeed="700" soulmax="200" gainsoulticks="15" fromvoc="5" lessloss="50">
			<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
			<skill fist="1.5" club="2.0" sword="2.0" axe="2.0" distance="2.0" shielding="1.5" fishing="1.1" experience="1.0"/>
	</vocation>
	<vocation id="10" name="Epic Elder Druid" description="an epic elder druid" needpremium="0" gaincap="10" gainhp="5" gainmana="30" gainhpticks="3" gainhpamount="60" gainmanaticks="2" gainmanaamount="140" manamultiplier="1.1" attackspeed="700" soulmax="200" gainsoulticks="15" fromvoc="6" lessloss="50">
			<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
			<skill fist="1.5" club="1.8" sword="1.8" axe="1.8" distance="1.8" shielding="1.5" fishing="1.1" experience="1.0"/>
	</vocation>
	<vocation id="11" name="Epic Royal Paladin" description="an epic royal paladin" needpremium="0" gaincap="20" gainhp="10" gainmana="15" gainhpticks="3" gainhpamount="80" gainmanaticks="3" gainmanaamount="80" manamultiplier="1.4" attackspeed="700" soulmax="200" gainsoulticks="15" fromvoc="7" lessloss="50">
			<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
			<skill fist="1.2" club="1.2" sword="1.2" axe="1.2" distance="1.1" shielding="1.1" fishing="1.1" experience="1.0"/>
	</vocation>
	<vocation id="12" name="Epic Elite Knight" description="an epic elite knight" needpremium="0" gaincap="25" gainhp="15" gainmana="5" gainhpticks="3" gainhpamount="100" gainmanaticks="4" gainmanaamount="80" manamultiplier="3.0" attackspeed="700" soulmax="200" gainsoulticks="15" fromvoc="8" lessloss="50">
			<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>
			<skill fist="1.1" club="1.1" sword="1.1" axe="1.1" distance="1.4" shielding="1.1" fishing="1.1" experience="1.0"/>
	</vocation>
</vocations>

 

 

ta ai, nao sei oq pode estar errado...

Editado por calemai
Link para o comentário
Compartilhar em outros sites

  • 0

Substitua.

 

 

<?xml version="1.0" encoding="UTF-8"?>

<vocations>

<vocation id="0" name="None" description="none" needpremium="0" gaincap="5" gainhp="5" gainmana="5" gainhpticks="6" gainhpamount="1" gainmanaticks="6" gainmanaamount="1" manamultiplier="4.0" attackspeed="2000" soulmax="100" gainsoulticks="120" fromvoc="0" attackable="no">

<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>

<skill fist="1.5" club="2.0" sword="2.0" axe="2.0" distance="2.0" shielding="1.5" fishing="1.1" experience="1.0"/>

</vocation>

<vocation id="1" name="Sorcerer" description="a sorcerer" needpremium="0" gaincap="10" gainhp="5" gainmana="30" gainhpticks="3" gainhpamount="10" gainmanaticks="2" gainmanaamount="20" manamultiplier="1.1" attackspeed="1200" soulmax="100" gainsoulticks="120" fromvoc="1">

<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>

<skill fist="1.5" club="2.0" sword="2.0" axe="2.0" distance="2.0" shielding="1.5" fishing="1.1" experience="1.0"/>

</vocation>

<vocation id="2" name="Druid" description="a druid" needpremium="0" gaincap="10" gainhp="5" gainmana="30" gainhpticks="3" gainhpamount="10" gainmanaticks="2" gainmanaamount="20" manamultiplier="1.1" attackspeed="1200" soulmax="100" gainsoulticks="120" fromvoc="2">

<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>

<skill fist="1.5" club="1.8" sword="1.8" axe="1.8" distance="1.8" shielding="1.5" fishing="1.1" experience="1.0"/>

</vocation>

<vocation id="3" name="Paladin" description="a paladin" needpremium="0" gaincap="20" gainhp="10" gainmana="15" gainhpticks="3" gainhpamount="15" gainmanaticks="3" gainmanaamount="15" manamultiplier="1.4" attackspeed="1200" soulmax="100" gainsoulticks="120" fromvoc="3">

<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>

<skill fist="1.2" club="1.2" sword="1.2" axe="1.2" distance="1.1" shielding="1.1" fishing="1.1" experience="1.0"/>

</vocation>

<vocation id="4" name="Knight" description="a knight" needpremium="0" gaincap="25" gainhp="15" gainmana="5" gainhpticks="3" gainhpamount="20" gainmanaticks="4" gainmanaamount="10" manamultiplier="3.0" attackspeed="1200" soulmax="100" gainsoulticks="120" fromvoc="4">

<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>

<skill fist="1.1" club="1.1" sword="1.1" axe="1.1" distance="1.4" shielding="1.1" fishing="1.1" experience="1.0"/>

</vocation>

<vocation id="5" name="Master Sorcerer" description="a master sorcerer" needpremium="0" gaincap="10" gainhp="5" gainmana="30" gainhpticks="3" gainhpamount="30" gainmanaticks="2" gainmanaamount="70" manamultiplier="1.1" attackspeed="900" soulmax="200" gainsoulticks="15" fromvoc="1" lessloss="30">

<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>

<skill fist="1.5" club="2.0" sword="2.0" axe="2.0" distance="2.0" shielding="1.5" fishing="1.1" experience="1.0"/>

</vocation>

<vocation id="6" name="Elder Druid" description="an elder druid" needpremium="0" gaincap="10" gainhp="5" gainmana="30" gainhpticks="3" gainhpamount="30" gainmanaticks="2" gainmanaamount="70" manamultiplier="1.1" attackspeed="900" soulmax="200" gainsoulticks="15" fromvoc="2" lessloss="30">

<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>

<skill fist="1.5" club="1.8" sword="1.8" axe="1.8" distance="1.8" shielding="1.5" fishing="1.1" experience="1.0"/>

</vocation>

<vocation id="7" name="Royal Paladin" description="a royal paladin" needpremium="0" gaincap="20" gainhp="10" gainmana="15" gainhpticks="3" gainhpamount="40" gainmanaticks="3" gainmanaamount="40" manamultiplier="1.4" attackspeed="900" soulmax="200" gainsoulticks="15" fromvoc="3" lessloss="30">

<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>

<skill fist="1.2" club="1.2" sword="1.2" axe="1.2" distance="1.1" shielding="1.1" fishing="1.1" experience="1.0"/>

</vocation>

<vocation id="8" name="Elite Knight" description="an elite knight" needpremium="0" gaincap="25" gainhp="15" gainmana="5" gainhpticks="3" gainhpamount="50" gainmanaticks="4" gainmanaamount="40" manamultiplier="3.0" attackspeed="900" soulmax="200" gainsoulticks="15" fromvoc="4" lessloss="30">

<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>

<skill fist="1.1" club="1.1" sword="1.1" axe="1.1" distance="1.4" shielding="1.1" fishing="1.1" experience="1.0"/>

</vocation>

<vocation id="9" name="Epic Master Sorcerer" description="an epic master sorcerer" needpremium="0" gaincap="10" gainhp="5" gainmana="30" gainhpticks="3" gainhpamount="60" gainmanaticks="2" gainmanaamount="140" manamultiplier="1.1" attackspeed="700" soulmax="200" gainsoulticks="15" fromvoc="1" lessloss="50">

<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>

<skill fist="1.5" club="2.0" sword="2.0" axe="2.0" distance="2.0" shielding="1.5" fishing="1.1" experience="1.0"/>

</vocation>

<vocation id="10" name="Epic Elder Druid" description="an epic elder druid" needpremium="0" gaincap="10" gainhp="5" gainmana="30" gainhpticks="3" gainhpamount="60" gainmanaticks="2" gainmanaamount="140" manamultiplier="1.1" attackspeed="700" soulmax="200" gainsoulticks="15" fromvoc="2" lessloss="50">

<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>

<skill fist="1.5" club="1.8" sword="1.8" axe="1.8" distance="1.8" shielding="1.5" fishing="1.1" experience="1.0"/>

</vocation>

<vocation id="11" name="Epic Royal Paladin" description="an epic royal paladin" needpremium="0" gaincap="20" gainhp="10" gainmana="15" gainhpticks="3" gainhpamount="80" gainmanaticks="3" gainmanaamount="80" manamultiplier="1.4" attackspeed="700" soulmax="200" gainsoulticks="15" fromvoc="3" lessloss="50">

<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>

<skill fist="1.2" club="1.2" sword="1.2" axe="1.2" distance="1.1" shielding="1.1" fishing="1.1" experience="1.0"/>

</vocation>

<vocation id="12" name="Epic Elite Knight" description="an epic elite knight" needpremium="0" gaincap="25" gainhp="15" gainmana="5" gainhpticks="3" gainhpamount="100" gainmanaticks="4" gainmanaamount="80" manamultiplier="3.0" attackspeed="700" soulmax="200" gainsoulticks="15" fromvoc="4" lessloss="50">

<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>

<skill fist="1.1" club="1.1" sword="1.1" axe="1.1" distance="1.4" shielding="1.1" fishing="1.1" experience="1.0"/>

</vocation>

</vocations>

 

Editado por VictorTasquin
Link para o comentário
Compartilhar em outros sites

  • 0

Então coloque o Vocation.XML original e troque o script do seu NPC por este:

 

 

local keywordHandler = KeywordHandler:new()

local npcHandler = NpcHandler:new(keywordHandler)

NpcSystem.parseParameters(npcHandler)

local talkState = {}

 

local NPC_NEED_ITEMS = {{2160, 20}} -- Itens, caso o modo de promotion seja "items"

local NPC_NEED_LEVEL = 200

local NPC_NEED_PROMOTION = 1

 

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

 

local function ordinalprefix(n)

local ordinal = {[1] = "st", [2] = "nd", [3] = "rd"}

return n .. (ordinal[n] or "th")

end

 

function onCreatureSayCallback(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, "promotion") then

if getPlayerLevel(cid) < NPC_NEED_LEVEL then

selfSay("Sorry, but you need level ".. NPC_NEED_LEVEL .." to be promoted.", cid)

return

end

 

if getPlayerPromotionLevel(cid) ~= NPC_NEED_PROMOTION then

selfSay("Sorry, but you need to have {".. ordinalprefix(NPC_NEED_PROMOTION) .."} promotion.", cid)

return

end

 

local say = "So do you want to be promoted, heh? I need"

 

for n = 1, #NPC_NEED_ITEMS do

local sep = (n == 1 and " " or (n == #NPC_NEED_ITEMS and " and " or ", "))

say = say .. sep .. math.max(1, NPC_NEED_ITEMS[n][2]) .." ".. getItemNameById(NPC_NEED_ITEMS[n][1])

end

selfSay(say, cid)

talkSate[talkUser] = 1

end

 

if talkState[talkUser] == 1 then

if msgcontains(msg, "yes") then

local ret = {}

 

for _, item in ipairs(NPC_NEED_ITEMS) do

local g = getPlayerItemById(cid, true, item[1])

if g.uid > 0 and math.max(1, g.type) > item[2] then

table.insert(ret, {g.uid, item[2]})

else

ret = {}

break

end

end

 

if #ret > 0 then

for _, item in ipairs(ret) do

doRemoveItem(item[1], item[2])

end

 

selfSay("May the Gods bless you. You are now promoted.", cid)

doPlayerSetPromotionLevel(cid, getPlayerPromotionLevel(cid) + 1)

else

selfSay("You do not have all the items I need", cid)

npcHandler:releaseFocus(cid)

end

elseif msgcontains(msg, "no") then

selfSay("Alright.")

npcHandler:releaseFocus(cid)

end

end

return true

end

 

npcHandler:setMessage(MESSAGE_GREET, "Hello, |PLAYERNAME|. Do you want the {promotion}?")

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, onCreatureSayCallback)

npcHandler:setCallback(CALLBACK_GREET, onGreetCallback)

 

npcHandler:addModule(FocusModule:new())

 

 

 

Créditos: Oneshot.

Link para o comentário
Compartilhar em outros sites

  • 0

estou fazendo isso, ligando o server para testar, só uma coisa, este npc q lvl precisa para a promotion e quanto de dinheiro??? nao editei ainda para evitar de fazer errado...

Link para o comentário
Compartilhar em outros sites

  • 0

The Forgotten Server 0.4_SVN

 

eu dei uma modificada aki

 

trokei isso:

local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

 

Por isso:

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

 

to ligando o server para testar

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.

×
×
  • Criar Novo...