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

Food Problems

balador

New Member
Joined
Jan 31, 2010
Messages
23
Reaction score
0
In regular tibia. You have food that will give you a bonus to your skills. Example rotworm stew for knights. I was trying to mess around with it and get it to work on my ot. I wrote a code or whatever, but I'm sue it's not right.

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 9992 and getPlayerLevel(cid) >= 1 and getPlayerSkill(cid, 1) and getPlayerVocation == 4 then
		doPlayerAddSkillTrys(cid, 3, 10)
		doPlayerSendTextMessage(cid, 22, "You feel stronger.")
	else
		doPlayerSendTextMessage(cid,22, "Your not the right class for this item.")
	end
end

I got the bottom part to work lol, but thats all. I'm sure it's something I've did wrong. Any help is welcome.
 
Actually, rotworm stew should restore your health.

anyways..
Code:
local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, 10 * 60 * 1000) -- 10 minutes
setConditionParam(condition, CONDITION_PARAM_SKILL_MELEE, 5)
setConditionParam(condition, CONDITION_PARAM_SUBID, 4)

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if isKnight(cid) == TRUE then
		doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_RED)
		doRemoveItem(item.uid)
		doAddCondition(cid, condition)
		doCreatureSay(cid, "You feel stronger.", TALKTYPE_ORANGE_1)
	else
		doCreatureSay(cid, "Only knights may use this item.", TALKTYPE_ORANGE_1)
	end
	return true
end
 
Back
Top