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

[Lua] doTransformItem Script...

ond

Veteran OT User
Joined
Mar 24, 2008
Messages
2,782
Solutions
25
Reaction score
491
Location
Sweden
Okey, this script might be a little hard to explain, but I'll give it a try.

From Tibiawikia:
7. Each member of your team must find the Carrot under one of the three hats in order to enter the door. If you guess wrong you will lose 200hp.

Rahemospart1.JPG


So, the script will some how randomize on three levers, when guessing wrong, it should remove 200 hp from the player, also when you find the carrot a storageValue should be set.

Thanks in advance!

EDIT:

If someone needs this script, PM me about it.
 
Last edited:
Try
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
doRemoveItem(getThingfromPos({x=fromPosition.x-1, fromPosition.y, fromPosition.z, stackpos = 1}).uid, 1)
if math.random(1,3) < 2 then
   doCreateItem(2684,1,{x=fromPosition.x-1, fromPosition.y, fromPosition.z})
   setPlayerStorageValue(cid,xxxx,1)
else
   doCreatureAddHealth(cid, -200)
end
return true
end
 
Character lose HP but the Carrot don't appear and I am getting this error:

Code:
Lua Script Error: [Action Interface]
data/actions/scripts/ankrahmun/script.lua:onUse

luaGetThingfromPos(). Tile not found
 
Last edited:
I guess It's not removing the, hat? Weird huh.
Try using
LUA:
doRemoveItem(getTileItemById({x=fromPosition.x-1, fromPosition.y, fromPosition.z}, HAT_ID).uid, 1)
Instead of
LUA:
doRemoveItem(getThingfromPos({x=fromPosition.x-1, fromPosition.y, fromPosition.z, stackpos = 1}).uid, 1)
 
Code:
luaDoRemoveItem(). Item not found
xD

Just a question, where did HAT_ID come from? o.O

Since its a new function, it needs the ID of the hat.
The error is abit weird, are you sure the hats are there? lol
 
Yes, I'm using Avesta 0.6.3 for 7.6 (Converted from OTServ 8.22 if im not mistaken). Perhaps I should have mentioned that :o
 
OH you mean that I need to change HAT_ID to the actuall ID? Damn I'm dumb lol

Switched HAT_ID to 2662 (the id of the hat) and it still says "item not found" :S
 
Ohh, you are using 7.6 x.x
Never touched any of those servers, I'm now not sure if the script is correct or not heh.
 
Well, it's not like those old XML, CVS YurOts servers, it contains mostly of all the script features from modern servers. :P And it works almost, all that is not working is that it don't find an item to remove xD
 
Nvm, I solved it the way I always do when I can't make it to a good script, the noob way, using 3 scripts and unique id xD Thanks so much for help anyways Santi!
 
Back
Top