• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Help with rune

Hi everyone i'm looking for a newtype rune that changes outfit every time you use it

something like this?

data\actions\actions.xml
XML:
<action itemid="ITEM ID GOES HERE" script="changeOutfit.lua"/>

data\actions\scripts\changeOutfit.lua
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local player = Player(cid)
    local config = {55, 50} -- looktype for outfit and outfit2

    local outfit = {lookType = config[1], lookHead = 20, lookLegs = 20, lookBody = 20, lookFeet = 20, lookAddons = 20}
    local outfit2 = {lookType = config[2], lookHead = 20, lookLegs = 20, lookBody = 20, lookFeet = 20, lookAddons = 20}
   

    if player:getOutfit().lookType == config[1] then
        player:setOutfit(outfit2)
    elseif player:getOutfit().lookType == config[2] then
        player:setOutfit(outfit)
    else
        player:setOutfit(outfit)
    end
   
    return true
end
 
Hi everyone i'm looking for a newtype rune that changes outfit every time you use it
Edit the male and female part to work with your server's types if needed.
LUA:
local male = {
    128, 129, 130, 131, 132, 133, 134, 143, 144,145, 146, 151, 152, 153, 154, 251, 268, 273, 278, 289, 325,
    328, 335, 367, 430, 432, 463, 465, 472, 512, 516, 541, 574, 577, 610, 619, 633, 634, 637, 665, 667, 684,
    695, 697, 699, 725, 733, 746, 750, 760, 846, 853, 873, 884, 899
}
local female = {
    136, 137, 138, 139, 140, 141, 142, 147, 148, 149, 150, 155, 156, 157, 158, 252, 269, 270, 279, 288, 324,
    329, 336, 366, 431, 433, 464, 466, 513, 514, 542, 575, 578, 618, 620, 632, 635, 636, 664, 666, 683, 694,
    696, 698, 724, 732, 745, 749, 759, 845, 852, 874, 885, 900
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local outfit = player:getOutfit()
    local type = player:getSex() == 0 and female or male

    local keyset = {}
    for k, v in pairs(type) do
        if player:hasOutfit(v) then
            keyset[#keyset + 1] = v
        end
    end

    outfit.lookType = type[math.random(#type)]
    outfit.lookHead = math.random(0,132)
    outfit.lookBody = math.random(0,132)
    outfit.lookLegs = math.random(0,132)
    outfit.lookFeet = math.random(0,132)

    player:setOutfit(outfit)
    return true
end
 
Edit the male and female part to work with your server's types if needed.
LUA:
local male = {
    128, 129, 130, 131, 132, 133, 134, 143, 144,145, 146, 151, 152, 153, 154, 251, 268, 273, 278, 289, 325,
    328, 335, 367, 430, 432, 463, 465, 472, 512, 516, 541, 574, 577, 610, 619, 633, 634, 637, 665, 667, 684,
    695, 697, 699, 725, 733, 746, 750, 760, 846, 853, 873, 884, 899
}
local female = {
    136, 137, 138, 139, 140, 141, 142, 147, 148, 149, 150, 155, 156, 157, 158, 252, 269, 270, 279, 288, 324,
    329, 336, 366, 431, 433, 464, 466, 513, 514, 542, 575, 578, 618, 620, 632, 635, 636, 664, 666, 683, 694,
    696, 698, 724, 732, 745, 749, 759, 845, 852, 874, 885, 900
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local outfit = player:getOutfit()
    local type = player:getSex() == 0 and female or male

    local keyset = {}
    for k, v in pairs(type) do
        if player:hasOutfit(v) then
            keyset[#keyset + 1] = v
        end
    end

    outfit.lookType = type[math.random(#type)]
    outfit.lookHead = math.random(0,132)
    outfit.lookBody = math.random(0,132)
    outfit.lookLegs = math.random(0,132)
    outfit.lookFeet = math.random(0,132)

    player:setOutfit(outfit)
    return true
end


I GOT THIS..
[30/05/2018 14:13:13] [Error - Action Interface]
[30/05/2018 14:13:13] data/actions/scripts/changeOutfit.lua:onUse
[30/05/2018 14:13:13] Description:
[30/05/2018 14:13:13] data/actions/scripts/changeOutfit.lua:13: attempt to index local 'player' (a number value)
[30/05/2018 14:13:13] stack traceback:
[30/05/2018 14:13:13] data/actions/scripts/changeOutfit.lua:13: in function <data/actions/scripts/changeOutfit.lua:12>
[30/05/2018 14:13:18] [Error - Action Interface]
[30/05/2018 14:13:18] data/actions/scripts/changeOutfit.lua:onUse
[30/05/2018 14:13:18] Description:
[30/05/2018 14:13:18] data/actions/scripts/changeOutfit.lua:13: attempt to index local 'player' (a number value)
[30/05/2018 14:13:18] stack traceback:
[30/05/2018 14:13:18] data/actions/scripts/changeOutfit.lua:13: in function <data/actions/scripts/changeOutfit.lua:12>
[30/05/2018 14:13:21] [Error - Action Interface]
[30/05/2018 14:13:21] data/actions/scripts/changeOutfit.lua:onUse
[30/05/2018 14:13:21] Description:
[30/05/2018 14:13:21] data/actions/scripts/changeOutfit.lua:13: attempt to index local 'player' (a number value)
[30/05/2018 14:13:21] stack traceback:
[30/05/2018 14:13:21] data/actions/scripts/changeOutfit.lua:13: in function <data/actions/scripts/changeOutfit.lua:12>
 
LUA:
local male = {
    128, 129, 130, 131, 132, 133, 134, 143, 144,145, 146, 151, 152, 153, 154, 251, 268, 273, 278, 289, 325,
    328, 335, 367, 430, 432, 463, 465, 472, 512, 516, 541, 574, 577, 610, 619, 633, 634, 637, 665, 667, 684,
    695, 697, 699, 725, 733, 746, 750, 760, 846, 853, 873, 884, 899
}
local female = {
    136, 137, 138, 139, 140, 141, 142, 147, 148, 149, 150, 155, 156, 157, 158, 252, 269, 270, 279, 288, 324,
    329, 336, 366, 431, 433, 464, 466, 513, 514, 542, 575, 578, 618, 620, 632, 635, 636, 664, 666, 683, 694,
    696, 698, 724, 732, 745, 749, 759, 845, 852, 874, 885, 900
}
function onUse(cid, item, fromPosition, target, toPosition, isHotkey)
    local player = Player(cid)
    local outfit = player:getOutfit()
    local type = player:getSex() == 0 and female or male
    local keyset = {}
    for k, v in pairs(type) do
        if player:hasOutfit(v) then
            keyset[#keyset + 1] = v
        end
    end
    outfit.lookType = keyset[math.random(#keyset)]
    outfit.lookHead = math.random(0,132)
    outfit.lookBody = math.random(0,132)
    outfit.lookLegs = math.random(0,132)
    outfit.lookFeet = math.random(0,132)
    player:setOutfit(outfit)
    return true
end


Let me know what TFS version you are using if you run into any other problems.
EDIT: StreamSide's fix
 
Last edited:
LUA:
local male = {
    128, 129, 130, 131, 132, 133, 134, 143, 144,145, 146, 151, 152, 153, 154, 251, 268, 273, 278, 289, 325,
    328, 335, 367, 430, 432, 463, 465, 472, 512, 516, 541, 574, 577, 610, 619, 633, 634, 637, 665, 667, 684,
    695, 697, 699, 725, 733, 746, 750, 760, 846, 853, 873, 884, 899
}
local female = {
    136, 137, 138, 139, 140, 141, 142, 147, 148, 149, 150, 155, 156, 157, 158, 252, 269, 270, 279, 288, 324,
    329, 336, 366, 431, 433, 464, 466, 513, 514, 542, 575, 578, 618, 620, 632, 635, 636, 664, 666, 683, 694,
    696, 698, 724, 732, 745, 749, 759, 845, 852, 874, 885, 900
}
function onUse(cid, item, fromPosition, target, toPosition, isHotkey)
    local player = Player(cid)
    local outfit = player:getOutfit()
    local type = player:getSex() == 0 and female or male
    local keyset = {}
    for k, v in pairs(type) do
        if player:hasOutfit(v) then
            keyset[#keyset + 1] = v
        end
    end
    outfit.lookType = type[math.random(#type)]
    outfit.lookHead = math.random(0,132)
    outfit.lookBody = math.random(0,132)
    outfit.lookLegs = math.random(0,132)
    outfit.lookFeet = math.random(0,132)
    player:setOutfit(outfit)
    return true
end


Let me know what TFS version you are using if you run into any other problems.
LUA:
outfit.lookType = keyset[math.random(#keyset)]
 
[25/06/2018 18:33:08] [Error - Action Interface]
[25/06/2018 18:33:08] data/actions/scripts/changeOutfit.lua:onUse
[25/06/2018 18:33:08] Description:
[25/06/2018 18:33:08] data/actions/scripts/changeOutfit.lua:12: attempt to call global 'Player' (a nil value)
[25/06/2018 18:33:08] stack traceback:
[25/06/2018 18:33:08] data/actions/scripts/changeOutfit.lua:12: in function <data/actions/scripts/changeOutfit.lua:11>
 
Back
Top