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

TalkAction Rainbow outfit

can some1 make it so i use it like /rainbow on (or off) instead of time because i want it as a staff-only command
 
its till bugged :(
I use TFS 0.3.6pl1 for 8.6 client. In luascript.cpp is code:
PHP:
int32_t LuaScriptInterface::luaSetCreatureOutfit(lua_State* L)
{
	//doSetCreatureOutfit(cid, outfit, time)
	int32_t time = (int32_t)popNumber(L);
	Outfit_t outfit = popOutfit(L);

	ScriptEnviroment* env = getEnv();
	if(Creature* creature = env->getCreatureByUID(popNumber(L)))
		lua_pushboolean(L, Spell::CreateIllusion(creature, outfit, time) == RET_NOERROR);
	else
	{
		errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND));
		lua_pushboolean(L, false);
	}
	return 1;
}
Spell::CreateIllusion(creature, outfit, time) - it create condition, so after relog player still has modified outfit, but only for time. With my script default config it's 0.2 second.
Check in your sources how this function works. In my opinion function named doSetCreatureOutfit should set permament outfit :huh: , but there is no other function to set temportary outfit, so I used this function.
 
I use TFS 0.3.6pl1 for 8.6 client. In luascript.cpp is code:
PHP:
int32_t LuaScriptInterface::luaSetCreatureOutfit(lua_State* L)
{
	//doSetCreatureOutfit(cid, outfit, time)
	int32_t time = (int32_t)popNumber(L);
	Outfit_t outfit = popOutfit(L);

	ScriptEnviroment* env = getEnv();
	if(Creature* creature = env->getCreatureByUID(popNumber(L)))
		lua_pushboolean(L, Spell::CreateIllusion(creature, outfit, time) == RET_NOERROR);
	else
	{
		errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND));
		lua_pushboolean(L, false);
	}
	return 1;
}
Spell::CreateIllusion(creature, outfit, time) - it create condition, so after relog player still has modified outfit, but only for time. With my script default config it's 0.2 second.
Check in your sources how this function works. In my opinion function named doSetCreatureOutfit should set permament outfit :huh: , but there is no other function to set temportary outfit, so I used this function.

im using the source u gave me forgot :$?
 
Client or console? If in console, then check first post in thread. I've updated it.
 
Can this be made for onUse? with an item?

Lua:
local default_time = 30 -- time in seconds
local fr = 5 -- frequency, changes per second
-- 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)
	if(rainbowEvents[getPlayerGUID(cid)] ~= nil) then
		stopEvent(rainbowEvents[getPlayerGUID(cid)])
	end

	rainbowOutfit(cid, default_time * fr)
	return true
end
 
this is sweet man thanks you rep++!

can you make it to where I can turn it off and on?
 
Lua:
local default_time = 30 -- time in seconds
local fr = 5 -- frequency, changes per second
-- 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)
	if(rainbowEvents[getPlayerGUID(cid)] ~= nil) then
		stopEvent(rainbowEvents[getPlayerGUID(cid)])
		rainbowEvents[getPlayerGUID(cid)] = nil
		return true
	end
 
	rainbowOutfit(cid, default_time * fr)
	return true
end
 
Last edited:
it turns it off then it won't turn back on. can you fix?
 
Last edited:
Back
Top