Author |
Message |
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
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.
|
Tue Jul 14, 2009 8:38 pm |
|
|
Mind
Joined: Thu Mar 06, 2008 10:54 pm Posts: 1360 Location: USA
|
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.
|
Tue Jul 14, 2009 9:34 pm |
|
|
mail2345
Joined: Tue Nov 06, 2007 6:58 am Posts: 2054
|
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.
|
Tue Jul 14, 2009 9:50 pm |
|
|
Mind
Joined: Thu Mar 06, 2008 10:54 pm Posts: 1360 Location: USA
|
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
|
Tue Jul 14, 2009 9:53 pm |
|
|
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
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.
|
Tue Jul 14, 2009 10:02 pm |
|
|
Mind
Joined: Thu Mar 06, 2008 10:54 pm Posts: 1360 Location: USA
|
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.
|
Tue Jul 14, 2009 10:16 pm |
|
|
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
Re: Weapon makes actor invincible to certain particles
I'm confused. I'll just post the mod.
|
Tue Jul 14, 2009 10:36 pm |
|
|
Roon3
Joined: Sun May 11, 2008 12:50 pm Posts: 899
|
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...)
|
Wed Jul 15, 2009 7:17 am |
|
|
mail2345
Joined: Tue Nov 06, 2007 6:58 am Posts: 2054
|
Re: Weapon makes actor invincible to certain particles
Digger lazers are undetectable by lua.
|
Wed Jul 15, 2009 7:20 am |
|
|
piipu
Joined: Mon Jun 30, 2008 9:13 pm Posts: 499 Location: Finland
|
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.
|
Wed Jul 15, 2009 8:10 am |
|
|
TheLastBanana
DRL Developer
Joined: Wed Dec 13, 2006 5:27 am Posts: 3138 Location: A little south and a lot west of Moscow
|
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.
|
Wed Jul 15, 2009 7:35 pm |
|
|
|