• 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 Problems with the 'doTransformBack' function.

Exoltes

Novia OTserv Developer
Joined
Jul 2, 2009
Messages
563
Reaction score
47
Location
Belgium
I'm working on a 8.54 Open Tibia Server using The Forgotten Server - Version 0.2.7 (Mystic Spirit).

I've been working on this script that changes a certain island into snow/ice and turns it back to normal after a while.

But now that I finnaly gotten to configurating my grass into snow I'm running into a new problem
The problem is that once a player walks over the new snow tiles and the footprints are still there at the moment of the change back the script doesn't turn the tiles back but just gives an error and leaves then as they are or even worse they start to bugg. (as shown in the picture)
2v8lc10.png


Used code (in action script)
Code:
addEvent(doTransformBack, 2*6*1000, {x = 747, y = 1008, z = 7}, getTileThingByPos({x = 747, y = 1008, z = 7, stackpos = 0}).itemid, 670)
doSendMagicEffect({x = 747, y = 1008, z = 7 },CONST_ME_ICEAREA)
doTransformItem(getTileItemById({x = 747, y = 1008, z = 7}, getTileThingByPos({x = 747, y = 1008, z = 7, stackpos = 0}).itemid).uid,  670)

Error (in console)
Code:
[11/07/2015 17:15:32] Lua Script Error: [Action Interface]
[11/07/2015 17:15:32] in a timer event called from:
[11/07/2015 17:15:32] data/actions/scripts/quests/Ice Change.lua:onUse

[11/07/2015 17:15:32] luaDoTransformItem(). Item not found

Thanks in advance.
 
Also it would be nice if someone know how I can make the new snow tiles be randomly generated instead of beeing all the same snow tiles. (But this isn't a game changing issue)
 
In the doTransformBack function, you can get the itemid there, so it gets the one from the moment it executes the function (so just use the pos then for the snow tiles).
For the randomizing you can use math.random.
Code:
local newitemid = 670
if math.random(1, 2) == 1 then
     newitemid = math.random(6580, 6593)
end
Like this 50% will be ID 670, the other 50% will be those other snow grounds.
 

Similar threads

Back
Top