genoma 1 Postado Setembro 4, 2009 Share Postado Setembro 4, 2009 Bom, gostaria de fazer algo diferente e inovador em Otservers, é o seguinte...Nem me arrisquei tentar criar sozinho pois de NPC nao entendo bulhufas, então vamos lá: Meu pedido é que quando a gente clicasse com botão direito naquela lâmpada que tem no jogo(me refiro aquela lâmpada que se pega na quest dos djinns, não aquela lâmpada que dropa de djinns toda hora, senão não tería graça), aparecesse um NPC Djinn que nos realiza 3 desejos, tipo, qualquer item que falarmos o nome, ele nos conceder...e depois dos 3 desejos, ele sumísse e acrescentasse um storagevalue na lâmpada para indicar que ela já foi usada! Bacana né? Bom...desde já, GRATO :smile_positivo: Link para o comentário Compartilhar em outros sites More sharing options...
kkk111 8 Postado Setembro 5, 2009 Share Postado Setembro 5, 2009 (editado) data/actions/scripts/ lampada.lua function onUse(cid,item,frompos,item2,topos) centro = getCreaturePosition(cid) if getPlayerStorageValue(cid, 2344) == -1 then -- by PaulO doCreateNpc('Askimrob', {x=centro.x+1, y=centro.y, z=centro.z}) doPlayerSetStorageValue(cid, 2344, 1) doRemoveItem(item.uid, 1) doSendMagicEffect({x=centro.x+1, y=centro.y, z=centro.z}, 10) else doCreatureSay(cid, "Já realizei seus pedidos!", TALKTYPE_ORANGE_1) end return FALSE end actions.xml <action itemid="2344" script="lampada.lua" /> data/npc/scripts askimrob.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 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, msg) then if getItemIdByName(msg, false) ~= LUA_ERROR then if getPlayerStorageValue(cid, 2344) == 1 then doPlayerAddItem(cid, getItemIdByName(msg, false), 1) doPlayerSetStorageValue(cid, 2344, 2) npcHandler:say('Você só tem mais {2} {desejos}.', cid) elseif getPlayerStorageValue(cid, 2344) == 2 then doPlayerAddItem(cid, getItemIdByName(msg, false), 1) doPlayerSetStorageValue(cid, 2344, 3) npcHandler:say('Você só tem mais {1} {desejo}.', cid) elseif getPlayerStorageValue(cid, 2344) == 3 then doPlayerAddItem(cid, getItemIdByName(msg, false), 1) doPlayerSetStorageValue(cid, 2344, 4) npcHandler:say('Você {não} {tem} mais {desejos}.', cid) elseif getPlayerStorageValue(cid, 2344) == 4 then npcHandler:say('Você {não} {tem} mais {desejos}.', cid) end else npcHandler:say('{Item} {não} {existe!}', cid) end end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) data/npc/ Askimrob.xml <npc name="Askimrob" script="data/npc/scripts/askimrob.lua"> <health now="150" max="150"/> -- by PaulO <look type="80" head="20" body="30" legs="40" feet="50"/> <parameters> <parameter key="message_greet" value="Eu sou {Askimrob}, o genio da lampada, {diga} {3} {items} que atenderei a seu pedido." /> </parameters> </npc> Lembrando... Não coloque esse npc no mapa. ID da Lâmpada = 2344 Poste ai se funcionou Editado Setembro 5, 2009 por kkk11111 Link para o comentário Compartilhar em outros sites More sharing options...
Demonbholder 420 Postado Setembro 5, 2009 Share Postado Setembro 5, 2009 (editado) E como q o NPC volta pra lampada?Esqueceu dessa parte meu amigo. Editado Setembro 5, 2009 por Demonbholder Link para o comentário Compartilhar em outros sites More sharing options...
kkk111 8 Postado Setembro 5, 2009 Share Postado Setembro 5, 2009 E como q o NPC volta pra lampada?Esqueceu dessa parte meu amigo. mete o pé na bunda dele AUHAUHuAUHA pera ai que ja coloco... Link para o comentário Compartilhar em outros sites More sharing options...
Demonbholder 420 Postado Setembro 5, 2009 Share Postado Setembro 5, 2009 Haehuehhe, gostei dessa. Link para o comentário Compartilhar em outros sites More sharing options...
genoma 1 Postado Setembro 5, 2009 Autor Share Postado Setembro 5, 2009 (editado) e depois dos 3 desejos, ele sumísse e acrescentasse um storagevalue na lâmpada para indicar que ela já foi usada! Bom...desde já, GRATO :smile_positivo: Acho que tá faltando essa parte, tipo...quando vc faz o terceiro pedido, o gênio fala alguma mensagem de despedida e some. Ae tipo, depois quando vc clicasse na lâmpada, parecesse mensagem do tipo cancel: "You already used this lamp and made all your 3 wishes." Ah, meu amigo...outra coisa, será que tem como bota o gênio dentro da lâmpada de novo? Digamos que o player não queira fazer os 3 desejos de uma só vez? Desde já...GRATO :smile_positivo: P.S: até entao parece tá perfeito P.S 2: acho uma idéia muito massa e inovadora, pq tipo...vc pode vender ela depois pra outro player usar, claro...por um preço beeeeeeeeeeem alto, ou simplesmente guardar pra você..e LOGICAMENTE, ser um item de uma quest super difícil né. Editado Setembro 5, 2009 por genoma Link para o comentário Compartilhar em outros sites More sharing options...
kkk111 8 Postado Setembro 5, 2009 Share Postado Setembro 5, 2009 Pode deixar, amanha tarde eu termino o serviço =D Boa Noite bando de cueca :s Link para o comentário Compartilhar em outros sites More sharing options...
genoma 1 Postado Setembro 5, 2009 Autor Share Postado Setembro 5, 2009 uhaehuhhue fmz...vamo ve se tu consegue essas ultimas condições q falei no último post ;] flws Link para o comentário Compartilhar em outros sites More sharing options...
Khost 0 Postado Setembro 5, 2009 Share Postado Setembro 5, 2009 Po genoma gostei da sua ideia te confesso que nunca pensaria nisso... Muito Bom... Parabéns ae também vcs que fizeram o script.. Obrigado! Link para o comentário Compartilhar em outros sites More sharing options...
kkk111 8 Postado Setembro 5, 2009 Share Postado Setembro 5, 2009 (editado) Po genoma gostei da sua ideia te confesso que nunca pensaria nisso...Muito Bom... Parabéns ae também vcs que fizeram o script.. Obrigado! Também adorei a idéia =D Unica coisa que não concordo é: " ...... pq tipo...vc pode vender ela depois pra outro player usar, claro ...." Pra min deveria sumir quando realizasse os 3 desejos se não os cara vai ficar fazendo char pra escolher os items que eles querem... Mas em fim idéia muito boa Atualização do Scripts data/actions/scripts/ lampada.lua function onUse(cid,item,frompos,item2,topos) local centro = getCreaturePosition(cid) if getCreaturePosition(getCreatureByName('Askimrob')) ~= LUA_ERROR then -- by PaulO doPlayerSendTextMessage(cid,26,"You can not use this object.") else if getPlayerStorageValue(cid, 21001) ~= 3 then if math.random(0,99) > 50 and getPlayerStorageValue(cid, 21001) >= 1 then doCreatureSay(cid, "Deixa eu dormir pow!", TALKTYPE_ORANGE_1) else doCreateNpc('Askimrob', {x=centro.x+1, y=centro.y, z=centro.z}) doSendMagicEffect({x=centro.x+1, y=centro.y, z=centro.z}, 10) end else doCreatureSay(cid, "Já realizei seus desejos!", TALKTYPE_ORANGE_1) end end return FALSE end data/actions/actions.xml <action itemid="2344" script="lampada.lua"/> data/npc/scripts/ askimrob.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 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, 'oil lamp') or msgcontains(msg, 'gemmed lamp') or msgcontains(msg, 'lamp') and getPlayerItemCount(cid, 2344) >= 1 and getPlayerStorageValue(cid, 21001) >= 1 then -- by PaulO npcHandler:say('{Ta} {me} {zuando} {né?}', cid) npcHandler:say('Acha que eu vou dar mais {Lâmpada} para você. \n{NOOB!}', cid) elseif msgcontains(msg, msg) and getPlayerItemCount(cid, 2344) >= 1 then if getItemIdByName(msg, false) ~= LUA_ERROR then if getPlayerStorageValue(cid, 21001) == 3 and getPlayerItemCount(cid, 2344) >= 1 then npcHandler:say('Você {não} tem mais {desejos} e \n {mesmo} {assim} {você} {me} {acorda} {-.-\'}', cid) addEvent(doRemoveDjinn, 4 * 1000) elseif getPlayerStorageValue(cid, 21001) == 2 and getPlayerItemCount(cid, 2344) >= 1 then doPlayerAddItem(cid, getItemIdByName(msg, false), 1) doPlayerSetStorageValue(cid, 21001, 3) npcHandler:say('Você {não} tem mais {desejos} e \n {não} {me} {chame} {mais!}', cid) addEvent(doRemoveDjinn, 4 * 1000) elseif getPlayerStorageValue(cid, 21001) == 1 and getPlayerItemCount(cid, 2344) >= 1 then doPlayerAddItem(cid, getItemIdByName(msg, false), 1) doPlayerSetStorageValue(cid, 21001, 2) npcHandler:say('Você só tem mais {1} {desejo}, \n {ve} {se} {deixa} {eu} {dormir} {agora} {}', cid) addEvent(doRemoveDjinn, 4 * 1000) elseif getPlayerStorageValue(cid, 21001) == -1 and getPlayerItemCount(cid, 2344) >= 1 then doPlayerAddItem(cid, getItemIdByName(msg, false), 1) doPlayerSetStorageValue(cid, 21001, 1) npcHandler:say('Você só tem mais {2} {desejos}, \n {agora} {vou} {dormir} {}', cid) addEvent(doRemoveDjinn, 4 * 1000) else npcHandler:say('Você {não} {tem} {a} {minha} {Lâmpada}.', cid) end else npcHandler:say('{O} {item} {desejado} {não} {existe!}', cid) end else npcHandler:say('Você {não} {tem} {a} {minha} {Lâmpada}.', cid) end end function doRemoveDjinn() doSendMagicEffect(getCreaturePosition(getCreatureByName('Askimrob')), 2) doRemoveCreature(getThingfromPos(getCreaturePosition(getCreatureByName('Askimrob'))).uid) stopEvent(doRemoveDjinn) end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) addEvent(doRemoveDjinn, 120 * 1000) data/npc/ Askimrob.xml <npc name="Askimrob" script="data/npc/scripts/askimrob.lua"> <health now="150" max="150"/> -- by PaulO <look type="80" head="20" body="30" legs="40" feet="50"/> <parameters> <parameter key="message_greet" value="Eu sou {Askimrob}, o genio da lampada, {diga} {3} {items} que atenderei a seu desejos." /> </parameters> </npc> *Reporte todos os bugs *Próxima atualização: Que tal um "TAPETE VOADOR" Editado Setembro 5, 2009 por kkk11111 Link para o comentário Compartilhar em outros sites More sharing options...
genoma 1 Postado Setembro 5, 2009 Autor Share Postado Setembro 5, 2009 (editado) Gostei do q vc disse...vou testar aki, tipo...uma solução, porém nao muito eficaz para ots de xp alta...sería colocar level pra executar essa action. :smile_positivo: Editado Setembro 5, 2009 por genoma Link para o comentário Compartilhar em outros sites More sharing options...
kkk111 8 Postado Setembro 5, 2009 Share Postado Setembro 5, 2009 (editado) Pra min daria certo: 1º Fazer ela sumir 2º Transformar em outra 3º Ou fazer ela não funcionar mais colocando um actionid 4º Ou então level como você mesmo disse Só escolher oque fia melhor para você que eu edito.... vo da uma metida agora depois eu vejo Editado Setembro 5, 2009 por kkk11111 Link para o comentário Compartilhar em outros sites More sharing options...
genoma 1 Postado Setembro 5, 2009 Autor Share Postado Setembro 5, 2009 uUhuhUHeuhUHEUHheuhEUue ta certíssimo! ;p tipo...axu melhor fazer a action com level msm, se nao quiser editar td bem, isso eu sei fazer P.S: Minha mina ta 'nakeles dia' senao tava fazendo o msm q vc...flws Link para o comentário Compartilhar em outros sites More sharing options...
kkk111 8 Postado Setembro 6, 2009 Share Postado Setembro 6, 2009 Agora sim.... lampada.lua function onUse(cid,item,frompos,item2,topos) local centro = getCreaturePosition(cid) local creature = getCreatureByName('Askimrob') if item.actionid == 2344 then doCreatureSay(cid, "O Gênio não está mais aqui!", TALKTYPE_ORANGE_1) else if(creature ~= nil and (not isPlayer(creature))) then doPlayerSendTextMessage(cid,26,"Askimrob está atendendo outro pedido, agarde...") else if getPlayerStorageValue(cid, 21001) ~= 3 then if math.random(0,99) > 50 and getPlayerStorageValue(cid, 21001) >= 1 then doCreatureSay(cid, "Deixa eu dormir pow!", TALKTYPE_ORANGE_1) else doCreateNpc('Askimrob', {x=centro.x+1, y=centro.y, z=centro.z}) doSendMagicEffect({x=centro.x+1, y=centro.y, z=centro.z}, 10) end else doCreatureSay(cid, "Já realizei seus desejos!", TALKTYPE_ORANGE_1) end end end return FALSE end action.xml <action itemid="2344" script="lampada.lua" /> Npc/ Askimrob.xml <?xml version="1.0" encoding="UTF-8"?> <npc name="Askimrob" script="data/npc/scripts/askimrob.lua" walkinterval="3000"> <health now="150" max="150"/> -- by PaulO <look type="80" head="20" body="30" legs="40" feet="50"/> <parameters> <parameter key="message_greet" value="Eu sou {Askimrob}, o genio da lampada, {diga} {3} {items} que atenderei os seus desejos." /> </parameters> </npc> askimrob.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 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, 'oil lamp') or msgcontains(msg, 'gemmed lamp') or msgcontains(msg, 'lamp') and getPlayerItemCount(cid, 2344) >= 1 and getPlayerStorageValue(cid, 21001) >= 1 then npcHandler:say('{Ta} {me} {zuando} {né?}', cid) npcHandler:say('Acha que eu vou dar mais {Lâmpada} para você. \n{NOOB!}', cid) elseif msgcontains(msg, msg) and getPlayerItemCount(cid, 2344) >= 1 then if getItemIdByName(msg, false) ~= LUA_ERROR then if getPlayerStorageValue(cid, 21001) == 3 and getPlayerItemCount(cid, 2344) >= 1 then npcHandler:say('Você {não} tem mais {desejos} e \n {mesmo} {assim} {você} {me} {acorda} {-.-\'}', cid) addEvent(doRemoveDjinn, 4 * 1000) elseif getPlayerStorageValue(cid, 21001) == 2 and getPlayerItemCount(cid, 2344) >= 1 then doPlayerAddItem(cid, getItemIdByName(msg, false), 1) doPlayerSetStorageValue(cid, 21001, 3) npcHandler:say('{Cabou} seus {desejos}, agora {vou} {embora.}', cid) doPlayerRemoveItem(cid, 2344, 1) lampada = doCreateItemEx(2344, 1) doSetItemActionId(lampada, 2344) doPlayerAddItemEx(cid, lampada, 1) addEvent(doRemoveDjinn, 4 * 1000) elseif getPlayerStorageValue(cid, 21001) == 1 and getPlayerItemCount(cid, 2344) >= 1 then doPlayerAddItem(cid, getItemIdByName(msg, false), 1) doPlayerSetStorageValue(cid, 21001, 2) npcHandler:say('Você só tem mais {1} {desejo}, \n {ve} {se} {deixa} {eu} {dormir} {agora} {}', cid) addEvent(doRemoveDjinn, 4 * 1000) elseif getPlayerStorageValue(cid, 21001) == -1 and getPlayerItemCount(cid, 2344) >= 1 then doPlayerAddItem(cid, getItemIdByName(msg, false), 1) doPlayerSetStorageValue(cid, 21001, 1) npcHandler:say('Você só tem mais {2} {desejos}, \n {agora} {vou} {dormir} {}', cid) addEvent(doRemoveDjinn, 4 * 1000) else npcHandler:say('Você {não} {tem} {a} {minha} {Lâmpada}.', cid) end else npcHandler:say('{O} {item} {desejado} {não} {existe!}', cid) end else npcHandler:say('Você {não} {tem} {a} {minha} {Lâmpada}.', cid) end end function doRemoveDjinn() if getCreatureByName('Askimrob') ~= nil and not isPlayer(getCreatureByName('Askimrob')) then doSendMagicEffect(getCreaturePosition(getCreatureByName('Askimrob')), 2) doRemoveCreature(getThingfromPos(getCreaturePosition(getCreatureByName('Askimrob'))).uid) stopEvent(doRemoveDjinn) end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) addEvent(doRemoveDjinn, 100 * 1000) Poste qualquer erro... Mais sugestões pode manda Link para o comentário Compartilhar em outros sites More sharing options...
genoma 1 Postado Setembro 7, 2009 Autor Share Postado Setembro 7, 2009 (editado) [07/09/2009 13:51:53] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/gennie.lua [07/09/2009 13:51:53] data/npc/scripts/gennie.lua:23: ')' expected near 'd' P.S: mudei o nome do npc e do script para "gennie" e tambem coloquei as falas dele todas em inglês. P.S 2: nao é esse o problema pois testei tambem com as falas em portugues como vc fez ae... Olha aqui como tá: 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, 'wish') or msgcontains(msg, 'gemmed lamp') or msgcontains(msg, 'lamp') and getPlayerItemCount(cid, 2344) >= 1 and getPlayerStorageValue(cid, 21001) >= 1 then npcHandler:say('{You} {are} {kidding} {?}', cid) npcHandler:say('Do you think I'd give more {lamps} to you? \n{NOOB!}', cid) elseif msgcontains(msg, msg) and getPlayerItemCount(cid, 2344) >= 1 then if getItemIdByName(msg, false) ~= LUA_ERROR then if getPlayerStorageValue(cid, 21001) == 3 and getPlayerItemCount(cid, 2344) >= 1 then npcHandler:say('You {do not} have more {wishes} and \n {you} {come} {to} {disturb} {me} {?'}', cid) addEvent(doRemoveDjinn, 4 * 1000) elseif getPlayerStorageValue(cid, 21001) == 2 and getPlayerItemCount(cid, 2344) >= 1 then doPlayerAddItem(cid, getItemIdByName(msg, false), 1) doPlayerSetStorageValue(cid, 21001, 3) npcHandler:say('{You} have {made} all yours 3 wishes, now {leave} {me} {alone!}', cid) doPlayerRemoveItem(cid, 2344, 1) lampada = doCreateItemEx(2344, 1) doSetItemActionId(lampada, 2344) doPlayerAddItemEx(cid, lampada, 1) addEvent(doRemoveDjinn, 4 * 1000) elseif getPlayerStorageValue(cid, 21001) == 1 and getPlayerItemCount(cid, 2344) >= 1 then doPlayerAddItem(cid, getItemIdByName(msg, false), 1) doPlayerSetStorageValue(cid, 21001, 2) npcHandler:say('You have more {1} {wish}, \n {be} {fast} {and} {let} {me} {sleep} {now} {!}', cid) addEvent(doRemoveDjinn, 4 * 1000) elseif getPlayerStorageValue(cid, 21001) == -1 and getPlayerItemCount(cid, 2344) >= 1 then doPlayerAddItem(cid, getItemIdByName(msg, false), 1) doPlayerSetStorageValue(cid, 21001, 1) npcHandler:say('You have more {2} {wishes}, \n {now} {i} {will} {sleep} {!}', cid) addEvent(doRemoveDjinn, 4 * 1000) else npcHandler:say('You do {not} {have} {my} {lamp}.', cid) end else npcHandler:say('{The} {wished} {item} {does} {not } {exist!}', cid) end else npcHandler:say('You do {not} {have} {my} {lamp}.', cid) end end function doRemoveDjinn() if getCreatureByName('Gennie') ~= nil and not isPlayer(getCreatureByName('Gennie')) then doSendMagicEffect(getCreaturePosition(getCreatureByName('Gennie')), 67) doRemoveCreature(getThingfromPos(getCreaturePosition(getCreatureByName('Gennie'))).uid) stopEvent(doRemoveDjinn) end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) addEvent(doRemoveDjinn, 100 * 1000) Editado Setembro 7, 2009 por genoma Link para o comentário Compartilhar em outros sites More sharing options...
Posts Recomendados