Hi
This script spawns 3 random monsters in 3 different spawn positions when you step on a certain tile with the actionid 43030
The area where those monsters are appearing is from x=306, y=475, z=13 till x=308, y=481, z=13.
I made this script the best way i can and it is working but it is very extensive like you can see.
I would appreciate it if someone could make this script more simple.
I am using TFS 0.3.6, Tibia 8.54
Edit:
This script spawns 3 random monsters in 3 different spawn positions when you step on a certain tile with the actionid 43030
The area where those monsters are appearing is from x=306, y=475, z=13 till x=308, y=481, z=13.
I made this script the best way i can and it is working but it is very extensive like you can see.
I would appreciate it if someone could make this script more simple.
I am using TFS 0.3.6, Tibia 8.54
LUA:
function onStepIn(cid, item, pos)
local monster1 = math.random(1, 3)
local x1 = math.random(306, 308)
local y1 = math.random(475, 481)
local posstat1 = {x=x1, y=y1, z=13} -- Location of spawn 1
local monster2 = math.random(1, 3)
local x2 = math.random(306, 308)
local y2 = math.random(475, 481)
local posstat2 = {x=x2, y=y2, z=13} -- Location of spawn 2
local monster3 = math.random(1, 3)
local x3 = math.random(306, 308)
local y3 = math.random(475, 481)
local posstat3 = {x=x3, y=y3, z=13} -- Location of spawn 3
if isPlayer(cid) == TRUE and item.actionid == 43030 and monster1 == 1 then
doCreateMonster("Skeleton", posstat1)
elseif isPlayer(cid) == TRUE and item.actionid == 43030 and monster1 == 2 then
doCreateMonster("Ghoul", posstat1)
elseif isPlayer(cid) == TRUE and item.actionid == 43030 and monster1 == 3 then
doCreateMonster("Rat", posstat1)
end
if isPlayer(cid) == TRUE and item.actionid == 43030 and monster2 == 1 then
doCreateMonster("Skeleton", posstat2)
elseif isPlayer(cid) == TRUE and item.actionid == 43030 and monster2 == 2 then
doCreateMonster("Ghoul", posstat2)
elseif isPlayer(cid) == TRUE and item.actionid == 43030 and monster2 == 3 then
doCreateMonster("Rat", posstat2)
end
if isPlayer(cid) == TRUE and item.actionid == 43030 and monster3 == 1 then
doCreateMonster("Skeleton", posstat3)
elseif isPlayer(cid) == TRUE and item.actionid == 43030 and monster3 == 2 then
doCreateMonster("Ghoul", posstat3)
elseif isPlayer(cid) == TRUE and item.actionid == 43030 and monster3 == 3 then
doCreateMonster("Rat", posstat3)
end
return TRUE
end
Edit:
LUA:
doesn't work on this forum :)
Last edited: