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

Transform item on use with 10% chance

Kubuxxx

Title
Joined
May 25, 2009
Messages
91
Reaction score
2
hello!
Today i need script to transform item, but only when im use this item (life crystal - 2177)
on XXXX item, and if its succesful (10% chance ) life crystal transform to item id 9743.

I think it's simple script to write, and i would be thankful to somebody who write it.
 
Maybe this...:
Lua:
local i = math.random(1, 10)
function onUse(cid, item, fromPos, itemEx, toPos)
if i == 5 then
doTransformItem(item.uid, 9743)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have obtained a "..getItemNameById(9743)..".")
else
doPlayerSentTextMessage(cid, 18, "Sorry, you fail it.")
end
return true
end

That's the script... Hope you know how to add it to actions ;)
 
UP
It's dont work.

New form of this script what i ask:
questp.jpg

else:
item would be disappear
I think its good explained. Can any1 help ?
Thanks alot :)
Edit:
 
Last edited:
PHP:
local itemid = 2177
local pos = {x=1000, y=1000, z=7, stackpos=255}
function onUse(cid, item, fromPos, itemEx, toPos)
	local itempos = getThingFromPos(pos)
	if itempos.itemid ~= itemid then
		return true
	end
	local i = math.random(100)
	if (i <= 10) then
		doTransformItem(itempos.uid, 9743)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have obtained a "..getItemNameById(9743)..".")
	else
		doRemoveItem(itempos.uid)
		doPlayerSentTextMessage(cid, 18, "Sorry, try again.")
	end
	return false
end
not tested
 
Looll.....
Mine is not your request because i didnt undertand you well.....
And my script only have 10 lines.... cant have a error in line 22....

@leyendario: you are the same guy of otfusion.org??? xDD
 
Back
Top