ID:172243
 
ok i know how to make a projectile and how not damage someone on the same team or damage the shooter.My question is how do you make a projectile pass through someone on the same team but still damage someone on the other team if hit?

.See i really dont understand how to do this cause you have to set the projectile to density=1 because it has to be dense to bump right?Well then whenever it hits something dense its going to stop regardless so i am clueless how to do this.... please help
Make an if() check to see if on the same team, if its the same team make the projec. density = 0 and then sleep(2) or something and make its density =1...That should work
In response to N1ghtW1ng
That's got the potential to be very buggy though...
In response to Rippy
It's got the potential, but might not be =p
In response to N1ghtW1ng
Yeah, worth a try. But it depends on the code. If the projectile is supposed to explode when it runs into a dense object, it'll work fine, but sometimes it's defined as a mob rather than dense object. If it's defined as mob, then density won't change anything.
Just use this example:
obj/projectile
var/mob/G // owner of the projectile
New(loc, mob/M)
..()
src.G = M
density = 1
Bump(atom/A)
if(ismob(A))
var/mob/M = A
if(M.team==G.team) // a check
M.loc = A.loc // you don't need to toggle density
else
// damage stuff n others
del(src)
mob/verb/projectile()
var/obj/projectile/P = new (src.loc, src)
walk(P,src.dir)


~~> Dragon Lord

This isn't tested, so tell me if it doesn't work.
Well, Bump() doesn't have to be your only choice. You can manipulate the Move() proc to allow for something similar.

obj
missile
density=0
var
mob
Owner
Move(New_Loc,Dir)
var/mob/M=locate() in New_Loc
if(M)
if(!(M in src.Owner.Team))
spawn(1)
src.Hit(M)
return 0
return ..()
proc
Hit(mob/Attacked)
Attacked<<"<b>You got hit a by a, [src.name]!</b>"
src.Owner<<"<b>Your [src.name] hit [Attacked.name]!</b>"
del(src)
In response to Goku72
Thank all of you for the help.I decided to go with toggling density it works didnt get buggy even when i lined people on the same team and shot repeatedly.Unknownperson way i couldnt get to work probably my fault defined var wrong or something and goku way is good but checking move repeatly can be very laggy compared to just calling bump when it hits something.Thanks again for all the help