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

CreatureEvent Outfit onLogin

hodleo

Formerly cbrm -Crypto enthusiast, Retired scripter
Staff member
Global Moderator
Joined
Jan 6, 2009
Messages
6,598
Solutions
3
Reaction score
955
Location
Caribbean Sea
hm someone requested this script. It's very simple, it changes the outfit based on certain groupIDs of characters. Just edit the outfit and you'll get rid of those robes xD

A) BASED ON GROUP ID (GOD, GM, CM, etc)
outfit.lua
Lua:
  --[[
        Script by Cybermaster
        Fix by Shawak

        [1] = Player
        [2] = GM outfit
        [3] = GOD outfit
]]--

local outfits = {
        [1] = {lookType = 266, lookHead = 114 , lookBody = 18, lookLegs = 94, lookFeet = 0, lookTypeEx = 0, lookAddons = 0},
        [2] = {lookType = 75, lookHead = 114 , lookBody = 18, lookLegs = 94, lookFeet = 0, lookTypeEx = 0, lookAddons = 0},
        [3] = {lookType = 302, lookHead = 114 , lookBody = 18, lookLegs = 94, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}
}

function onLogin(cid)
        local group_id = getPlayerGroupId(cid)
        if group_id > 1 then
                doSetCreatureOutfit(cid, outfits[group_id], -1)
        end
        return TRUE
end

B) BASED ON VOCATION
Lua:
		-- Script by Cybermaster
	-- Fix by Shawak
--Rescripted, based on vocations

  --[[
        [1] = Sorcerer
        [2] = Druid
        [3] = Paladin
	[4] = Knight
	[5] = Master Sorcerer
	[6] = Elder Druid
	[7] = Royal Paladin
	[8] = Elite Knight
]]--


local outfits = {
        [1] = {lookType = 266, lookHead = 114 , lookBody = 18, lookLegs = 94, lookFeet = 0, lookTypeEx = 0, lookAddons = 0},
        [2] = {lookType = 266, lookHead = 114 , lookBody = 18, lookLegs = 94, lookFeet = 0, lookTypeEx = 0, lookAddons = 0},
        [3] = {lookType = 266, lookHead = 114 , lookBody = 18, lookLegs = 94, lookFeet = 0, lookTypeEx = 0, lookAddons = 0},
        [4] = {lookType = 75, lookHead = 114 , lookBody = 18, lookLegs = 94, lookFeet = 0, lookTypeEx = 0, lookAddons = 0},
        [5] = {lookType = 301, lookHead = 114 , lookBody = 18, lookLegs = 94, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}
	[6] = {lookType = 301, lookHead = 114 , lookBody = 18, lookLegs = 94, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}
	[7] = {lookType = 301, lookHead = 114 , lookBody = 18, lookLegs = 94, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}
	[8] = {lookType = 301, lookHead = 114 , lookBody = 18, lookLegs = 94, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}
}

function onLogin(cid)
        local voc_id = getPlayerVocation(cid)
        if getPlayerVocation(cid) > 0 then
                doSetCreatureOutfit(cid, outfits[voc_id], -1)
        end
        return TRUE
end

add to creaturescripts.xml
Lua:
<event type="login" name="Outfit" script="outfit.lua"/>

You are allowed to give me ideas to improve this script, ex. to change the outfit based on the char's name. I tried it but didn't work.

KNOWN BUGS:
-) OUTFIT MAY NOT BE CHANGED, IT DOESN'T WORK
gotta need to fix that
 
Last edited:
Litle update, not tested:
Lua:
--[[
	Script by Cybermaster
	Fix by Shawak

	[1] = Tutor outfit
	[2] = CM outfit
	[3] = God outfit
]]--

local outfits = {
	[1] = {lookType = 266, lookHead = 114 , lookBody = 18, lookLegs = 94, lookFeet = 0, lookTypeEx = 0, lookAddons = 0},
	[2] = {lookType = 266, lookHead = 114 , lookBody = 18, lookLegs = 94, lookFeet = 0, lookTypeEx = 0, lookAddons = 0},
	[3] = {lookType = 266, lookHead = 114 , lookBody = 18, lookLegs = 94, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}
}

