Data Realms Fan Forums http://45.55.195.193/ |
|
Number of actors in a radius http://45.55.195.193/viewtopic.php?f=73&t=46109 |
Page 1 of 1 |
Author: | omegadrace [ Thu Dec 08, 2016 7:19 am ] |
Post subject: | Number of actors in a radius |
How would I go about detecting the number of specific actors in a certain distance from the actor calling the script, then write it to a variable? For example; Check for the amount of coalition light's that are within a radius of 100 pixels, if they're on my team then set the variable self.Noomboomba to that amount. |
Author: | CaveCricket48 [ Thu Dec 08, 2016 2:40 pm ] |
Post subject: | Re: Number of actors in a radius |
Something like Code: function Update(self) self.Noomboomba = 0; for actor in MovableMan.Actors do if actor.PresetName == "Coalition Light" and SceneMan:ShortestDistance(self.Pos, actor.Pos, SceneMan.SceneWrapsX).Magnitude < 100 then self.Noomboomba = self.Noomboomba + 1; end end end After the 'for actor' block, self.Noomboomba will have the number of Coalition Light units in range, or whatever they're named. |
Author: | omegadrace [ Thu Dec 08, 2016 4:38 pm ] |
Post subject: | Re: Number of actors in a radius |
That was exactly what I was looking for. Many thanks. |
Page 1 of 1 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |