• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

TalkAction Lookin` so fly like a g6

  • Thread starter Thread starter Icy
  • Start date Start date
I

Icy

Guest
Thought it would be a good way to save myself time by making a script to change my outfit to one of the ones I normally wear rather than having to manually set it all the time - especially when testing stuff. You all might enjoy it too, or not, but here you are:

Yes it can be optimized a lot, no I don't care.

LUA:
--[[
@author: Icy
@date: January 14th, 2011
@purpose:	
	A talkaction that allows the user to either choose a specific outfit or allow a randomly selected 
	outfit from an array of pre-input combinations to be worn.  A spin indicating delay in changing
	outfits as well as a 'wardrobe malfunction' can optionally be turned on/off and may vary in speed.
	In addition, there are extensive informative messages relayed back to the user.
]]

function onSay(cid, words, param, channel)
	local randomDelay = 1 --delay (in seconds) until outfit is when when no outfit is specified as a parameter
	local choiceDelay = 0 --delay (in seconds) until outfit is when when an outfit is specified as a parameter
	local spinChoice = true --boolean to decide if you want to spin while choosing outfit
	local spinsPerSecond = 2 --amount of times to turn full circle every second, recommended 1-4
	local malfunctionChoice = true --boolean to decide if you want your outfit to flash colours during delay
	local intensity = 3 --speed at which colours flash during malfunction, higher = faster flashing (Note: A high spinsPerSecond value will increase this by default)
	local outfits = {
		
		[1] = {
		combination = {lookType = 128, lookHead = 79, lookBody = 88, lookLegs = 94, lookFeet = 114, lookAddons = 3}, 
		description = 'The Classic'
		},
		
		[2] = {
		combination = {lookType = 133, lookHead = 79, lookBody = 88, lookLegs = 114, lookFeet = 94, lookAddons = 3}, 
		description = 'Blue Summoner'
		},
		
		[3] = {
		combination = {lookType = 134, lookHead = 3, lookBody = 94, lookLegs = 94, lookFeet = 114, lookAddons = 3}, 
		description = 'Hero in Red'
		},
		
		[4] = {
		combination = {lookType = 130, lookHead = 9, lookBody = 114, lookLegs = 114, lookFeet = 114, lookAddons = 3}, 
		description = 'Fuckin\' Wizard'
		},
		
		[5] = {
		combination = {lookType = 251, lookHead = 79, lookBody = 88, lookLegs = 94, lookFeet = 114, lookAddons = 3}, 
		description = 'Man the Harpoons!'
		},
		
		[6] = {
		combination = {lookType = 132, lookHead = 79, lookBody = 114, lookLegs = 114, lookFeet = 94, lookAddons = 3}, 
		description = 'The Pimp'
		},
		
		[7] = {
		combination = {lookType = 146, lookHead = 79, lookBody = 88, lookLegs = 94, lookFeet = 114, lookAddons = 3}, 
		description = 'Allah Ackbar'
		}
	}
	
	if not(param == '') then --if they entered a param..
	
		if(isNumber(tonumber(param))) then --if it was a number..
		
			param = tonumber(param) --convert param to a number to prevent loss of accuracy / compatibility issues
			
			if((param < 1) or (param > table.maxn(outfits)) or (param % 1 ~= 0)) then --if the value was less than 1, above the # of outfits or a decimal number..
				param  = '' --redirects to random retrieval mode
			end
			
		else --if it wasn't a number..
			param = '' --redirects to random retrieval mode
		end
	end
	
	if(param == '') then
		
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "WARNING: Input not recognized - Initiating random outfit retrieval sequence. Please wait...")
		
		if(spinChoice and (spinsPerSecond > 0)) then
			
			for i = 1, spinsPerSecond * 4 * randomDelay do
				addEvent(spin, i * 1000 / ( 4 * spinsPerSecond), cid)
				
				for j = 1, intensity do
					
					if(malfunctionChoice) then
						addEvent(malfunction, i * j * 1000 / ( 4 * spinsPerSecond) / intensity, cid)
					end
				
				end
				
			end
			
		end
		
		addEvent(selectRandomOutfit, randomDelay * 1000 + 1, cid, outfits)
	else
			
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Input recognized - Initiating retrieval of specified outfit. Please wait...")
		
		if(spinChoice and (spinsPerSecond > 0)) then
			
			for i = 1, spinsPerSecond * 4 * choiceDelay do
				addEvent(spin, i * 1000 / ( 4 * spinsPerSecond), cid)
				
				for j = 1, intensity do
					
					if(malfunctionChoice) then
						addEvent(malfunction, i * j * 1000 / ( 4 * spinsPerSecond) / intensity, cid)
					end
					
				end
				
			end
			
		end
		
		addEvent(selectSpecificOutfit, choiceDelay * 1000 + 1, cid, outfits, param)
	end
	
	return true
end

--selects an outfit randomly and wears it, relaying the description of said outfit
function selectRandomOutfit(cid, outfits)
	
	local decision = math.random(1, table.maxn(outfits))
	doCreatureChangeOutfit(cid, outfits[decision].combination)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Outfit: \'' .. outfits[decision].description .. '\' has been randomly selected and successfully equipped.')
	
	return true
end

--selects an outfit and wears it based on the outfit number previously given and relays the description of said outfit
function selectSpecificOutfit(cid, outfits, param)
	
	doCreatureChangeOutfit(cid, outfits[param].combination)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Outfit: \'' .. outfits[param].description .. '\' has been chosen and successfully equipped.')
	
	return true
end

--orients the player to their left, if looped it creates an illusion of spinning in a counter-clockwise fashion
function spin(cid)

	if(getCreatureLookDirection(cid) == 0) then
		doCreatureSetLookDirection(cid, 3)
	elseif(getCreatureLookDirection(cid) == 1) then
		doCreatureSetLookDirection(cid, 0)
	elseif(getCreatureLookDirection(cid) == 2) then
		doCreatureSetLookDirection(cid, 1)
	elseif(getCreatureLookDirection(cid) == 3) then
		doCreatureSetLookDirection(cid, 2)
	end

	return true
end

--randomizes the colour scheme of the player`s current outfit, keeping addons and looktype intact
function malfunction(cid)
	
	doCreatureChangeOutfit(cid, {lookType = getCreatureOutfit(cid).lookType, lookHead = math.random(0,132), lookBody = math.random(0,132), lookLegs = math.random(0,132), lookFeet = math.random(0,132), lookAddons = getCreatureOutfit(cid).lookAddons})
	
	return true
end
 
Last edited by a moderator:
didnt know what that is and didnt know how to use and didnt know what do that do o.O can u plz explain and make a small tut. ??
 
didnt know what that is and didnt know how to use and didnt know what do that do o.O can u plz explain and make a small tut. ??

It`s a talkaction, to implement it you put this in your talkactions:
XML:
<talkaction log="yes" words="/g" access="6" event="script" value="lookin so fly like a g6.lua"/>

and make a fille called `lookin so fly like a g6.lua`, put it into your talkactions/scripts folder and put the code in it :P

Then ingame you use /g and it picks a random outfit for you or type /g 4 to pick outfit #4 or /g 6 to pick outfit #6.

Of course you should change the outfit looktypes / colours to ones that you like :p
 
Back
Top