• 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!

Monster Outfit

8674011

New Member
Joined
Jun 21, 2010
Messages
160
Reaction score
3
Location
The House
Could someone give me a script, for when you pull a lever you get a Random type monster outfit, for 1,000,000,000 gold please
 
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
 
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

It havent worked on 3.6 but you say it do?..

lol..
 
shorter ;/ amg why so many lines
LUA:
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
altho needs an array for a valid outfit since its random, some outfits do not exist, anyways test
 
man, i do type very fast, but my english isn't that bad :p

oh! i remember how to make the script work with a valid outfit:p
 
here :D
LUA:
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

bugless :D worked for me and its funny

won't add player outfits, just monsters
neither gm, god, comm. manager outfits

its perfect :)
btw i removed the money since its not necessary, you sell the scarab coin with a npc or smth like that
LUA:
<action itemid="2159" event="script" value="randomoutfit.lua"/>

post blogged :D
 
Last edited:
Back
Top