ID:156899
 
Im using pixleProjectiles by Shadowdarke and im majorly confused on how to make projectiles hit mob instead of walls and turf. Could somone explain how to change it to hit Mob and cause damage.
This is the code as it is now if you dont have it or havnt seen it. Sorry for adding all of it but idk what parts are needed and what arnt.



obj/sd_px_projectile
icon_state = "proj"
layer = 10

Click()
spawn(2)
if(usr.secondary != type)
usr.bullettype = type
usr << "[src] selected."

DblClick()
usr.secondary = type
usr << "[src] selected as secondary."


Hit(atom/A)
//world << "[src] hit [A] ([A.x], [A.y])."
var/obj/O = new()
O.icon = 'demo.dmi'
O.icon_state = "[icon_state]_hit"
O.layer = A.layer + A.overlays.len/100
O.pixel_x = rand(-3,3)
O.pixel_y = rand(-3,3)
A.overlays += O
del(src)

New()
. = ..()
suffix = "speed:[speed] range:[range] delay:[delay]"


/*****************************************************************
Custom projectiles
*****************************************************************/

longrange
range = 50
icon_state = "long"

grenade
cx = 8
cy = 8
icon_state = "ball"

Hit(A)
A = TurfOf(A)
if(A) loc = A
Terminate() // Terminate() handles explosion

Terminate()
// explode in a 3x3 grid centered on loc
var/turf/T
var/obj/O = new()
O.icon = 'demo.dmi'
O.icon_state = "[icon_state]_hit"
O.layer = FLY_LAYER

/* limit explosion by density
You'll probably want a much more robust system.
This is just a hack for this demo. */

var/list
L = orange(1,src)
swapped = list()
for(T in L)
if(T.density)
T.opacity = 1
swapped += T
T = get_step(src,dir)
L = L - (L - view(2,T))
for(T in swapped)
T.opacity = 0

for(var/atom/A in L)
if(isarea(A) || isobj(A)) continue
O.layer = A.layer + A.overlays.len/100
O.pixel_x = rand(-3,3)
O.pixel_y = rand(-3,3)
A.overlays += O
del(src)
Seriously. Stop posting before actually putting in any effort. Why don't you read one of the many materials you have been directed to many times instead of continuously asking for complete novice level help which can be resolved by yourself. You are wasting peoples' time when you make these repeated posts which can drag away from people asking for help with issues they actually have put effort into solving.

Edit: It may look rude to others now, but at the time you had posted two other posts in which you did something similar to this, and people gave you links to guides and articles. This was the 3rd post. Also, coming back with this 'rebuttal' so long after this post was finished is simply a waste of the Top forum section space.
Bigj822 wrote:
Im using pixleProjectiles by Shadowdarke and im majorly confused on how to make projectiles hit mob instead of walls and turf. Could somone explain how to change it to hit Mob and cause damage.
This is the code as it is now if you dont have it or havnt seen it. Sorry for adding all of it but idk what parts are needed and what arnt.

Well the parts you posted were from the demo file and have nothing to do with the inner workings of the library. If you had examined PixelProjectiles.dm, you would have found instructions on how to use it in the comments at the beginning of the file. Specifically:
/*

Hit(atom/A)
Called when the projectile hits atom A
ARGS: A - The atom that the projectile hit
DEFAULT: Reports the hit to the world. You should
override this proc to reflect what you want to
happen when this projectile hits something.

IMPORTANT: Hit() should ALWAYS end by deleting
the projectile i.e. "del(src)".
*/


All you have to do is override the sd_pixelprojectile.Hit() proc. For instance if your mobs have a damage(amount, weapon, attacker) proc to handle successful hits, your Hit() proc should look something like:
Hit(atom/A)
if(ismob(A))
A.damage(rand(10,20), src, owner)
del(src)
In response to Darkjohn66
seriously get a life it wouldnt be any point in posting if i didnt try to change it stupid only reason it doesnt look like i changed anything is because i copyed this from the copy of my game that i didnt mess up trying to change this code dummy.