Data Realms Fan Forums
http://45.55.195.193/

Ignore Ground?
http://45.55.195.193/viewtopic.php?f=1&t=24370
Page 1 of 1

Author:  SilverBackWookie [ Sun Jun 26, 2011 4:12 pm ]
Post subject:  Ignore Ground?

Hi,
I've come up with a few ideas for a gun, but one of its main features is that it would ignore terrain. Is there any way of coding this without Lua? I know there are IgnoreBrain and Actor functions, but was unsure about this.

If it is only possible by Lua, would somebody be happy to write me a script for it?

Thanks

Author:  Xery [ Sun Jun 26, 2011 5:23 pm ]
Post subject:  Re: Ignore Ground?

Do you need it ignore actors?
If so, set DeepCheck = 0, then set Depth of AtomGroup a high value.
If not, set DeepCheck = 1, then set Depth of DeepGroup a high value.

Author:  none [ Mon Jun 27, 2011 3:15 pm ]
Post subject:  Re: Ignore Ground?

Pixels don't have deep check.

Code:
function Create(self)
      -- Find Actor
   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 < 50 then
         self.user = actor
      end
   end
   self.aim = ToActor(self.user):GetAimAngle(true);
end

function Update(self)
   local hit = Vector(0,0);
   local miss = Vector(0,0);
   local terra = SceneMan:CastObstacleRay(self.Pos, (Vector(1,0):SetMagnitude(50)):RadRotate(self.aim), hit, miss, self.user.ID, -1, 0);
      if terra >= 0 then
      local gbx = hit.X - self.Pos.X;
      local gby = hit.Y - self.Pos.Y;
      local curdist = math.sqrt(gbx ^ 2 + gby ^ 2);
      if curdist < 25 then
         local warped = Vector(0,0);
         local warp = SceneMan:CastWeaknessRay(hit, (Vector(1,0):SetMagnitude(99999)):RadRotate(self.aim), 0, warped, 0, true);
         if warp == true then
            self.Pos = warped;
         end
      end
   end
end

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