Advertisement
Uissu

[X-TIBIA][ACTION] Raid Lever

Feb 4th, 2012
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.20 KB | None | 0 0
  1. -- tag: <action fromaid="19000" toaid="20000" event="script" value="leveraid.lua"/>
  2.  
  3. function onUse(cid, item, pos, item2, topos) -- By Byerne XTibia
  4.     local raids, r = {
  5.     [19000] = {msg = "Demons appeared somewhere!",exhaustion=120,price=10000,monsters = {
  6.         ["Demon"]={x=1000,y=1000,z=7},
  7.         ["Demon"]={x=1000,y=1001,z=7},
  8.         ["Demon"]={x=1001,y=1000,z=7} }
  9.             }
  10.                     }, raids[item.actionid]
  11.  
  12.     if not doPlayerRemoveMoney(cid, r.price) then
  13.         doPlayerSendCancel(cid, "It seems that you need to insert "..r.price.." coins to this lever to work.")
  14.         return true
  15.     end
  16.  
  17.     if getGlobalStorageValue(item.actionid)-os.time >= raids[item.actionid].exhaustion then
  18.         doPlayerSendCancel(cid, "This lever doesn\'t seems to work. Try again after waiting "..getGlobalStorageValue(item.actionid)-os.time".. seconds.")
  19.         return true
  20.     end
  21.  
  22.     for monster,position in pairs(raids[item.actionid].monsters) do
  23.         if doCreateMonster(monster, position) then
  24.             doSendMagicEffect(position, CONST_ME_TELEPORT)
  25.         end
  26.     end
  27.  
  28.     doBroadcastMessage(raids[item.actionid].msg)
  29.     setGlobalStorageValue(item.actionid, os.time+raids[item.actionid].exhaustion)
  30.     doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
  31. return true
  32. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement