Advertisement
Kijan

Untitled

Feb 20th, 2019
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.48 KB | None | 0 0
  1. function copyBag(count, positions)
  2.     local bagTable = Global.getTable('bags')
  3.     local terrainBag = getObjectFromGUID(bagTable.terrain.guid)
  4.     local pos = {x = math.random(0, xMax) * step + start.x, y = start.y, z = math.random(0, zMax) * step + start.z}
  5.     if positions ~= nil then
  6.         pos = positions[1]
  7.     end
  8.     local object = takeO(terrainBag, self.getName(), pos) --<---Pulls out the first object and places it
  9.     -- you have to put things here to check for the first object
  10.     if count > 1 then --<-----------If more then one object has to be pulled out it has to copy it
  11.         Wait.condition(
  12.             function()
  13.                 for i=2, count do
  14.                     if positions ~= nil then --<---------- This will only be executed when more then 1 object will be copied
  15.                         object.clone({position = positions[i]})
  16.                     else
  17.                         object.clone({position = {x = math.random(0, xMax) * step + start.x, y = start.y, z = math.random(0, zMax) * step + start.z}})
  18.                     end
  19.                     -- you have to put things here for checks of the next objects but oyu have to use a variable before the if like at the botton for the putObject
  20.                 end
  21.             end,
  22.             function()
  23.                 return checkLoaded(object)
  24.             end
  25.         )
  26.     end
  27.     object.clone({position = terrainBag.getPosition()}) --<-- I meant this Clone is the putting bag clone
  28.     --Here has to come the stuff for putObject
  29.     --like
  30.     -- local newObj = object.clone({position = terrainBag.getPosition()})
  31.     -- Wait.condition(function() terrainBag.putObject(newObj) end, function() return checkLoaded(newObj) end)
  32. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement