Ir para conteúdo

Featured Replies

Postado

Alguém ajuda com a conversão dessa talk abaixo para action? Quando eu usar x equipamento no slot de ring, vai fazer essa função da talk

 

 

Resolvido por Sekk

Ir para solução
  • Respostas 6
  • Visualizações 376
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • @JcA  

  • local colors = {94, 81, 79, 88, 18, 11, 92, 128} local storage = 65539 local time = 1 --in miliseconds function onEquip(cid, item, slot)     if getPlayerStorageValue(cid, storage) < 1 then       

Posted Images

Postado

Tenta ai

 

no items.xml eu vou usar como exemplo o signet ring:

 

items.xml

Spoiler

<item id="7697" article="a" name="rainbow outfit ring">
		<attribute key="weight" value="500" />
		<attribute key="description" value="Este anel lhe da 2x mais experiencia (ativo)." />
		<attribute key="slotType" value="ring" />
		<attribute key="duration" value="4320" />
		<attribute key="decayTo" value="0" />
		<attribute key="showduration" value="1" />
		<attribute key="transformDeEquipTo" value="7708" />
</item>
<item id="7708" article="a" name="ring rainbow outfit">
		<attribute key="weight" value="500" />
		<attribute key="slotType" value="ring" />
		<attribute key="stopduration" value="1" />
		<attribute key="showduration" value="1" />
		<attribute key="transformEquipTo" value="7697" />
</item>

 

 

movements.xml

Spoiler

<movevent type="Equip" itemid="7697" slot="ring" event="script" value="ro_ring.lua"/>
<movevent type="DeEquip" itemid="7697" slot="ring" event="script" value="ro_ring.lua"/>
<movevent type="Equip" itemid="7708" slot="ring" event="script" value="ro_ring.lua"/>
<movevent type="DeEquip" itemid="7708" slot="ring" event="script" value="ro_ring.lua"/>

 

 

 

movements/scripts/ro_ring.lua

Spoiler

local colors = {94, 81, 79, 88, 18, 11, 92, 128}
local storage = 65535
local time = 10 --in miliseconds

function onEquip(cid, item, slot)
	if getPlayerStorageValue(cid, storage) < 1 then
		local event = addEvent(changeOutfit, time, cid)
		setPlayerStorageValue(cid, storage, 1)
	return true
	end
return true
end

function onDeEquip(cid, item, slot)
	if getPlayerStorageValue(cid, storage) > 0 then
		setPlayerStorageValue(cid, storage, 0)
	return true
	end
return true
end

function changeOutfit(cid)
 
