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

How to use 'doSetMonsterOutfit'

Ecstacy

Mothafuckaaa
Joined
Dec 26, 2008
Messages
3,836
Reaction score
108
Location
The Netherlands
Hey,

Could someone tell me how this function exactly work?
I tried doSetMonsterOutfit(cid, 354) and doSetMonsterOufit(cid, 'bird') but neither of them worked and giving me this error:
Code:
[13/05/2010 21:20:09] attempt to index a nil value
[13/05/2010 21:20:09] stack traceback:
[13/05/2010 21:20:09] 	[C]: in function 'doCreatureChangeOutfit'

thanks in advance,
unknown666
 
No, I don't want it to have time.
neither do I want it to be 9999999999999 second so it'll be infinite or something like that, I just want to know how to use doSetMonsterOufit.
 
doSetMonsterOutfit(cid, ..., -1)
-1 means infinite i guess :Sssssssss
or
doCreatureChangeOut(define the monster, ...)
 
Hmmm, this seems to be the error now.

LUA:
local t = {
	[2324] = {outfit=354, text='Fly, mew!'}
	}

   #error     local r = t[item.uid].outfit
   #error     local text = t[item.uid].text

(not whole script, just local + error)
 
I don't mind.
Only the onEquip part though.

LUA:
local t = {
	[2324] = {outfit=354, text='Fly, mew!'}
	}

function onEquip(cid, item, slot)
local charpos =  getPlayerPosition(cid)
	if charpos.z >= 5 and charpos.z <= 7 then
	local r = t[item.uid].outfit
	local text = t[item.uid].text
		doCreatureSay(cid, text)
		doSetMonsterOufit(cid, r, -1)
		doTeleportThing(cid, {x=charpos.x, y=charpos.y, z=charpos.z+1}, FALSE)
		doSendMagicEffect({x=charpos.x, y=charpos.y, z=charpos.z+1}, 10)
		return true
	end
end
 
Code:
local t =  {
	[2324] = {outfit=354, text='Fly, mew!'}
}
function onEquip(cid, item, slot)
	local charpos =  getPlayerPosition(cid)
	if charpos.z >= 5 and charpos.z <= 7 then
		local r = t[item.uid]
		doCreatureSay(cid, r.text, 19)
		doSetMonsterOufit(cid, r.outfit, -1)
		doTeleportThing(cid, {x=charpos.x, y=charpos.y, z=charpos.z+1}, FALSE)
		doSendMagicEffect({x=charpos.x, y=charpos.y, z=charpos.z+1}, 10)
	end
	return true
end
 
You have a comma between the text, so it thinks that it's two.

Code:
local t =  {
	[2324] = {outfit=354, text='Fly, mew!'}
}
local r = t[item.uid]
doCreatureSay(cid, r.text, 19)
end

Code:
doCreatureSay(cid, [math.random(1, #r.text)], TALKTYPE_ORANGE_1)
 
local r = t[item.itemid] ? Or are you using a unique id on the item? :p
Code:
function onEquip(cid, item, slot)
	local t =  {
		[2324] = {outfit=354, text='Fly, mew!'}
	}
	local v, r = getThingPos(cid), t[item.uid]
	local pos = {x = v.x, y = v.y, z = v.z + 1}
	if v.z >= 5 and v.z <= 7 then
		if r then
			doCreatureSay(cid, r.text, 19)
			doSetMonsterOutfit(cid, r.outfit, -1)
			doTeleportThing(cid, pos, false)
			doSendMagicEffect(pos, 10)
		end
	end
	return true
end
 
LUA:
local t =  {
		[2324] = {outfit='mew', outfitn='rat', text='Fly, mew!', dtext='Go down, mew!'}
	}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local v, r, s = getCreaturePosition(cid), t[item.itemid], 100
	local pos = {x = v.x, y = v.y, z = 6}
	local posd = {x = v.x, y = v.y, z = 7}
	if v.z == 7 then
		if r then
			doSetMonsterOutfit(cid, r.outfit, -1)
			doTeleportThing(cid, pos, false)
			doSendMagicEffect(pos, 10)
			doCreatureSay(cid, r.text, 19)
		else
			doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, 'There has been some error, try contacting a staff member.')
		end
	elseif v.z == 6 then
		if r then
			doSetMonsterOutfit(cid, r.outfitn, -1)
			doTeleportThing(cid, posd, false)
			doSendMagicEffect(posd, 10)
			doCreatureSay(cid, r.dtext, 19)
		else
			doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, 'There has been some error, try contacting a staff member.')
		end
	end
	return true
end

it works now, but yet another quick request.

How would I make this save the oufit the user was before?
And how would I make it check if z=6 contains a tile/player has teleported?
 
Back
Top