Bom galera estou aqui pedindo um npc que a o falar com ele, ele desafia o player para uma batalha se o player aceita ele vira um monstro, se recusa ele manda ir em bota pfv galera me ajuda ai ;D
Tópico Movido
Este tópico foi movido de "OTServ → Scripting → Downloads Scripts → NPCs, monsters e raids"
para "OTServ → Scripting → Suporte Scripting".
DICA
Utilize botão @UP, no início de seu tópico, para atualizar o destaque de seu tópico em "Tópicos Recentes" na index, fará com que mais pessoas o vejam.
Tenta escrever em português que talvez alguém ajude, porque desconheço essa sua linguagem.
@up
@up
@up
em npc crie um arquivo Rulfs.xml:
<?xml version="1.0" encoding="UTF-8"?> <npc name="Rulfs" script="Rulfs.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="128" head="17" body="54" legs="114" feet="0" addons="2"/> </npc>
em npc/scripts crie um arquivo Rulfs.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 onPlayerEndTrade(cid) npcHandler:onPlayerEndTrade(cid) end function onPlayerCloseChannel(cid) npcHandler:onPlayerCloseChannel(cid) end local nome = "Rulfs" -- nome do monstro que vai parecer local function greetCallback(cid) local msg = 'Olá '.. getCreatureName(cid) ..", vem me desafiar a um duelo?" npcHandler:say(msg,cid) npcHandler:addFocus(cid) return false end function creatureSayCallback(cid, type, msg) if string.lower(msg) == 'bye' or string.lower(msg) == 'xau' then npcHandler:resetNpc(cid) return false end if(not npcHandler:isFocused(cid)) then return false end if (msgcontains(msg, 'sim') or msgcontains(msg, 'yes')) then local pos = getCreaturePosition(getNpcId()) selfSay('Então venha.',cid) doCreatureSay(getNpcId(), "MuHuashAUhashSHUuSA", TALKTYPE_MONSTER_YELL) npcHandler:resetNpc(cid) doRemoveCreature(getNpcId()) doCreateMonster(nome, pos) end if (msgcontains(msg, 'nao') or msgcontains(msg, 'no') or msgcontains(msg, 'não')) then selfSay('Então tchau.', cid) npcHandler:resetNpc(cid) return false end return true end npcHandler:setCallback(CALLBACK_GREET, greetCallback) npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
crie um arquivo em na pasta monster com o nome Rulfs.xml:
<?xml version="1.0" encoding="UTF-8"?> <monster name="Rulfs" nameDescription="a rulfs" race="blood" experience="900" speed="220" manacost="0"> <health now="1000" max="1000"/> <look type="128" head="17" body="54" legs="114" feet="0" addons="2" corpse="6080"/> <targetchange interval="5000" chance="8"/> <strategy attack="100" defense="0"/> <flags> <flag summonable="0"/> <flag attackable="1"/> <flag hostile="1"/> <flag illusionable="0"/> <flag convinceable="0"/> <flag pushable="0"/> <flag canpushitems="1"/> <flag canpushcreatures="1"/> <flag targetdistance="1"/> <flag staticattack="90"/> <flag runonhealth="500"/> </flags> <attacks> <attack name="melee" interval="2000" skill="30" attack="50" poison="150"/> <attack name="speed" interval="1000" chance="10" range="7" speedchange="-600" duration="20000"> <attribute key="areaEffect" value="redshimmer"/> </attack> <attack name="lifedrain" interval="1000" chance="40" radius="4" target="0" min="-120" max="-250"> <attribute key="areaEffect" value="rednote"/> </attack> </attacks> <defenses armor="15" defense="20"> <defense name="healing" interval="1000" chance="25" min="113" max="187"> <attribute key="areaEffect" value="blueshimmer"/> </defense> </defenses> <elements> <element firePercent="100"/> <element deathPercent="100"/> <element earthPercent="100"/> <element holyPercent="-20"/> </elements> <immunities> <immunity lifedrain="1"/> <immunity paralyze="1"/> <immunity invisible="1"/> </immunities> <voices interval="5000" chance="10"> <voice sentence="HAHAHAHAHA"/> </voices> <loot> <item id="2148" countmax="60" chance="11250"/><!-- gold coin --> <item id="2148" countmax="40" chance="11250"/><!-- gold coin --> <item id="2144" chance="2000"/><!-- black pearl --> <item id="2656" chance="650"/><!-- blue robe --> <item id="2047" chance="70000"/><!-- candle stick --> <item id="2237" chance="19000"/><!-- dirty cape --> <item id="2177" chance="50"/><!-- life crystal --> <item id="2071" chance="1333"/><!-- lyre --> <item id="2560" chance="7250"/><!-- mirror --> <item id="2411" chance="1600"/><!-- poison dagger --> <item id="2655" chance="800"/><!-- red robe --> <item id="2214" chance="860"/><!-- ring of healing --> <item id="2170" chance="8300"/><!-- silver amulet --> <item id="2134" chance="1750"/><!-- silver brooch --> <item id="2657" chance="60000"/><!-- simple dress --> <item id="2197" chance="1100"/><!-- stone skin amulet --> <item id="7589" chance="650"/><!-- strong mana potion --> <item id="2175" chance="900"/><!-- spellbook --> <item id="2143" chance="410"/><!-- white pearl --> <item id="7884" chance="240"/><!-- terra mantle --> <item id="2121" chance="410"/><!-- wedding ring --> <item id="2124" chance="100"/><!-- crystal ring --> </loot> </monster>
e em monster.xml coloque isso:
<monster name="Rulfs" file="Rulfs.xml"/>
depois em creaturescript/scripts crie um arquivo Rulfs.lua com isso:
local monstro = "Rulfs" -- nome do monstro local NPC = "Rulfs" -- nome do NPC function onKill(cid, target, damage, flags) if getCreatureName(target) == monstro then doCreateNpc(NPC, getCreaturePosition(target)) end if getCreatureName(cid) == monstro then local pos = getCreaturePosition(cid) doRemoveCreature(cid) doCreateNpc(NPC, pos) end return true end
depois em login.lua cole isso antes do return true:
registerCreatureEvent(cid, "desafio")
e em creaturescript.xml coloque isso:
<event type="kill" name="desafio" event="script" value="Rulfs.lua"/>
qualquer erro retorne
Lucas CP fis como tava ai mais deu esse erro
Você nao tem a criatura Rulfs,
em npc/scripts rulfs.lua
procura por
local nome = "Rulfs" -- nome do monstro que vai parecer
e coloca o nome da criatura que você quer que apareça
e em creaturescript/scripts Rulfs.lua
mude
local monstro = "Rulfs" -- nome do monstro
para o monstro que vc quer q apareça
Eu falei hi, yes, ele só fala MuHuashAUhashSHUuSA mais não pareceu o monstor
Editei o post acima
Muito obg pode fechar o tópico
Tópico movido para dúvidas / pedidos resolvidos.
Te ajudei?? REP+ e ficamos quites...
Atenciosamente,
Danihcv.
Abraços!