I have a lua that spawns grenade fragments from a bullet which a gun fires, but I've had this hit the gun itself and members of my own team. Is there any way to avoid this?
Code:
for i = 1, 3 do Effect = CreateMOPixel("Grenade Fragment Gray", "Base.rte") if Effect then Effect.Pos = self.Pos - Offset Effect.Vel = (self.Vel + Vector(RangeRand(-30,30), RangeRand(-30,30))) / 3.5 Effect.IgnoresTeamHits = true MovableMan:AddParticle(Effect) end end
for i = 1, 3 do Effect = CreateMOPixel("Grenade Fragment Yellow", "Base.rte") if Effect then Effect.Pos = self.Pos - Offset Effect.Vel = (self.Vel + Vector(RangeRand(-30,30), RangeRand(-30,30))) / 3.5 Effect.IgnoresTeamHits = true MovableMan:AddParticle(Effect) end end
This is the code in question. As you can see, I tried to put an IgnoresTeamHits on there, but it has no effect.
Tue Dec 06, 2016 6:21 am
4zK
Joined: Mon Oct 11, 2010 1:15 pm Posts: 594 Location: Finlandia
Re: Don't hit own team
You forgot to assign the team of the spawned particle.
Tue Dec 06, 2016 12:33 pm
Hoovytaurus
Joined: Mon Dec 21, 2015 9:30 am Posts: 89
Re: Don't hit own team
4zK wrote:
You forgot to assign the team of the spawned particle.
That's true, I forgot to bring that up. My 5 minutes of intense prowling failed to find any code or function to change a thing's team. How would I go about that?
Tue Dec 06, 2016 3:48 pm
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
Re: Don't hit own team
Effect.Team = self.Team
Tue Dec 06, 2016 5:38 pm
Hoovytaurus
Joined: Mon Dec 21, 2015 9:30 am Posts: 89
Re: Don't hit own team
CaveCricket48 wrote:
Effect.Team = self.Team
Thanks a lot, dude! I kinda forgot self still had a team, so I could just copy it over to Effect. I'll go try this right now!
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