Ir para conteúdo
  • Cadastre-se

(Resolvido)Converter Talk em Action


Ir para solução Resolvido por Sekk,

Posts Recomendados

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

 

 

Link para o post
Compartilhar em outros sites

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

 

 

Link para o post
Compartilhar em outros sites
2 horas atrás, Sekk disse:

 

 

Aparentemente so da bug quando relogo,

 

 

x.png

Editado por JcA (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  • 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

 

 

Link para o post
Compartilhar em outros sites
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

Link para o post
Compartilhar em outros sites


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
        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 TRUE
    else
        stopEvent(event)
        return TRUE
    end
end

 

Te ajudei ?? Que tal fazer uma contribuição ?

Doar

Link para o post
Compartilhar em outros sites
Em 18/08/2017 em 16:29, DboExplorer disse:

 


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
        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 TRUE
    else
        stopEvent(event)
        return TRUE
    end
end

 

 

Da o mesmo erro no distro quando desloga com o item equipado

Link para o post
Compartilhar em outros sites

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo