View unanswered posts | View active topics It is currently Thu Dec 26, 2024 5:56 pm



Reply to topic  [ 3 posts ] 
 Actor doesn't have item 
Author Message
Data Realms Elite
Data Realms Elite
User avatar

Joined: Fri Jan 07, 2011 8:01 am
Posts: 6211
Location: In your office, earning your salary.
Reply with quote
Post Actor doesn't have item
I'm making a healing syringe.

The code I'm using heals the actor in the create function, and it checks for the nearest actor. However, I want to create one to heal another guy, so I want to make the particle check if the actor has the object "syringe".

How would the code be? Something like:

Code:
   for actor in MovableMan.Actors do
      local avgx = actor.Pos.X - self.Pos.X;
      local avgy = actor.Pos.Y - self.Pos.Y;
      local dist = math.sqrt(avgx ^ 2 + avgy ^ 2);
      if dist < curdist and actor:NotHasObject("Syringe") then -- That's the part of the code I don't know
         curdist = dist;
         self.target = actor;
      end


Sun May 08, 2011 4:03 am
Profile
User avatar

Joined: Wed Feb 17, 2010 12:07 am
Posts: 1545
Location: That small peaceful place called Hell.
Reply with quote
Post Re: Actor doesn't have item
Code:
if not(actor:HasObject("Syringe")) then
    blah blah blah
end


Sun May 08, 2011 6:31 am
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Fri Jan 07, 2011 8:01 am
Posts: 6211
Location: In your office, earning your salary.
Reply with quote
Post Re: Actor doesn't have item
Coops9753 wrote:
Code:
if not(actor:HasObject("Syringe")) then
    blah blah blah
end


Aaahhhh.

I was too near yet too far.

Thanks Coops!


Sun May 08, 2011 6:39 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

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.155s | 13 Queries | GZIP : Off ]