View unanswered posts | View active topics It is currently Fri Dec 27, 2024 8:51 am



Reply to topic  [ 20 posts ]  Go to page Previous  1, 2
 Help with proximity check on actors 
Author Message
User avatar

Joined: Wed Feb 17, 2010 12:07 am
Posts: 1545
Location: That small peaceful place called Hell.
Reply with quote
Post Re: Help with proximity check on actors
Looks like were even in this thread now.

Also might want to tone down the Magnitude on the function, 100 pixels is quite the radius going on.


Tue Feb 08, 2011 10:19 am
Profile
User avatar

Joined: Sun Apr 25, 2010 12:04 am
Posts: 303
Location: Australia
Reply with quote
Post Re: Help with proximity check on actors
Still doesn't seem to work properly, now he just dies instantly.
Code:
function Update(self)
     for actor in MovableMan.Actors do
          if SceneMan:ShortestDistance(self.Pos, actor.Pos, false).Magnitude < 10 then
               self.Health = 0;
          end
     end
end


I think I'm going to give up soon, this just doesn't make sense, usually I'm not too bad with Lua.


Tue Feb 08, 2011 10:42 am
Profile

Joined: Fri Dec 18, 2009 11:00 pm
Posts: 167
Reply with quote
Post Re: Help with proximity check on actors
Never give up!

Code:
function Update(self)
     for actor in MovableMan.Actors do
          if actor.ID ~= self.ID then
               if SceneMan:ShortestDistance(self.Pos, actor.Pos, false).Magnitude < 10 then
                    self.Health = 0;
               end
          end
     end
end


Tue Feb 08, 2011 10:51 am
Profile
User avatar

Joined: Wed Jan 07, 2009 10:26 am
Posts: 4074
Location: That quaint little British colony down south
Reply with quote
Post Re: Help with proximity check on actors
Dylanhutch wrote:
this just doesn't make sense
The actor itself is always checked and is always less than ten pixels away. That is the problem none's script fixes.


Tue Feb 08, 2011 11:00 am
Profile WWW
User avatar

Joined: Sun Apr 25, 2010 12:04 am
Posts: 303
Location: Australia
Reply with quote
Post Re: Help with proximity check on actors
Wow, it worked, thanks none!


Tue Feb 08, 2011 11:07 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 20 posts ]  Go to page Previous  1, 2

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.043s | 14 Queries | GZIP : Off ]