adrianoswatt

Press2Remove The Rock (TimeScript)

Nov 4th, 2017
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 7.88 KB | None | 0 0
  1. -- id = ID da Pedra
  2. -- pos = Pos da Pedra
  3. -- pressTime = Tempo que ficará preso pressionando o tile que remove a Pedra (Em segundos)
  4. -- durationTime = Por quanto tempo a Pedra ficará ausente (Em segundos)
  5.  
  6. local id = {
  7.     [20201] = {id = 1354, pos = {x = 1564, y = 1523, z = 10}, pressTime = 30, durationTime = 10,
  8.                     monsters = {
  9.                         {monster = "dragon", pos = {x = 1564, y = 1523, z = 10}},
  10.                         {monster = "dragon", pos = {x = 1564, y = 1523, z = 10}},
  11.                     }
  12.                 },
  13.     [20202] = {id = 1354, pos = {x = 1558, y = 1523, z = 10}, pressTime = 30, durationTime = 10,
  14.                     monsters = {
  15.                         {monster = "demon", pos = {x = 1564, y = 1523, z = 10}},
  16.                         {monster = "demon", pos = {x = 1564, y = 1523, z = 10}},
  17.                     }
  18.                 },
  19.     [20203] = {id = 1354, pos = {x = 1552, y = 1523, z = 10}, pressTime = 30, durationTime = 10,
  20.                     monsters = {
  21.                         {monster = "dragon", pos = {x = 1564, y = 1523, z = 10}},
  22.                         {monster = "demon", pos = {x = 1564, y = 1523, z = 10}},
  23.                     }
  24.                 },
  25.     [20204] = {id = 1354, pos = {x = 1546, y = 1523, z = 10}, pressTime = 30, durationTime = 10,
  26.                     monsters = {
  27.                         {monster = "dragon", pos = {x = 1564, y = 1523, z = 10}},
  28.                         {monster = "demon", pos = {x = 1564, y = 1523, z = 10}},
  29.                     }
  30.                 },
  31.     [20205] = {id = 1354, pos = {x = 1540, y = 1523, z = 10}, pressTime = 30, durationTime = 10,
  32.                     monsters = {
  33.                         {monster = "dragon", pos = {x = 1564, y = 1523, z = 10}},
  34.                         {monster = "demon", pos = {x = 1564, y = 1523, z = 10}},
  35.                     }
  36.                 },
  37.     [20206] = {id = 1354, pos = {x = 1534, y = 1523, z = 10}, pressTime = 30, durationTime = 10,
  38.                     monsters = {
  39.                         {monster = "dragon", pos = {x = 1564, y = 1523, z = 10}},
  40.                         {monster = "demon", pos = {x = 1564, y = 1523, z = 10}},
  41.                     }
  42.                 },
  43.     [20207] = {id = 1354, pos = {x = 1528, y = 1523, z = 10}, pressTime = 30, durationTime = 10,
  44.                     monsters = {
  45.                         {monster = "dragon", pos = {x = 1564, y = 1523, z = 10}},
  46.                         {monster = "demon", pos = {x = 1564, y = 1523, z = 10}},
  47.                     }
  48.                 },
  49.     [20208] = {id = 1354, pos = {x = 1522, y = 1523, z = 10}, pressTime = 30, durationTime = 10,
  50.                     monsters = {
  51.                         {monster = "dragon", pos = {x = 1564, y = 1523, z = 10}},
  52.                         {monster = "demon", pos = {x = 1564, y = 1523, z = 10}},
  53.                     }
  54.                 },
  55.     [20209] = {id = 1354, pos = {x = 1516, y = 1523, z = 10}, pressTime = 30, durationTime = 10,
  56.                     monsters = {
  57.                         {monster = "dragon", pos = {x = 1564, y = 1523, z = 10}},
  58.                         {monster = "demon", pos = {x = 1564, y = 1523, z = 10}},
  59.                     }
  60.                 },
  61.     [20210] = {id = 1354, pos = {x = 1510, y = 1523, z = 10}, pressTime = 30, durationTime = 10,
  62.                     monsters = {
  63.                         {monster = "dragon", pos = {x = 1564, y = 1523, z = 10}},
  64.                         {monster = "demon", pos = {x = 1564, y = 1523, z = 10}},
  65.                     }
  66.                 },
  67.     [20211] = {id = 1354, pos = {x = 1504, y = 1523, z = 10}, pressTime = 30, durationTime = 10,
  68.                     monsters = {
  69.                         {monster = "dragon", pos = {x = 1564, y = 1523, z = 10}},
  70.                         {monster = "demon", pos = {x = 1564, y = 1523, z = 10}},
  71.                     }
  72.                 },
  73.     [20212] = {id = 1354, pos = {x = 1498, y = 1523, z = 10}, pressTime = 30, durationTime = 10,
  74.                     monsters = {
  75.                         {monster = "dragon", pos = {x = 1564, y = 1523, z = 10}},
  76.                         {monster = "demon", pos = {x = 1564, y = 1523, z = 10}},
  77.                     }
  78.                 },
  79.     [20213] = {id = 1354, pos = {x = 1492, y = 1523, z = 10}, pressTime = 30, durationTime = 10,
  80.                     monsters = {
  81.                         {monster = "dragon", pos = {x = 1564, y = 1523, z = 10}},
  82.                         {monster = "demon", pos = {x = 1564, y = 1523, z = 10}},
  83.                     }
  84.                 },
  85.     [20214] = {id = 1354, pos = {x = 1486, y = 1523, z = 10}, pressTime = 30, durationTime = 10,
  86.                     monsters = {
  87.                         {monster = "dragon", pos = {x = 1564, y = 1523, z = 10}},
  88.                         {monster = "demon", pos = {x = 1564, y = 1523, z = 10}},
  89.                     }
  90.                 },
  91.     [20215] = {id = 1354, pos = {x = 1480, y = 1523, z = 10}, pressTime = 30, durationTime = 10,
  92.                     monsters = {
  93.                         {monster = "dragon", pos = {x = 1564, y = 1523, z = 10}},
  94.                         {monster = "demon", pos = {x = 1564, y = 1523, z = 10}},
  95.                     }
  96.                 },
  97.     [20216] = {id = 1354, pos = {x = 1473, y = 1523, z = 10}, pressTime = 30, durationTime = 10,
  98.                     monsters = {
  99.                         {monster = "dragon", pos = {x = 1564, y = 1523, z = 10}},
  100.                         {monster = "demon", pos = {x = 1564, y = 1523, z = 10}},
  101.                     }
  102.                 },
  103.     [20217] = {id = 1354, pos = {x = 1466, y = 1523, z = 10}, pressTime = 30, durationTime = 10,
  104.                     monsters = {
  105.                         {monster = "dragon", pos = {x = 1564, y = 1523, z = 10}},
  106.                         {monster = "demon", pos = {x = 1564, y = 1523, z = 10}},
  107.                     }
  108.                 },
  109.     [20218] = {id = 1354, pos = {x = 1459, y = 1523, z = 10}, pressTime = 30, durationTime = 10,
  110.                     monsters = {
  111.                         {monster = "dragon", pos = {x = 1564, y = 1523, z = 10}},
  112.                         {monster = "demon", pos = {x = 1564, y = 1523, z = 10}},
  113.                     }
  114.                 },
  115.     [20219] = {id = 1354, pos = {x = 1452, y = 1523, z = 10}, pressTime = 30, durationTime = 10,
  116.                     monsters = {
  117.                         {monster = "dragon", pos = {x = 1564, y = 1523, z = 10}},
  118.                         {monster = "demon", pos = {x = 1564, y = 1523, z = 10}},
  119.                     }
  120.                 },
  121.     [20220] = {id = 1354, pos = {x = 1445, y = 1523, z = 10}, pressTime = 30, durationTime = 10,
  122.                     monsters = {
  123.                         {monster = "dragon", pos = {x = 1564, y = 1523, z = 10}},
  124.                         {monster = "demon", pos = {x = 1564, y = 1523, z = 10}},
  125.                     }
  126.                 },
  127.     [20221] = {id = 1354, pos = {x = 1437, y = 1523, z = 10}, pressTime = 60, durationTime = 10,
  128.                     monsters = {
  129.                         {monster = "dragon", pos = {x = 1564, y = 1523, z = 10}},
  130.                         {monster = "demon", pos = {x = 1564, y = 1523, z = 10}},
  131.                     }
  132.                 },
  133. }
  134.  
  135.  
  136. function onStepIn(cid, item, position, fromPosition)
  137.     if isPlayer(cid) then
  138.         get = id[item.actionid]
  139.         if get then
  140.             setPlayerStorageValue(cid, 20200, item.actionid)
  141.             rock = getTileItemById(get.pos, get.id)
  142.             if rock.uid > 0 then
  143.                 local condition = createConditionObject(CONDITION_INFIGHT)
  144.                 setConditionParam(condition, CONDITION_PARAM_TICKS, get.pressTime * 1000)
  145.                 doAddCondition(cid, condition)
  146.                 mayNotMove(cid, true)
  147.                 doRemainCountBySwatt(getThingPos(cid), get.pressTime, "Ready!", math.random(1, 255))
  148.                 doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "The rock button is loading, wait to remove the rock.")
  149.                 addEvent(function()
  150.                     if isPlayer(cid) then
  151.                         rockPOS, rockID = get.pos, get.id
  152.                         rockUID = getTileItemById(rockPOS, rockID).uid
  153.                         doSendMagicEffect(rockPOS, CONST_ME_POFF)
  154.                         doRemoveItem(rockUID, 1)
  155.                         mayNotMove(cid, false)
  156.                         nget = id[getPlayerStorageValue(cid, 20200)]
  157.                         if not nget then print('Ocorreu um erro no script de remover pedra e sumonar monstro [By Swatt].') end
  158.                         for a = 1, #nget.monsters do
  159.                             creat = getTopCreature(nget.monsters[a].pos)
  160.                             if creat.uid > 0 then doRemoveCreature(creat.uid) end
  161.                             doSendMagicEffect(nget.monsters[a].pos, CONST_ME_EXPLOSIONAREA)
  162.                             doCreateMonster(nget.monsters[a].monster, nget.monsters[a].pos)
  163.                         end
  164.                         addEvent(function()
  165.                             doSendMagicEffect(rockPOS, CONST_ME_EXPLOSIONAREA)
  166.                             doCreateItem(rockID, 1, rockPOS)
  167.                         end, get.durationTime * 1000)
  168.                     end
  169.                 end, get.pressTime * 1000)
  170.             end        
  171.         end
  172.     end
  173. return true
  174. end
  175.  
  176. function doRemainCountBySwatt(pos, tempo, texto, color)
  177.     for x = 0, tempo do
  178.         addEvent(function()
  179.             if x < tempo then
  180.                 doSendAnimatedText(pos, ""..(tempo - x).."", color)
  181.             else
  182.                 doSendAnimatedText(pos, ""..texto.."", color)
  183.             end
  184.         end, 1000*x)
  185.     end
  186. end
Advertisement
Add Comment
Please, Sign In to add comment