View unanswered posts | View active topics It is currently Sun Dec 29, 2024 5:38 am



Reply to topic  [ 3 posts ] 
 Ignore Ground? 
Author Message

Joined: Fri Mar 25, 2011 5:56 pm
Posts: 6
Reply with quote
Post 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


Sun Jun 26, 2011 4:12 pm
Profile
User avatar

Joined: Sat Feb 26, 2011 10:29 am
Posts: 163
Reply with quote
Post 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.


Sun Jun 26, 2011 5:23 pm
Profile

Joined: Fri Dec 18, 2009 11:00 pm
Posts: 167
Reply with quote
Post 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


Mon Jun 27, 2011 3:15 pm
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.029s | 13 Queries | GZIP : Off ]