Shotgun Pellet Fail

This problem has been plaguing me since I started making shotguns.

Even though I have multiple bbs with their starting distance away from the target is differing slightly, they only do the damage of 1. Meaning only 1 hit registers since they all hit the target so fast. How do I make it so they all register?


On the target object you could go through the list of Collision.objects and look for the property bullet and just multiply the damage by the number of times bullet is in the list.

So maybe something like this but I’m not 100% sure:

for object in Coll.object:
      if "Bullet" in Coll.object:
            DamageMultiplier += 1

and then apply the damage to the target. :slight_smile: Hope this helps.

Didn’t work. Besides, if it only “feels” 1 bullet, how would it multiply 1 bullet damage? :\

Do you happen to have a simple blend file you could upload? it might be easier to troubleshoot your problem that way

well do you know how many bbs are shot at the pull of the trigger? that could be the multiplier. That wouldn’t be accurate though since shotgun bbs dont normally all hit the target unless you’re in point blank range. Maybe use a near sensor instead?"

I don’t need a troubleshoot, I need a way to make the BBs’ hits all count. :frowning: Just have multiple bullets hit an object, with health property, at once and there is the setup. This has happend since the beginning of blender, it just happends.

I’ve actually had a similar problem to yours. I kept getting None type errors when dealing with collisions so I used this. collision sensor on the enemy for prop ‘damage’. damage = whatever damage each bullet does.

def hit(cont):
    hit = cont.sensors['attack']
    playerattack = hit.hitObject
        attack1 = playerattack['damage']
    except: True

How do you do shotgun blasts anyways? I’m thinking about trying it on my game to see if it works.

I have ne idea how to use that script o.O

I have an empty that has a small spin(spin=random property(between your animated empty’s start and end frames) is selected everytime you shoot ) with seperate empties that shoot the pellets(each shooting empty has a more inaccurate animatioed and random fram select thingy like the parent empty).

I have a solution, and here it is in blender form:eek:

ShotGun.blend (376 KB)

Hope this helps

Oh my, thank you so much. That works b-e-a-u-tifully! :slight_smile:

No problem, I think I’m just as exited about figuring this out as you are. :slight_smile:

nice one mate!