function onLogin(cid)
	local group_id = getPlayerGroupId(cid)
	if group_id > 1 then
		doSetCreatureOutfit(cid, outfits[group_id], -1)
	end 
	return TRUE 
end
;)
 
Last edited:
fully working, thnx shawak for your improvement

hm what was that LUA tag code again?(quote)
 
Lua:
function testTag(tags)
   if isTagWorking(tags) == TRUE then
       works = "WORKING" 
   else
       works = "NOT WORKING" 
   end
   return works
end

[*lua]
[*/lua]

remove *
 
Lua:
function testTag(tags)
   if isTagWorking(tags) == TRUE then
       works = "WORKING" 
   else
       works = "NOT WORKING" 
   end
   return works
end

[*lua]
[*/lua]

remove *

Lua:
function testTag(tags)
	return isTagWorking(tags) and works = "WORKING" or works = "NOT WORKING"
end
^_^
 
Oo I\
EDIT: OH you posted lol, well thanks, i think that -1 = infinite...gonna try xD

I kind of did it, it only lasts for a few seconds...here's the code, how do I make it infinite?

local outfits = {
[1] = {lookType = 49},
[2] = {lookType = 293},
[3] = {lookType = 11},
[4] = {lookType = 301}
}

function onLogin(cid)
local vocation = getPlayerVocation(cid)
if vocation == 1 then
doSetCreatureOutfit(cid, outfits[1], 9999) else
if vocation == 2 then
doSetCreatureOutfit(cid, outfits[2], 9999) else
if vocation == 3 then
doSetCreatureOutfit(cid, outfits[3], 9999) else
if vocation == 4 then
doSetCreatureOutfit(cid, outfits[4], 9999)
end
end
end
end
return TRUE
end
 
Last edited:
Oo I'm a nub scripter, and this is nice, but how would I set it based of vocations?

Lua:
		-- Script by Cybermaster
	-- Fix by Shawak
--Rescripted, based on vocations

  --[[
        [1] = Sorcerer
        [2] = Druid
        [3] = Paladin
	[4] = Knight
	[5] = Master Sorcerer
	[6] = Elder Druid
	[7] = Royal Paladin
	[8] = Elite Knight
]]--


local outfits = {
        [1] = {lookType = 266, lookHead = 114 , lookBody = 18, lookLegs = 94, lookFeet = 0, lookTypeEx = 0, lookAddons = 0},
        [2] = {lookType = 266, lookHead = 114 , lookBody = 18, lookLegs = 94, lookFeet = 0, lookTypeEx = 0, lookAddons = 0},
        [3] = {lookType = 266, lookHead = 114 , lookBody = 18, lookLegs = 94, lookFeet = 0, lookTypeEx = 0, lookAddons = 0},
        [4] = {lookType = 75, lookHead = 114 , lookBody = 18, lookLegs = 94, lookFeet = 0, lookTypeEx = 0, lookAddons = 0},
        [5] = {lookType = 301, lookHead = 114 , lookBody = 18, lookLegs = 94, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}
	[6] = {lookType = 301, lookHead = 114 , lookBody = 18, lookLegs = 94, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}
	[7] = {lookType = 301, lookHead = 114 , lookBody = 18, lookLegs = 94, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}
	[8] = {lookType = 301, lookHead = 114 , lookBody = 18, lookLegs = 94, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}
}

function onLogin(cid)
        local voc_id = getPlayerVocation(cid)
        if getPlayerVocation(cid) > 0 then
                doSetCreatureOutfit(cid, outfits[voc_id], -1)
        end
        return TRUE
end

haven't tested it
 
Last edited:
lol thanks, now I added it to the main post
 
Just perfected my voc-based doors from this script too xD thanks

Scripting is fun when ur script works out perfect...
 
Cybermaster. In Avesta I have a lua function called doCreatureChangeOutfit which allows the player to change the outfit. You could use that function instead of doSetCreatureOutfit.

Just change this line:
Lua:
doSetCreatureOutfit(cid, outfits[voc_id], -1)

To this:
Lua:
doCreatureChangeOutfit(cid, outfits[voc_id])

I think that function is in TFS too, but if you need it I can help you creating it in C++.
 
Back
Top