• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[movements] Equip item change outfit. tfs 1.3

EduardoQuintela

New Member
Joined
Mar 10, 2014
Messages
27
Reaction score
1
Hello Community.


I need help to create a script that when equipping (2189) item, if player outfit is (50) then change player outfit to (88), else if player outfit is (60) then change player outfit (100).

When player deequip item, go back to outfit for which he was using.

please help me.
 
8.6

Lua:
function onEquip(cid, item, slot)
if getCreatureOutfit(cid).lookType == 50 then
           doSetCreatureOutfit(cid, {lookType = 88}, -1)
    elseif getCreatureOutfit(cid).lookType == 60 then
          doSetCreatureOutfit(cid, {lookType = 100}, -1)
      end
return true
end

function onDeEquip(cid, item, slot)
doRemoveCondition(cid, CONDITION_OUTFIT)
return true
end

And in movements.xml:
XML:
<movevent type="Equip" itemid="2189" slot="ammo" function="onEquipItem" script="name.lua"/>
       <movevent type="DeEquip" itemid="2189" slot="ammo" function="onDeEquipItem" script="name.lua"/>

Change slot and name script.
 
More configurable:
Lua:
local outfitSwap = { -- index is looktype and value associated with the index is the new outfit
    [50] = 88,
    [60] = 100,
}

function onEquip(cid, item, slot)
    local oldOutfit = getCreatureOutfit(cid).lookType
    if outfitSwap[oldOutfit] then
        doSetCreatureOutfit(cid, {lookType = outfitSwap[oldOutfit]}, -1)
    end
    return true
end
function onDeEquip(cid, item, slot)
    if hasCondition(cid, CONDITION_OUTFIT) then
        doRemoveCondition(cid, CONDITION_OUTFIT)
    end
    return true
end
 
Lua:
local outfits = {
    [50] = 88,
    [60] = 100,
}
function onEquip(player, item, slot)
    local outfit = outfits[player:getOutfit()]
    if outfit then
        player:setOutfit(outfit)
    end
    return true
end

function onDeEquip(player, item, slot)
    if player:getCondition(CONDITION_OUTFIT) then
        player:removeCondition(CONDITION_OUTFIT)
    end
    return true
end
 
Lua:
local outfits = {
    [50] = 88,
    [60] = 100,
}
function onEquip(player, item, slot)
    local outfit = outfits[player:getOutfit()]
    if outfit then
        player:setOutfit(outfit)
    end
    return true
end

function onDeEquip(player, item, slot)
    if player:getCondition(CONDITION_OUTFIT) then
        player:removeCondition(CONDITION_OUTFIT)
    end
    return true
end
How to add in movements.xml?
 
HTML:
<movevent event="Equip" itemid="2500" level="50" premium="1" maglv="15" script="script.lua" />
<movevent event="DeEquip" itemid="2500" script="amazon.lua" />
i have error .
321321.png
iwdAM7
 
More configurable:
Lua:
local outfitSwap = { -- index is looktype and value associated with the index is the new outfit
    [50] = 88,
    [60] = 100,
}

function onEquip(cid, item, slot)
    local oldOutfit = getCreatureOutfit(cid).lookType
    if outfitSwap[oldOutfit] then
        doSetCreatureOutfit(cid, {lookType = outfitSwap[oldOutfit]}, -1)
    end
    return true
end
function onDeEquip(cid, item, slot)
    if hasCondition(cid, CONDITION_OUTFIT) then
        doRemoveCondition(cid, CONDITION_OUTFIT)
    end
    return true
end
dont work, please repair. :) s2
321321.png
 
Lua:
local outfits = {
    [50] = 88,
    [60] = 100,
}
function onEquip(player, item, slot)
    local outfit = outfits[player:getOutfit()]
    if outfit then
        player:setOutfit(outfit)
    end
    return true
end

function onDeEquip(player, item, slot)
    if player:getCondition(CONDITION_OUTFIT) then
        player:removeCondition(CONDITION_OUTFIT)
    end
    return true
end
dont work, please repair.
 
Back
Top