blackyesp 7 Posted August 2, 2017 Hello! I'm trying to do the following on my mission but can't find the way to do it: I made a Marker (Ellipse) to be randomly set on a position that is relative to an Object, so that the Object isn't located in the center of the Marker. I used the following Script: _Pos = [getPos Object1, random 150, random 360] call BIS_fnc_relPos; "Circle1" setMarkerPos _Pos; ELI5 version: Circle1 is set on a random position around 150 units from Object1. Circle1 has a 150 radius, too. Object1 has to be found and Circle1 shows its position on the map, so that Object1 is located randomly inside Circle1. So this seems to be working fine and I know some of you will wonder why I didn't spawn the Object randomly inside the Marker instead. Well the answer is because I would like the Object to be something that moves. So that Circle1 has to be following Object1 when it moves. I don't mind if it still keeps the same relative position inside the circle while moving or if it refreshes into a new random position relative to the object. I tried doing Loops and While statements, but didn't get lucky. while {not isnull Object1} do {"Circle1" setMarkerPos _Pos; sleep 0.5; }; //Not Working :( This is where my scripting knowledge and research skills couldn't get any further. I would be grateful if someone can help me with the script, please! :) Thanks in advance! Share this post Link to post Share on other sites
atmo 29 Posted August 2, 2017 You can put this in your init.sqf for the mission (I presume this is single player as this won't work on a dedicated server (setMarkerPos won't be broadcasted in MP)). It is a starter to get going with. This is on a player who moves. [] spawn { scriptName "TrackerMarker"; sleep 1; systemChat "Running Tracker Marker"; _distance = random 150; _heading = random 360; while {Object1 IsEqualType ObjNull} do { "Circle1" setMarkerPos (Object1 getpos [_distance, _heading]); sleep 0.1; }; }; but should work for any Object. You could snazz it up a bit by changing the relative positions of marker and object over a time period etc.. Share this post Link to post Share on other sites
blackyesp 7 Posted August 10, 2017 Hey! Thank you for the reply, I couldn't get to write back sooner sorry haha. I tried your code on initServer.sqf and works fine on my dedicated server :) thank you again Share this post Link to post Share on other sites