Data Realms Fan Forums
http://45.55.195.193/

Weapon makes actor invincible to certain particles
http://45.55.195.193/viewtopic.php?f=73&t=15859
Page 1 of 1

Author:  CaveCricket48 [ Tue Jul 14, 2009 8:38 pm ]
Post subject:  Weapon makes actor invincible to certain particles

I need a script that can be attached to a weapon which makes the actor and weapon invincible to "Particle Heavy Digger". Thanks.

EDIT: Also, I would like something like the homing missile script accept it targets the firer after 500 ms.

EDIT2: Also the homing missile script make the missile gib when it gets within X range of it's target.

Author:  Mind [ Tue Jul 14, 2009 9:34 pm ]
Post subject:  Re: Weapon makes actor invincible to certain particles

Try something like:

Code:
function Update(self)   
   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 < [insert distance here to simulate it hitting the guy] then
          car = CreateMOSRotating("Actor Position"); <------this could simulate the position of the actor.  make it pinned obviously
          car.Pos = actor.Pos
          car.Vel = 0
          MovableMan:AddParticle(car);                                 
          self.ToDelete = true
       end
   end
end


Then attach a script to that MOSR or whatever you want to make it and make it something like this:

Code:
   function Update(self)
       for particle in MovableMan.Particles 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 < [insert distance here] and (particle.PresetName ==  "Round Heavy Blast" or particle.PresetMan == "Round Very Heavy Blast") then
         particle.ToDelete = true   
     end
   end
end




Tell me if this works. What it does is creates a particle when the bullet gets a certain distance from an actor. Then, the attached particle has a script that deletes any heavy digger rounds when they get a certain distance away. Tell me if you get any errors or itt doesn't work.

Author:  mail2345 [ Tue Jul 14, 2009 9:50 pm ]
Post subject:  Re: Weapon makes actor invincible to certain particles

Diggers live to short to be captued by lua, btw. Impossible, unless you did create intercept and added lua to the diggers.

Author:  Mind [ Tue Jul 14, 2009 9:53 pm ]
Post subject:  Re: Weapon makes actor invincible to certain particles

Code:
   

function Create(self)
   local curdist = 30;
    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 then
       curdist = dist;
       self.parent = actor
   self.Team = self.parent.Team   
   end
    end
end


function Update(self)
       for particle in MovableMan.Particles 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 < [insert distance here] and (particle.PresetName ==  "Round Heavy Blast" or particle.PresetMan == "Round Very Heavy Blast") then
         self.parent.GetsHitByMOs = false   
     end
   end
end


Maybe this will work to simulate him not getting hit...idk

Author:  CaveCricket48 [ Tue Jul 14, 2009 10:02 pm ]
Post subject:  Re: Weapon makes actor invincible to certain particles

The particle invincibility script isn't working and I'm not quite sure how to use the first script you posted.

Author:  Mind [ Tue Jul 14, 2009 10:16 pm ]
Post subject:  Re: Weapon makes actor invincible to certain particles

No... attach the first script to a bullet.

Attach the second one to the "Actor Position" particle.

Make the script of the actor position the code of my last post. May not work, but I'd try.

Author:  CaveCricket48 [ Tue Jul 14, 2009 10:36 pm ]
Post subject:  Re: Weapon makes actor invincible to certain particles

I'm confused. I'll just post the mod.

Attachments:
Electro Boomer.rte.rar [18.32 KiB]
Downloaded 175 times

Author:  Roon3 [ Wed Jul 15, 2009 7:17 am ]
Post subject:  Re: Weapon makes actor invincible to certain particles

Mind wrote:
Code:
function Update(self)
       for particle in MovableMan.Particles do
      local avgx = particle.Pos.X - self.Pos.X;  <- "Attempt to preform arithmetic on nil value."
      local avgy = particle.Pos.Y - self.Pos.Y;  Same goes for this, the var is the 'particle', not 'actor'.
      local dist = math.sqrt(avgx ^ 2 + avgy ^ 2);
      if dist < [insert distance here] and (particle.PresetName ==  "Round Heavy Blast" or particle.PresetMan == "Round Very Heavy Blast") then
         self.parent.GetsHitByMOs = false   
     end
   end
end

Oh and uh, CaveCricket, why do you need it be invincible to that particle only?

(The above might not work...)

Author:  mail2345 [ Wed Jul 15, 2009 7:20 am ]
Post subject:  Re: Weapon makes actor invincible to certain particles

Digger lazers are undetectable by lua.

Author:  piipu [ Wed Jul 15, 2009 8:10 am ]
Post subject:  Re: Weapon makes actor invincible to certain particles

Code:
function Update(self)
   for particle in MovableMan.Particles do
      if (particle.Pos - self.Pos).Magnitude < 40 and particle.PresetName == "presetnamehere" then particle.HitsMOs = false; end
   end
end
That would work best I believe. There's still the matter of them particles being too shortlived. They exist for 2 frames only, but this method causes them to be harmless on the second one.

Author:  TheLastBanana [ Wed Jul 15, 2009 7:35 pm ]
Post subject:  Re: Weapon makes actor invincible to certain particles

This isn't going to fix the problem with Lifetime, but it's best to use MovableObject:SetWhichMOToNotHit for having particles just ignore one MO.

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