Data Realms Fan Forums
http://45.55.195.193/

Actor doesn't have item
http://45.55.195.193/viewtopic.php?f=73&t=23619
Page 1 of 1

Author:  Asklar [ Sun May 08, 2011 4:03 am ]
Post subject:  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

Author:  Coops [ Sun May 08, 2011 6:31 am ]
Post subject:  Re: Actor doesn't have item

Code:
if not(actor:HasObject("Syringe")) then
    blah blah blah
end

Author:  Asklar [ Sun May 08, 2011 6:39 am ]
Post subject:  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!

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/