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

Use Item, And Become Promoted

Call Me Taffy

Call Me Maybe
Joined
Aug 9, 2009
Messages
651
Reaction score
123
I wanted my code to check if the player was level 150, with magic level 100, and the right vocation. uid = 19001 on the item, and it's correct in actions.xml. Also, I'm using TFS 0.3.5. Here's what i got to, with the current error:

Script:
Code:
local playerVoc = getPlayerVocation(cid)
local playerLevel = getPlayerLevel(cid)
local playerMlvl = getPlayerMagLevel(cid)

function onUse(cid, item, fromPosition, itemEx, toPosition) 
	if item.uid == 19001
		then if playerVoc == 1
			then if playerLevel == 100
				then if playerMlvl == 100
	then doSendAnimatedText(getPlayerPosition(cid), "Promoted!", TEXTCOLOR_RED)
	doPlayerAddItem(cid, 7755)
	setPlayerVocation(cid, 5)	
	doSendMagicEffect(toPosition, CONST_ME_MAGIC_RED)
return true
else
	doPlayerSendCancel(cid, "You need to grow some weakling...")
end
end
end
end
end

And here's the error:
[11/08/2009 22:25:42] Lua Script Error: [Action Interface]
[11/08/2009 22:25:42] data/actions/scripts/pyro_promo.lua

[11/08/2009 22:25:42] internalGetPlayerInfo(). Player not found

[11/08/2009 22:25:42] Lua Script Error: [Action Interface]
[11/08/2009 22:25:42] data/actions/scripts/pyro_promo.lua

[11/08/2009 22:25:43] internalGetPlayerInfo(). Player not found

[11/08/2009 22:25:43] Lua Script Error: [Action Interface]
[11/08/2009 22:25:43] data/actions/scripts/pyro_promo.lua

[11/08/2009 22:25:43] luaGetPlayerMagLevel(). Player not found

If anyone could help, it would be greatly appreciated.
 
I wanted my code to check if the player was level 150, with magic level 100, and the right vocation. uid = 19001 on the item, and it's correct in actions.xml. Also, I'm using TFS 0.3.5. Here's what i got to, with the current error:

Script:


And here's the error:


If anyone could help, it would be greatly appreciated.

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition) -- Cid is defined on this line.  You can not use it above this line unless you define it accordingly. 
local playerVoc = getPlayerVocation(cid)
local playerLevel = getPlayerLevel(cid)
local playerMlvl = getPlayerMagLevel(cid) 
	if item.uid == 19001 then 
		if playerVoc == 1 then 
			if playerLevel >= 100 then --- Changed == to >=
				if playerMlvl >= 100 then --- Changed == to >=
					doSendAnimatedText(getPlayerPosition(cid), "Promoted!", TEXTCOLOR_RED)
					doPlayerAddItem(cid, 7755)
					setPlayerVocation(cid, 5)	
					doSendMagicEffect(toPosition, CONST_ME_MAGIC_RED)
				else
					doPlayerSendCancel(cid, "You need to grow some weakling...")
				end
			else
					doPlayerSendCancel(cid, "You need to grow some weakling...")
			end
		end
	end
return true
end

I didn't test the script, but I did fix some obvious errors. Read the comment posted in the script.
 
Ok thanks for that - Will test it - I'm a nub scripter xD

Was suprised when I got vocation doors to work using if itemid and uid and isKnight/isSorcerer,etc...
 
Back
Top