Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

[lua] drawing circles script

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> [lua] drawing circles script Page: [1]
Login
Message << Older Topic   Newer Topic >>
[lua] drawing circles script - 9/30/2016 4:18:40 PM   
Michal Pielaszkiewicz

 

Posts: 18
Joined: 9/23/2014
Status: offline
Hi,
Recently I was frustrated witch placing SAM's and assigning for it areas, trying to make it circle...
I've found code on Baloogan forum (unfortunately now I can not enter his forum?) that creates "circles" from RP's, unfortunately that script works only on equator and with increasing deviation shape of circles is getting werid, so I've modified original code to include nav. deviation - now circles are nice at any latitude, I've also changed inputs, so now you have to provide unit which is center of area, radius in Nm and number of verticals.

How to use,

First paste this code to script console and run:

-- RP.01
-- Written by Baloogan
-- Modified draw_circle by Yautay
 
function draw_circle(a,b,t,txt)
    if txt == nil then
       txt = ""
    end
    t = t
    tg = t - 1
    lat1 = a.latitude
    lon1 = a.longitude
    r = b / 60 
 
    for i=0,tg do
        th = 2 * math.pi * i / t 
	rlat = lat1 + r * math.cos(th)
        rlon = lon1 + r * math.sin(th) / math.cos(math.rad(lat1))
        ScenEdit_AddReferencePoint({
            side='PlayerSide',
            lat=rlat,
            lon=rlon,
            name=txt,
            highlighted="yes"})
    end
 
end



Now paste this code, change red syntax for your own side/unit name (here is Red and test), change radius (350) and desired number of verticals (24). Run it...

 
local unit = ScenEdit_GetUnit({side="Red", name="test"})
draw_circle({latitude=unit.latitude, longitude=unit.longitude}, 350, 24, "RP")



< Message edited by Michal Pielaszkiewicz -- 9/30/2016 4:19:21 PM >
Post #: 1
RE: [lua] drawing circles script - 10/1/2016 12:08:39 AM   
thewood1

 

Posts: 5439
Joined: 11/27/2005
Status: online
That is a big contribution for someone with only 13 posts in two years. Well done. And you are the god of lurkers.

(in reply to Michal Pielaszkiewicz)
Post #: 2
RE: [lua] drawing circles script - 10/3/2016 3:51:18 AM   
temkc5

 

Posts: 79
Joined: 10/11/2015
Status: offline
Thank you Michal

_____________________________

Non mihi, Non tibi, Sed nobis


(in reply to thewood1)
Post #: 3
RE: [lua] drawing circles script - 10/4/2016 9:36:44 AM   
Michal Pielaszkiewicz

 

Posts: 18
Joined: 9/23/2014
Status: offline
temkc5, does it work now?
M

(in reply to temkc5)
Post #: 4
RE: [lua] drawing circles script - 10/4/2016 11:18:15 PM   
temkc5

 

Posts: 79
Joined: 10/11/2015
Status: offline
Yes it work.

Wish I could say perfectly but it seems to has you said "not like spaces in the name" ie: Osama Bin Laden Airbase

But Trump Airport should work

Overall it's like that muscle car grandad is trying to restore once you get the engine going all the blood sweat and tears feels worth it

Keep Up The Great Work CMANO Community

(I only cut and paste the script and tried to enter the side & name to how the Lua prefers)

< Message edited by temkc5 -- 10/4/2016 11:20:13 PM >


_____________________________

Non mihi, Non tibi, Sed nobis


(in reply to Michal Pielaszkiewicz)
Post #: 5
RE: [lua] drawing circles script - 10/5/2016 3:21:24 PM   
U6443

 

Posts: 30
Joined: 7/2/2004
Status: offline
Hi

Yes it works, for units...
Could somebody try to include Reference Points as source?

That would be great
Thank's
Andy

(in reply to temkc5)
Post #: 6
RE: [lua] drawing circles script - 10/5/2016 4:00:32 PM   
stilesw


Posts: 1405
Joined: 6/26/2014
From: Hansville, WA, USA
Status: offline
U6443,
I do not think you can use a reference point as the origin point. However you can create a temporary unit, say a small building on land or oil platform at sea, and use it as the center point. After the points are created just delete the building/platform and the RPs remain.

-Wayne Stiles

(in reply to U6443)
Post #: 7
RE: [lua] drawing circles script - 10/5/2016 5:38:46 PM   
U6443

 

Posts: 30
Joined: 7/2/2004
Status: offline
Thank's

I would use this script for playing, not for creating scenarios.....

I hope in future it would be possible to create circles from reference points.

(in reply to stilesw)
Post #: 8
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> [lua] drawing circles script Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

0.121