local randomHead = colors[math.random(#colors)]
local randomLegs = colors[math.random(#colors)]
local randomBody = colors[math.random(#colors)]
local randomFeet = colors[math.random(#colors)]
local tmp = {}
 
if getPlayerStorageValue(cid, storage) > 0 then
local outfit = getCreatureOutfit(cid)
tmp = outfit
tmp.lookType = outfit.lookType
tmp.lookHead = randomHead
tmp.lookLegs = randomLegs
tmp.lookBody = randomBody
tmp.lookFeet = randomFeet
tmp.lookAddons = outfit.lookAddons
 
doCreatureChangeOutfit(cid, tmp)
local event = addEvent(repeatChangeOutfit, time, cid)
return true
else
stopEvent(event)
return true
end
end
 
function repeatChangeOutfit(cid)
 
local randomHead = colors[math.random(#colors)]
local randomLegs = colors[math.random(#colors)]
local randomBody = colors[math.random(#colors)]
local randomFeet = colors[math.random(#colors)]
local tmp = {}
 
if getPlayerStorageValue(cid, storage) > 0 then
local outfit = getCreatureOutfit(cid)
tmp = outfit
tmp.lookType = outfit.lookType
tmp.lookHead = randomHead
tmp.lookLegs = randomLegs
tmp.lookBody = randomBody
tmp.lookFeet = randomFeet
tmp.lookAddons = outfit.lookAddons
 
doCreatureChangeOutfit(cid, tmp)
local event = addEvent(changeOutfit, time, cid)
return trye
else
stopEvent(event)
return true
end
end

 

 

Postado
  • Solução

@JcA

Spoiler

local colors = {94, 81, 79, 88, 18, 11, 92, 128}
local storage = 65000
local time = 10 --in miliseconds

function onEquip(cid, item, slot)
	if getPlayerStorageValue(cid, storage) < 1 then
		local event = addEvent(changeOutfit, time, cid)
		setPlayerStorageValue(cid, storage, 1)
	return true
	end
return true
end

function onDeEquip(cid, item, slot)
	if getPlayerStorageValue(cid, storage) > 0 then
		setPlayerStorageValue(cid, storage, 0)
	return true
	end
return true
end

function changeOutfit(cid)
 
local randomHead = colors[math.random(#colors)]
local randomLegs = colors[math.random(#colors)]
local randomBody = colors[math.random(#colors)]
local randomFeet = colors[math.random(#colors)]
local tmp = {}
 
if getPlayerStorageValue(cid, storage) > 0 then
local outfit = getCreatureOutfit(cid)
tmp = outfit
tmp.lookType = outfit.lookType
tmp.lookHead = randomHead
tmp.lookLegs = randomLegs
tmp.lookBody = randomBody
tmp.lookFeet = randomFeet
tmp.lookAddons = outfit.lookAddons
 
doCreatureChangeOutfit(cid, tmp)
local event = addEvent(repeatChangeOutfit, time, cid)
return true
else
stopEvent(event)
return true
end
end
 
function repeatChangeOutfit(cid)
 
local randomHead = colors[math.random(#colors)]
local randomLegs = colors[math.random(#colors)]
local randomBody = colors[math.random(#colors)]
local randomFeet = colors[math.random(#colors)]
local tmp = {}
 
if getPlayerStorageValue(cid, storage) > 0 then
local outfit = getCreatureOutfit(cid)
tmp = outfit
tmp.lookType = outfit.lookType
tmp.lookHead = randomHead
tmp.lookLegs = randomLegs
tmp.lookBody = randomBody
tmp.lookFeet = randomFeet
tmp.lookAddons = outfit.lookAddons
 
doCreatureChangeOutfit(cid, tmp)
local event = addEvent(changeOutfit, time, cid)
return trye
else
stopEvent(event)
return true
end
end

 

 

Postado
  • Autor
Em 14/08/2017 em 04:21, Sekk disse:

@JcA

  Ocultar conteúdo


local colors = {94, 81, 79, 88, 18, 11, 92, 128}
local storage = 65000
local time = 10 --in miliseconds

function onEquip(cid, item, slot)
	if getPlayerStorageValue(cid, storage) < 1 then
		local event = addEvent(changeOutfit, time, cid)
		setPlayerStorageValue(cid, storage, 1)
	return true
	end
return true
end

function onDeEquip(cid, item, slot)
	if getPlayerStorageValue(cid, storage) > 0 then
		setPlayerStorageValue(cid, storage, 0)
	return true
	end
return true
end

function changeOutfit(cid)
 
local randomHead = colors[math.random(#colors)]
local randomLegs = colors[math.random(#colors)]
local randomBody = colors[math.random(#colors)]
local randomFeet = colors[math.random(#colors)]
local tmp = {}
 
if getPlayerStorageValue(cid, storage) > 0 then
local outfit = getCreatureOutfit(cid)
tmp = outfit
tmp.lookType = outfit.lookType
tmp.lookHead = randomHead
tmp.lookLegs = randomLegs
tmp.lookBody = randomBody
tmp.lookFeet = randomFeet
tmp.lookAddons = outfit.lookAddons
 
doCreatureChangeOutfit(cid, tmp)
local event = addEvent(repeatChangeOutfit, time, cid)
return true
else
stopEvent(event)
return true
end
end
 
function repeatChangeOutfit(cid)
 
local randomHead = colors[math.random(#colors)]
local randomLegs = colors[math.random(#colors)]
local randomBody = colors[math.random(#colors)]
local randomFeet = colors[math.random(#colors)]
local tmp = {}
 
if getPlayerStorageValue(cid, storage) > 0 then
local outfit = getCreatureOutfit(cid)
tmp = outfit
tmp.lookType = outfit.lookType
tmp.lookHead = randomHead
tmp.lookLegs = randomLegs
tmp.lookBody = randomBody
tmp.lookFeet = randomFeet
tmp.lookAddons = outfit.lookAddons
 
doCreatureChangeOutfit(cid, tmp)
local event = addEvent(changeOutfit, time, cid)
return trye
else
stopEvent(event)
return true
end
end

 

 

 

Não precisa por um creaturescript que limpa a storage quando desloga? (posso estar falando besteira, não entendo, mas deu o erro a seguir anexado)

 

 

qq.png

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo