local config = {
actionid = 10000,
price = 1000000000,
leverid = {1945,1946},
messagesucces = 'You have got a random outfit for '..price..' gold.',
messagefail = 'You don\'t have '..price..' gold for a random outfit.'
}
local outfit = createConditionObject(CONDITION_OUTFIT)
setConditionParam(outfit, CONDITION_PARAM_TICKS, -1)
addOutfitCondition(outfit, {lookType = math.random(1,100), lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0})
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(item.actionid == config.actionid and item.itemid == config.leverid[1])then
if doPlayerRemoveMoney(cid,price) then
doTransformItem(uid,config.leverid[2])
doAddCondition(cid,outfit)
doPlayerSendTextMessage(cid,20,config.messagesucces)
doSendMagicEffect(getThingPos(cid),12)
else
doPlayerSendTextMessage(cid,20,config.messagefail)
doSendMagicEffect(getThingPos(cid),2)
doTransformItem(uid,config.leverid[2])
end
elseif(item.actionid == config.actionid and item.itemid == config.leverid[2])then
if doPlayerRemoveMoney(cid,price) then
doTransformItem(uid,config.leverid[1])
doAddCondition(cid,outfit)
doPlayerSendTextMessage(cid,20,config.messagesucces)
doSendMagicEffect(getThingPos(cid),12)
else
doPlayerSendTextMessage(cid,20,config.messagefail)
doSendMagicEffect(getThingPos(cid),2)
doTransformItem(uid,config.leverid[1])
end
end
return true
end
LUA:local config = { actionid = 10000, price = 1000000000, leverid = {1945,1946}, messagesucces = 'You have got a random outfit for '..price..' gold.', messagefail = 'You don\'t have '..price..' gold for a random outfit.' } local outfit = createConditionObject(CONDITION_OUTFIT) setConditionParam(outfit, CONDITION_PARAM_TICKS, -1) addOutfitCondition(outfit, {lookType = math.random(1,100), lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0}) function onUse(cid, item, fromPosition, itemEx, toPosition) if(item.actionid == config.actionid and item.itemid == config.leverid[1])then if doPlayerRemoveMoney(cid,price) then doTransformItem(uid,config.leverid[2]) doAddCondition(cid,outfit) doPlayerSendTextMessage(cid,20,config.messagesucces) doSendMagicEffect(getThingPos(cid),12) else doPlayerSendTextMessage(cid,20,config.messagefail) doSendMagicEffect(getThingPos(cid),2) doTransformItem(uid,config.leverid[2]) end elseif(item.actionid == config.actionid and item.itemid == config.leverid[2])then if doPlayerRemoveMoney(cid,price) then doTransformItem(uid,config.leverid[1]) doAddCondition(cid,outfit) doPlayerSendTextMessage(cid,20,config.messagesucces) doSendMagicEffect(getThingPos(cid),12) else doPlayerSendTextMessage(cid,20,config.messagefail) doSendMagicEffect(getThingPos(cid),2) doTransformItem(uid,config.leverid[1]) end end return true end
local price = 1000000000
function onUse(cid, item, fromPosition, itemEx, toPosition)
if doPlayerRemoveMoney(cid, price) then
doCreatureChangeOutfit(cid, math.random(2,351))
doPlayerSendTextMessage(cid, 20, 'You got a random outfit for '.. price ..' gold coins!')
doSendMagicEffect(getThingPos(cid),12)
doTransformItem(item.uid, item.itemid == 1946 and 1945 or 1946)
else
doPlayerSendTextMessage(cid, 20, 'You don\'t have '..price..' gold coinds required for the random outfit!')
doSendMagicEffect(getThingPos(cid),12)
return true
end
return true
end
It havent worked on 3.6 but you say it do?..
lol..
function isAtRange(from, to, value)
return from <= value and value <= to
end
local null, range = {0,1,135,225,30,75,266,302,336,335,329,328}, {161,191}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local output = math.random(2,351)
if not isAtRange(range[1],range[2],output) and not isInArray(null,output) and not isInArray(maleOutfits,output) and not isInArray(femaleOutfits,output) then
doRemoveItem(item.uid,1)
doSendMagicEffect(getThingPos(cid),12)
doCreatureChangeOutfit(cid, {lookType = output})
doPlayerSendCancel(cid, 'You got a random outfit!')
else
doPlayerSendCancel(cid, 'Oops try again!')
doSendMagicEffect(fromPosition, CONST_ME_POFF)
return false
end
return true
end
<action itemid="2159" event="script" value="randomoutfit.lua"/>