Data Realms Fan Forums
http://45.55.195.193/

Reflecting bullets
http://45.55.195.193/viewtopic.php?f=75&t=18761
Page 1 of 1

Author:  Potatamoto [ Sun May 16, 2010 5:56 am ]
Post subject:  Reflecting bullets

Hey. I was wondering if it was possible to make a type of substance in cc that reflects bullets. If so, could someone teach me please? Or how to apply a certain script to an actor to do this?

Author:  411570N3 [ Sun May 16, 2010 6:01 am ]
Post subject:  Re: Reflecting bullets

Shook's Hueg Pack'o'Mods. Reflective robot.

Author:  Potatamoto [ Sun May 16, 2010 6:44 pm ]
Post subject:  Re: Reflecting bullets

I've tried downloading the huge pack o mods but it just crashes. I'd also rather just have the script.

Author:  CrazyMLC [ Sun May 16, 2010 6:57 pm ]
Post subject:  Re: Reflecting bullets

High Structural Integrity values on materials cause bullets to reflect off of them... this is the easiest, simplest, and overall best way to do it. This is also the way that the Reflective Bot works, at least in my version of the download.


But if you really wanted code to do it, it might look like this:
Code:
function Create(self)
  self.mapwrapx = SceneMan.SceneWrapsX
end

function Update(self)
  for bullet in MovableMan.MOPixels do
   if bullet.Vel.Magnitude > 30 and SceneMan:ShortestDistance(self.Pos,bullet.Pos,self.mapwrapx).Magnitude < 30 then
    if bullet.LastDist == nil then
     bullet.LastDist = SceneMan:ShortestDistance(self.Pos,bullet.Pos,self.mapwrapx).Magnitude
    end
    if bullet.LastDist > SceneMan:ShortestDistance(self.Pos,bullet.Pos,self.mapwrapx).Magnitude then
     bullet.Vel = bellet.Vel * -1
    end
    bullet.LastDist = SceneMan:ShortestDistance(self.Pos,bullet.Pos,self.mapwrapx).Magnitude
   end
  end
end

Though I doubt it's working code, hopefully you find it useful.


Just remember though, you don't need to use Lua for everything.

Author:  411570N3 [ Mon May 17, 2010 6:53 am ]
Post subject:  Re: Reflecting bullets

Just changing material to test or setting EntryWound and ExitWound to Null or Nothing or anything that's not an object type with a definition beneath it will cause bullets to bounce of units as well. But the reflective robot bounces it back into the firer's face, but it's your choice.

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