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

Is it possible to make certain vocations start with certain addons and outfits? Rep+

Rugged Mage

Lua Scripter
Joined
Mar 8, 2010
Messages
1,182
Solutions
2
Reaction score
77
If it is possible to make certain vocations start with certain addons and outfits, please tell me. i am currently using XML so i prefer a xml way to do this
Rep+ for who gives me correct answer
 
LUA:
local vocations = {
	[1] = {
		{OUTFIT_ID, ADDONS}, -- you can add as much as you want, just add another {OUTFIT_ID, ADDONS}
		{OUTFIT_ID, ADDONS} -- addons: 0 - none, 1 - first, 2 - second, 3 - both
	},
	[2] = {
		{OUTFIT_ID, ADDONS
	}, 
	[3] = {
		{OUTFIT_ID, ADDONS}
	},
	[4] = {
		{OUTFIT_ID, ADDONS}
	}
}
function onLogin(cid)
	for i = 1, #vocations[getPlayerVocation(cid)] do
		if(not(canPlayerWearOutfit(cid, vocations[getPlayerVocation(cid)][i][1], vocations[getPlayerVocation(cid)][i][2]))) then
			doPlayerAddOutfit(cid, vocations[getPlayerVocation(cid)][i][1], vocations[getPlayerVocation(cid)][i][2])
		end
	end
	return true
end
 
/data/creaturescripts/scripts/outfits.lua

and

/data/creaturescripts/creaturescripts.xml add:

XML:
	<event type="login" name="outfits" event="script" value="outfits.lua"/>
 
Creaturescripts,

Looking at the script, you'll have to edit a lot of things.
Better go learn LUA, you got work to do!

EDIT: you beat me to post
 
Creaturescripts,

Looking at the script, you'll have to edit a lot of things.
Better go learn LUA, you got work to do!

EDIT: you beat me to post

Why would he need to edit a lot of things? Only outfitid and how many addons it will give.
 
LUA:
local vocations = {
	[1] = {
		{OUTFIT_ID, ADDONS}, -- you can add as much as you want, just add another {OUTFIT_ID, ADDONS}
		{OUTFIT_ID, ADDONS} -- addons: 0 - none, 1 - first, 2 - second, 3 - both
	},
	[2] = {
		{OUTFIT_ID, ADDONS
	}, 
	[3] = {
		{OUTFIT_ID, ADDONS}
	},
	[4] = {
		{OUTFIT_ID, ADDONS}
	}
}
function onLogin(cid)
	for i = 1, #vocations[getPlayerVocation(cid)] do
		if(not(canPlayerWearOutfit(cid, vocations[getPlayerVocation(cid)][i][1], vocations[getPlayerVocation(cid)][i][2]))) then
			doPlayerAddOutfit(cid, vocations[getPlayerVocation(cid)][i][1], vocations[getPlayerVocation(cid)][i][2])
		end
	end
	return true
end

so on in the {OUTFIT_ID, ADDONS} i just put {3}? and the one above it i just put {the number of the id}?
 
hmm now i cant logon account manager, it says:
[Error - CreatureScript Interface]
data/creaturescripts/scripts/outfits.lua:onLogin
Description:
data/creaturescripts/scripts/outfits.lua:17: attempt to get length of field '?'
(a nil value)
stack traceback:
data/creaturescripts/scripts/outfits.lua:17: in function {data/creaturescripts/scripts/outfits.lua:16}

(EDIT - now i cant logon GOD)
 
Try now:

LUA:
local vocations = {
	[1] = {
		{OUTFIT_ID, ADDONS}, -- you can add as much as you want, just add another {OUTFIT_ID, ADDONS}
		{OUTFIT_ID, ADDONS} -- addons: 0 - none, 1 - first, 2 - second, 3 - both
	},
	[2] = {
		{OUTFIT_ID, ADDONS
	}, 
	[3] = {
		{OUTFIT_ID, ADDONS}
	},
	[4] = {
		{OUTFIT_ID, ADDONS}
	}
}
function onLogin(cid)
	if(string.lower(getPlayerName(cid)) == "account manager" or getPlayerAccess(cid) > 1 or not(vocations[getPlayerVocation(cid)])) then
		return true
	end
	for i = 1, #vocations[getPlayerVocation(cid)] do
		if(not(canPlayerWearOutfit(cid, vocations[getPlayerVocation(cid)][i][1], vocations[getPlayerVocation(cid)][i][2]))) then
			doPlayerAddOutfit(cid, vocations[getPlayerVocation(cid)][i][1], vocations[getPlayerVocation(cid)][i][2])
		end
	end
	return true
end
 
do you think its possible to make them like as soon as they login thats the only suit they cant wear, for seperate classes?
 
LUA:
local outfits = {
	[1] = 134,
	[2] = 145,
	[3] = 155,
	[4] = 159
}

function onOutfit(cid, old, current)
	if(not(outfits[getPlayerVocation(cid)]) or getPlayerAcces(cid) > 2) then
		return true
	end
	if(current.lookType ~= outfits[getPlayerVocation(cid)]) then
		current.lookType == outfits[getPlayerVocation(cid)]
		doCreatureChangeOutfit(cid, current)
	end
	return true
end
 
Back
Top