Ir para conteúdo

Npc [Nurse Joy] 1.0


wdlroots

Posts Recomendados

Hello All! :smile_positivo:

 

 

:Npc Nurse Joy healando apenas falando hi. TODOS CREDITOS AO glugluguga. (Eu apenas modifiquei uns detalhes).

 

Npc nurse joy : crie um arquivo em npc/script/ heal.lua e cole isto.

 

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {20}
local pokeballs = {'2222', '2224'}
local ultraballs = {'2220', '2227'}
local focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false

function onThingMove(creature, thing, oldpos, oldstackpos, item, itemEx)

end


function onCreatureAppear(creature)

end


function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Good bye then.')
focus = 0
talk_start = 0
end
end
function onCreatureTurn(creature)

end

function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end


function onCreatureSay(cid, type, msg)
msg = string.lower(msg)
if (msgcontains(msg, 'hi')) and getDistanceToCreature(cid) < 4 then
if exhaustion.get(cid, 9211) then
selfSay('Please wait a few moment before asking me to heal your pokemons again!')
return true
end
exhaustion.set(cid, 9211, 5)
doCreatureAddHealth(cid, getCreatureMaxHealth(cid)-getCreatureHealth(cid))
doSendMagicEffect(getThingPos(cid), 14)
if isInArray(pokeballs, getPlayerSlotItem(cid, CONST_SLOT_FEET).itemid) then
local feet = getPlayerSlotItem(cid, CONST_SLOT_FEET)
local maxh = tonumber(getItemAttribute(feet.uid, "poke"):match("/(.+)]"))
doItemSetAttribute(feet.uid, "poke", getItemAttribute(feet.uid, "poke"):sub(1, findLetter(getItemAttribute(feet.uid, "poke"), "[")) .. maxh .. getItemAttribute(feet.uid, "poke"):sub(findLetter(getItemAttribute(feet.uid, "poke"), "/")))
doTransformItem(feet.uid, 2222)
end
if isInArray(ultraballs, getPlayerSlotItem(cid, CONST_SLOT_FEET).itemid) then
local feet = getPlayerSlotItem(cid, CONST_SLOT_FEET)
local maxh = tonumber(getItemAttribute(feet.uid, "poke"):match("/(.+)]"))
doItemSetAttribute(feet.uid, "poke", getItemAttribute(feet.uid, "poke"):sub(1, findLetter(getItemAttribute(feet.uid, "poke"), "[")) .. maxh .. getItemAttribute(feet.uid, "poke"):sub(findLetter(getItemAttribute(feet.uid, "poke"), "/")))
doTransformItem(feet.uid, 2220)
end
	local bp = getPlayerSlotItem(cid, CONST_SLOT_BACKPACK)
		if #getCreatureSummons(cid) >= 1 then
		local jui = getCreatureSummons(cid)[1]
		doCreatureAddHealth(jui, getCreatureMaxHealth(jui)-getCreatureHealth(jui))
		doSendMagicEffect(getThingPos(jui), 132)
		end
		local items = getItemsInContainerById(bp.uid, 2224)
		for _, uid in pairs(items) do
		local maxh = tonumber(getItemAttribute(uid, "poke"):match("/(.+)]"))
		doItemSetAttribute(uid, "poke", getItemAttribute(uid, "poke"):sub(1, findLetter(getItemAttribute(uid, "poke"), "[")) .. maxh .. getItemAttribute(uid, "poke"):sub(findLetter(getItemAttribute(uid, "poke"), "/")))
		doTransformItem(uid, 2222)
		end
		local items = getItemsInContainerById(bp.uid, 2227) 
		for _, uid in pairs(items) do
		local maxh = tonumber(getItemAttribute(uid, "poke"):match("/(.+)]"))
		doItemSetAttribute(uid, "poke", getItemAttribute(uid, "poke"):sub(1, findLetter(getItemAttribute(uid, "poke"), "[")) .. maxh .. getItemAttribute(uid, "poke"):sub(findLetter(getItemAttribute(uid, "poke"), "/")))
		doTransformItem(uid, 2220)
		end
		local items = getItemsInContainerById(bp.uid, 2222) 
		for _, uid in pairs(items) do
		local maxh = tonumber(getItemAttribute(uid, "poke"):match("/(.+)]"))
		doItemSetAttribute(uid, "poke", getItemAttribute(uid, "poke"):sub(1, findLetter(getItemAttribute(uid, "poke"), "[")) .. maxh .. getItemAttribute(uid, "poke"):sub(findLetter(getItemAttribute(uid, "poke"), "/")))
		end
		local items = getItemsInContainerById(bp.uid, 2220) 
		for _, uid in pairs(items) do
		local maxh = tonumber(getItemAttribute(uid, "poke"):match("/(.+)]"))
		doItemSetAttribute(uid, "poke", getItemAttribute(uid, "poke"):sub(1, findLetter(getItemAttribute(uid, "poke"), "[")) .. maxh .. getItemAttribute(uid, "poke"):sub(findLetter(getItemAttribute(uid, "poke"), "/")))
		end
selfSay("Hello! We've restored your Pokemon to full health. We hope to see you again!")
end
end

function onCreatureChangeOutfit(creature)

end

 

Agora cria um arquivo .xml em data/npc chamado Nurse Joy.xml

 

e coloque isto:

 

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Nurse Joy" script="heal.lua" walkinterval="350000" floorchange="0" speed="0">
<health now="150" max="150"/>
<look type="181" head="91" body="102" legs="83" feet="0"/>
<parameters>
</parameters>
</npc>

 

 

Npc ainda tem uns bugs, mais são faceis de arrumar.{exemplo: não funfa todos pokeballs)

 

 

W.roots... {10% for me, 90% to glugluguga).

 

CYA! :thumbsupsmiley2:'

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

  • 1 month later...
×
×
  • Criar Novo...