1 local Timer_01 = 00
2 local Timer_02 = 00
3 local Timer_03 = 00
4 local Timer_04 = 00
5function onUse(player, item, fromPosition, target, toPosition, isHotkey)
6 local Player_01 = Tile(3617, 1264, 8)
7 local Player_02 = Tile(3620, 1267, 8)
8 local Player_03 = Tile(3617, 1270, 8)
9 local Player_04 = Tile(3614, 1267, 8)
10
11 local Player_One = Player_01:getTopCreature()
12 local Player_Two = Player_02:getTopCreature()
13 local Player_Tre = Player_03:getTopCreature()
14 local Player_Fou = Player_04:getTopCreature()
15
16 if item.itemid == 1946 then
17 item:transform(1945)
18 return true
19 end
20 if Player_One and Player_One:isPlayer() and Player_Two and Player_Two:isPlayer() and Player_Tre and Player_Tre:isPlayer() and Player_Fou and Player_Fou:isPlayer() then
21 item:transform(1946)
22 Player_One:teleportTo({x=3619, y=1296, z=08})
23 Player_One:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
24 Timer_01 = 59
25 addEvent(onTesouroUm, 1000)
26
27 Player_Two:teleportTo({x=3619, y=1310, z=08})
28 Player_Two:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
29 Timer_02 = 59
30 addEvent(onTesouroDois, 1000)
31
32 Player_Tre:teleportTo({x=3619, y=1324, z=08})
33 Player_Tre:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
34 Timer_03 = 59
35 addEvent(onTesouroTres, 1000)
36
37 Player_Fou:teleportTo({x=3619, y=1338, z=08})
38 Player_Fou:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
39 Timer_04 = 59
40 addEvent(onTesouroQuatro, 1000)
41 else
42
43 player:getPosition():sendMagicEffect(03)
44 end
45 return true
46end
47function onTesouroUm()
48 local from = {x=3616, y=1293, z=08}
49 local to = {x=3622, y=1299, z=08}
50 for A = from.x, to.x do
51 for B = from.y, to.y do
52 for C = from.z, to.z do
53 local tile = Tile(A, B, C)
54 if tile ~= nil then
55 local creature = tile:getTopCreature()
56 if creature and creature:isPlayer() then
57 if Timer_01 == 00 then
58 creature:teleportTo({x=3602, y=1261, z=08})
59 creature:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
60 break
61 else
62 Timer_01 = Timer_01 - 01
63 addEvent(onTesouroUm, 1000)
64 break
65 end
66 end
67 end
68 end
69 end
70 end
71end
72function onTesouroDois()
73 local from = {x=3616, y=1307, z=08}
74 local to = {x=3622, y=1313, z=08}
75 for A = from.x, to.x do
76 for B = from.y, to.y do
77 for C = from.z, to.z do
78 local tile = Tile(A, B, C)
79 if tile ~= nil then
80 local creature = tile:getTopCreature()
81 if creature and creature:isPlayer() then
82 if Timer_02 == 00 then
83 creature:teleportTo({x=3602, y=1261, z=08})
84 creature:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
85 break
86 else
87 Timer_02 = Timer_02 - 01
88 addEvent(onTesouroDois, 1000)
89 break
90 end
91 end
92 end
93 end
94 end
95 end
96end
97function onTesouroTres()
98 local from = {x=3616, y=1321, z=08}
99 local to = {x=3622, y=1327, z=08}
100 for A = from.x, to.x do
101 for B = from.y, to.y do
102 for C = from.z, to.z do
103 local tile = Tile(A, B, C)
104 if tile ~= nil then
105 local creature = tile:getTopCreature()
106 if creature and creature:isPlayer() then
107 if Timer_03 == 00 then
108 creature:teleportTo({x=3602, y=1261, z=08})
109 creature:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
110 break
111 else
112 Timer_03 = Timer_03 - 01
113 addEvent(onTesouroTres, 1000)
114 break
115 end
116 end
117 end
118 end
119 end
120 end
121end
122function onTesouroQuatro()
123 local from = {x=3616, y=1335, z=08}
124 local to = {x=3622, y=1341, z=08}
125 for A = from.x, to.x do
126 for B = from.y, to.y do
127 for C = from.z, to.z do
128 local tile = Tile(A, B, C)
129 if tile ~= nil then
130 local creature = tile:getTopCreature()
131 if creature and creature:isPlayer() then
132 if Timer_04 == 00 then
133 creature:teleportTo({x=3602, y=1261, z=08})
134 creature:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
135 break
136 else
137 Timer_04 = Timer_04 - 01
138 addEvent(onTesouroQuatro, 1000)
139 break
140 end
141 end
142 end
143 end
144 end
145 end
146end
147