oliverpadron86
New Member
- Joined
- Mar 1, 2018
- Messages
- 40
- Reaction score
- 0
Hi everyone i'm looking for a newtype rune that changes outfit every time you use it
Hi everyone i'm looking for a newtype rune that changes outfit every time you use it
<action itemid="ITEM ID GOES HERE" script="changeOutfit.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
Edit the male and female part to work with your server's types if needed.Hi everyone i'm looking for a newtype rune that changes outfit every time you use it
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
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
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.
outfit.lookType = keyset[math.random(#keyset)]
Oops, thanks!LUA:outfit.lookType = keyset[math.random(#keyset)]