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

Command available after using item.

Seanr

New Member
Joined
Jul 11, 2011
Messages
168
Reaction score
3
Location
Mo Town
I need an item that will allow a player's outfit to become a rainbow outfit and I don't want it to be temporary, just until he uses item again. Can someone help?

I will gladly rep anyone that gives any sort of help :)
 
Last edited:
Okay well there are a few talkactions on these forums for giving your character rainbow outfit where it will rapidly change the colors on your outfit. it was a feature on evrebot and bic trainer back for 7.6. I want an Item to cause this to happen when used and when used again can disable it. You understand?


http://otland.net/f81/rainbow-outfit-120097/

Above is a link to the talkaction I use so if that helps you at all :)

http://otland.net/f81/new-rainbow-system-config-dubler-d-118718/

And above is a link to another talkaction with similar idea it has a video example of what it does!
 
Last edited:
Try this, create a new file in actions.xml called rainbow.lua:

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local default_time = 30 -- time in seconds
local fr = 5 -- frequency, changes per second
local access_to_change_time = 3 -- access needed to set own time
-- end of config
 
local frequency = 1000 / fr
local rainbowEvents = {}
 
function rainbowOutfit(cid, count)
	if(isPlayer(cid)) then
		local newOutfit = getCreatureOutfit(cid)
		newOutfit.lookHead = math.random(133)
		newOutfit.lookBody = math.random(133)
		newOutfit.lookLegs = math.random(133)
		newOutfit.lookFeet = math.random(133)
		doSetCreatureOutfit(cid, newOutfit, frequency + 5)
		if(count >= 1) then
			rainbowEvents[getPlayerGUID(cid)] = addEvent(rainbowOutfit, frequency, cid, count - 1)
		end
	end
end
 
function onSay(cid, words, param)
	if(rainbowEvents[getPlayerGUID(cid)] ~= nil) then
		stopEvent(rainbowEvents[getPlayerGUID(cid)])
	end
	if(param ~= '' and getPlayerAccess(cid) >= access_to_change_time) then
		rainbowOutfit(cid, tonumber(param) * fr)
	else
		rainbowOutfit(cid, default_time * fr)
	end
	return true
end

And in actions.xml

Code:
	<action itemid="id of the item to use" event="script" value="rainbow.lua"/>
 
I used these and nothing happens with item it just says I cannot use this object.

EDIT: I didn't see this at first but I got an error and I am kinda new to scripting so maybe you can help?

[Error - LuaScript Interface::loadFile] data/scripts/other/rainbowitem.lua:34: 'end' expected to close 'function' at line 1> near '<eof>'

[Warning - Event::loadScript] Cannot load script <data/actions/scripts/other/rainbowitem.lua>
data/actions/scripts/other/rainbowitem.lua:34: 'end' expected <to close 'function' at line 1> near '<eof>'
 
Last edited:
Try now maybe:

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local default_time = 30 -- time in seconds
local fr = 5 -- frequency, changes per second
local access_to_change_time = 3 -- access needed to set own time
-- end of config
 
local frequency = 1000 / fr
local rainbowEvents = {}
 
function rainbowOutfit(cid, count)
	if(isPlayer(cid)) then
		local newOutfit = getCreatureOutfit(cid)
		newOutfit.lookHead = math.random(133)
		newOutfit.lookBody = math.random(133)
		newOutfit.lookLegs = math.random(133)
		newOutfit.lookFeet = math.random(133)
		doSetCreatureOutfit(cid, newOutfit, frequency + 5)
		if(count >= 1) then
			rainbowEvents[getPlayerGUID(cid)] = addEvent(rainbowOutfit, frequency, cid, count - 1)
		end
	end
end
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(rainbowEvents[getPlayerGUID(cid)] ~= nil) then
		stopEvent(rainbowEvents[getPlayerGUID(cid)])
	end
	if(param ~= '' and getPlayerAccess(cid) >= access_to_change_time) then
		rainbowOutfit(cid, tonumber(param) * fr)
	else
		rainbowOutfit(cid, default_time * fr)
	end
	return true
end
 
try this
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local default_time = 30 -- time in seconds
local fr = 5 -- frequency, changes per second
local access_to_change_time = 3 -- access needed to set own time
-- end of config
 
local frequency = 1000 / fr
local rainbowEvents = {}
 
function rainbowOutfit(cid, count)
	if(isPlayer(cid)) then
		local newOutfit = getCreatureOutfit(cid)
		newOutfit.lookHead = math.random(133)
		newOutfit.lookBody = math.random(133)
		newOutfit.lookLegs = math.random(133)
		newOutfit.lookFeet = math.random(133)
		doSetCreatureOutfit(cid, newOutfit, frequency + 5)
		if(count >= 1) then
			rainbowEvents[getPlayerGUID(cid)] = addEvent(rainbowOutfit, frequency, cid, count - 1)
		end
	end
end
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(rainbowEvents[getPlayerGUID(cid)] ~= nil) then
		stopEvent(rainbowEvents[getPlayerGUID(cid)])
return TRUE
	end
	if(param ~= '' and getPlayerAccess(cid) >= access_to_change_time) then
		rainbowOutfit(cid, tonumber(param) * fr)
	else
		rainbowOutfit(cid, default_time * fr)
	end
	return true
end
 
Back
Top