View unanswered posts | View active topics It is currently Mon Jul 01, 2024 9:03 am



Reply to topic  [ 5 posts ] 
 Reflecting bullets 
Author Message
User avatar

Joined: Fri Jan 01, 2010 4:37 am
Posts: 112
Location: Why do you wanna know? Are you a serial killer?!?
Reply with quote
Post 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?


Sun May 16, 2010 5:56 am
Profile
User avatar

Joined: Wed Jan 07, 2009 10:26 am
Posts: 4074
Location: That quaint little British colony down south
Reply with quote
Post Re: Reflecting bullets
Shook's Hueg Pack'o'Mods. Reflective robot.


Sun May 16, 2010 6:01 am
Profile WWW
User avatar

Joined: Fri Jan 01, 2010 4:37 am
Posts: 112
Location: Why do you wanna know? Are you a serial killer?!?
Reply with quote
Post Re: Reflecting bullets
I've tried downloading the huge pack o mods but it just crashes. I'd also rather just have the script.


Sun May 16, 2010 6:44 pm
Profile
User avatar

Joined: Fri Dec 22, 2006 4:20 am
Posts: 4772
Location: Good news everyone!
Reply with quote
Post 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.


Sun May 16, 2010 6:57 pm
Profile WWW
User avatar

Joined: Wed Jan 07, 2009 10:26 am
Posts: 4074
Location: That quaint little British colony down south
Reply with quote
Post 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.


Mon May 17, 2010 6:53 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 5 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:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.029s | 13 Queries | GZIP : Off ]