OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: JasonO on 07 May 2007, 19:54:16

Title: Moving a marker around in a circle
Post by: JasonO on 07 May 2007, 19:54:16
Hey

How would I go about moving a marker around a circumfrance of a circle?

I want a dot to move around a building on a map, but I don't know how. I would assume it would need some math calculation?

Thanks for your help  :)
Title: Re: Moving a marker around in a circle
Post by: Mandoble on 07 May 2007, 20:15:03
Try this:
Code: [Select]
;dotturning.sqf
_marker = _this select 0;
_center = _this select 1;
_radius = _this select 2;

while {true} do
{
   for [{_i = 0},{_i < 360},{_i = _i + 5}] do
   {
      _marker setMarkerPos [(_center select 0)+sin(_i)*_radius,(_center select 1)+cos(_i)*_radius];
      Sleep 0.5;
   };
};

Example:
Code: [Select]
["mk_mygreendot", getPos player, 100] execVM "dotturning.sqf"
EDIT:
Forgot to say ... Advanced?????  ???
Title: Re: Moving a marker around in a circle
Post by: JasonO on 08 May 2007, 02:20:03
Thanks. I'll try it tommorow when i'm on my PC.

Well I considered it advanced. It needs a small bit of math to work, and it's not your basic scripting so..
Title: Re: Moving a marker around in a circle
Post by: h- on 08 May 2007, 14:57:14
Even though math is a complete mystery to me and thus I would consider this advanced to me, I don't think this actually fits in the advanced realm so I'm moving this here..