• 1 Vote(s) - 5 Average
• 1
• 2
• 3
• 4
• 5
 Chaos Flares  Member   Posts: 60 Threads: 5 Joined: Apr 2016 Reputation: 0 2017-02-16, 07:14 AM (This post was last modified: 2020-01-05, 05:16 AM by SLK18.) Here's a small countermeasure script I made for missiles to semi orbit around your craft. Note: For now you must use acbs to fire these in the same fashion as you would regular flares Code:```--Chaos Flares by SLK18 --Settings --Halo radius halor = 200 --Height of halo (Real y value) y = 90 --Radius of interception sphere IS = 70 --Raises height every time a WP is hit usetornado = true --Must be larger than y (after this is hit reset back to y) tornadocap = 170 --Default initialization --Don't touch anything beyond this point wp = {} yy = y j=1 k=2 l=3 --Distance Function function D3(x1,y1,z1,x2,y2,z2)    return math.sqrt((x1-x2)^2 + (y1-y2)^2 + (z1-z2)^2) end --4 Waypoints based on quadrant math function Update(I)   I:ClearLogs()   I:Log(y)   I:Log("Y: ")      for t=0,I:GetLuaTransceiverCount() do     for m=0,I:GetLuaControlledMissileCount(t) do       cI = I:GetConstructPosition()       --Quadrant Grid Waypoint Positions       --x=0, y=1, z=2, so forth              wp = cI.x + halor       wp = y       wp = cI.z + halor              wp = cI.x - halor       wp = y       wp = cI.z + halor              wp = cI.x - halor       wp = y       wp = cI.z - halor          wp = cI.x + halor       wp = y       wp = cI.z - halor       --Handling the offset missiles       wp = cI.x + halor       wp = y       wp = cI.z + halor              wp = cI.x - halor       wp = y       wp = cI.z + halor                     mI = I:GetLuaControlledMissileInfo(t,m)       mx = mI.Position.x       my = mI.Position.y       mz = mI.Position.z       D = D3(wp[j],wp[k],wp[l],mx,my,mz)              if D < IS then         j = j + 3         k = k + 3         l = l + 3         if usetornado then           y = y + 10           if y > tornadocap then             y = yy           end         end         if j > 10 then           j = 1           k = 2           l = 3         end       end              if math.fmod(m,2) == 0 then       I:SetLuaControlledMissileAimPoint(t,m,wp[j],wp[k],wp[l])       else       I:SetLuaControlledMissileAimPoint(t,m,wp[j+3],wp[k+3],wp[l+3])       end     end   end end```

 Messages In This Thread Chaos Flares - by SLK18 - 2017-02-16, 07:14 AM RE: Chaos Flares - by jcacoustik - 2017-02-17, 03:31 PM

Forum Jump:

 Users browsing this thread: 1 Guest(s)