vatam

Untitled

Jun 14th, 2014
412
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.52 KB | None | 0 0
  1. function addon:OnUpdate()
  2.     if not self.tUnits then return end
  3.  
  4.     local counter = 0
  5.     for k, v in pairs(self.tUnits) do
  6.         local tFacing = v:GetFacing()
  7.         if not tFacing then return end
  8.  
  9.         local tPos = v:GetPosition()
  10.         if not tPos then return end
  11.         --t2:FindChild("Pos"):SetText(("y: %s x: %s z: %s"):format(tPos.y, tPos.x, tPos.z)) -- debug
  12.  
  13.         local rot = math.atan(tFacing.x/tFacing.z)
  14.  
  15.         local rotPlus = rot+math.rad(60) -- offset
  16.         local rotNeg = rot+math.rad(-60) -- offset
  17.  
  18.         tFacing.x = tFacing.x*-1 -- because else it is an inverted flipped coordinate system
  19.  
  20.         if not self.markers[1] or not self.markers[1][1] then self:SetupMarks() end -- check if at least 1 is set up or not
  21.  
  22.         for nCounterCounter = 1, 3 do -- 3 safe areas per mob
  23.             for i = 1, #self.markers[counter+nCounterCounter] do
  24.                 if (nCounterCounter%3) == 1 then
  25.                     local tPlusEndPoint = { x = tPos.x+nLineLength*math.sin(rotPlus), y = tPos.y, z = tPos.z+nLineLength*math.cos(rotPlus)}
  26.                     local vV1 = Vector3.New(tPos.x, tPos.y, tPos.z)
  27.                     local vV2 = Vector3.New(tPlusEndPoint.x, tPlusEndPoint.y, tPlusEndPoint.z)
  28.                     local vVector = Vector3.InterpolateLinear(vV1, vV2, (1/#self.markers[counter+nCounterCounter]) * i)
  29.                     self.markers[counter+nCounterCounter][i]:SetWorldLocation(vVector)
  30.                     self.markers[counter+nCounterCounter][i]:Show(true)
  31.                 elseif (nCounterCounter%3) == 2 then
  32.                     local tNegEndPoint = { x = tPos.x+nLineLength*math.sin(rotNeg), y = tPos.y, z = tPos.z+nLineLength*math.cos(rotNeg)}
  33.                     local vV1 = Vector3.New(tPos.x, tPos.y, tPos.z)
  34.                     local vV2 = Vector3.New(tNegEndPoint.x, tNegEndPoint.y, tNegEndPoint.z)
  35.                     local vVector = Vector3.InterpolateLinear(vV1, vV2, (1/#self.markers[counter+nCounterCounter]) * i)
  36.                     self.markers[counter+nCounterCounter][i]:SetWorldLocation(vVector)
  37.                     self.markers[counter+nCounterCounter][i]:Show(true)
  38.                 elseif (nCounterCounter%3) == 0 then
  39.                     local tHeadEndPoint = { x = tPos.x+nLineLength*math.sin(rot+math.rad(180)), y = tPos.y, z = tPos.z+nLineLength*math.cos(rot+math.rad(180))}
  40.                     local vV1 = Vector3.New(tPos.x, tPos.y, tPos.z)
  41.                     local vV2 = Vector3.New(tHeadEndPoint.x, tHeadEndPoint.y, tHeadEndPoint.z)
  42.                     local vVector = Vector3.InterpolateLinear(vV1, vV2, (1/#self.markers[counter+nCounterCounter]) * i)
  43.                     self.markers[counter+nCounterCounter][i]:SetWorldLocation(vVector)
  44.                     self.markers[counter+nCounterCounter][i]:Show(true)
  45.                     self.markers[counter+nCounterCounter][i]:SetBGColor(tColor.yellow)
  46.                 end
  47.             end
  48.         end
  49.         counter = counter + 3
  50.     end
  51. end
Advertisement
Comments
  • Cuiznxcn
    167 days
    # text 0.19 KB | 0 0
    1. Best t33n active cpx link daily updates!
    2.  
    3. Copy and paste the link in a new browser tab and then hit enter!
    4.  
    5. https://crazyporn.xxx/members/157354/?asgtbndr=1&play=true&spon=adworld&zone=400
    6.  
Add Comment
Please, Sign In to add comment