FA

[Encerrado] [Script] Npc Outfit

Por Faelzdanil, 18 de mar. de 2013 em Tópicos Sem Resposta

otserv
tibia
script
5
1.6k
FaelzdanilF
18 de março de 2013 às 11:43

Ola galera xtibia,

 

Bom eu venho aqui de novo pedir um script pra vocês de Npc que venda Outfits...

 

Mas não quero que ele apenas venda por dinheiro normal, a minha ideia é fazer com que algumas Outfit sejam vendidas por dinheiro, outras por diamond e outras serem feitas através de missões.

 

Server utilizado é PDA Slicer 1.9

 

Então se alguém puder fazer um script assim ou parecido agradeço - REP++

 

Valeu galera é isso, abraços !

SlicerS
18 de março de 2013 às 12:39

vai em npc/scripts/clothes.lua e troque por isso...

 

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
											  --alterado v1.8 \/ peguem ele todo!
local outs = {
["jamaican"] = {181601},
["rapper"] = {181602},
["oriental"] = {181603},
["adventurer"] = {181605},
["bussines"] = {181606},
["atletic"] = {181607},
["punk"] = {181608},
["mercenary"] = {181610},
["hiker"] = {181611},
["assassin"] = {181654, 10}, --10 eh qnts diamonds vai pedir...
}
msg = string.lower(msg)
local diamond = 2145 --id dos diamonds


    if (msgcontains(msg, 'outfit') or msgcontains(msg, 'outfits')) then
	   selfSay("I sell this outfits: {Jamaican, Rapper, Oriental, Adventurer, Bussines, Atletic, Punk, Mercenary, Hiker and Assassin}, which outfit do you want??", cid)
	   talkState[talkUser] = 2
    elseif outs[msg] and talkState[talkUser] == 2 then
	   selfSay("Are you sure which want buy that outfit?", cid)
	   outfit = outs[tostring(msg)]
	   talkState[talkUser] = 3
    elseif msgcontains(msg, 'yes') and talkState[talkUser] == 3 then
	   if getPlayerStorageValue(cid, outfit[1]) <= 0 then
		  if getPlayerPremiumDays(cid) > 0 then
			 if outfit[2] then
			    if doPlayerRemoveItem(cid, diamond, outfit[2]) then
				   setPlayerStorageValue(cid, outfit[1], 1)
			    else
				   selfSay("You need ".. outfit[2] .." diamonds to buy this outfit!", cid)
				   talkState[talkUser] = 0
				   return false
			    end	  
			 else
				 if getPlayerMoney(cid) >= 20000 then
				    doPlayerRemoveMoney(cid, 20000)
				    setPlayerStorageValue(cid, outfit[1], 1)
				 else
				    selfSay("You need 200dl to buy this outfit!", cid)
				    talkState[talkUser] = 0
				    return false
				 end
			 end
		  else
			 selfSay("Need be premium to buy this Outfit.", cid)
			 talkState[talkUser] = 0
			 return false
		  end
	   else
		   selfSay("You already have this outfit, so please, choose another outfit...", cid)
		   talkState[talkUser] = 0
		   return false
	   end
	   selfSay("So... Here is.", cid)   
	   talkState[talkUser] = 0
	   return true
    elseif msgcontains(msg, 'no') and talkState[talkUser] == 3 then
	   selfSay("So... Please choose another outfit...", cid)
	   talkState[talkUser] = 0						     
    end
return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())		    

 

 

dai pra configurar...

--[nome da outfit] = {storage da outfit, qnts diamonds para comprar},
["assassin"] = {181654, 10},

ps: soh coloque o 2* numero ali na tabela caso a outfit peça diamond pra comprar... se for money, todas elas custao 200dl...

 

a storage da outfit fica em XML/outfits.xml

<outfit id="57" quest="181654">
<list gender="0" lookType="1469" name="Assassin"/>
<list gender="1" lookType="1470" name="Assassin"/>
</outfit>

ali em quest="x"...

 

para fazer missoes eh soh tu fazer a missao q tu quer e dai setar a storage da outfit.. por exemplo..

setPlayerStorageValue(cid, 181654, 1)

isso da a outfit de assassin pro player...

FaelzdanilF
18 de março de 2013 às 12:45

valeu Slicer, mas uma vez voce ajudando muitos aqui...

 

REP++

 

Se pude-se mandar PM pra voce gostaria de mostrar uma coisa :)

RoksasR
18 de março de 2013 às 12:57

Tópico movido para pedidos e dúvidas resolvidos.

5 anos depois...
StigalS
21 de abril de 2018 às 02:43
A questão neste tópico de suporte foi encerrada por falta de respostas. Este tópico está fechado e foi movido para Suporte - Tópicos Sem Resposta.

+ Caso a dúvida não tenha sido resolvida você poderá criar outro tópico solicitando ajuda.
* Lembre-se que é permitido dar UP no tópico a cada 24 horas para assim o destacar e manter movimentado.