Bullets are not linked to the weapon

hi guys since I use the sticker behavior to change the position of the weapons when the player is moving, the bullets generated when a weapon is firing are no longer linked to the weapon.
these are the firing events:

bullets are now no longer linked to the weapon.
maybe there are incompatibilities with the sticker behavior that from what I have seen uses javascript and I don’t feel very experienced to understand it

Are the second screenshots in a foreach bullets?

Try
Foreach Bullets
if bullet animation = bullet1
Take into account bullets linked to arma1
Do your stuff here…

it does not work. but i think there are problems with stickers and links between objects

I really don’t think this is relevant but when I use Link bullet to weapon I add that action just after Create bullet.
As I said I’m not sure if that is important but you can try do
Create bullet at…
Link bullet to weapon
Other actions…

I solved it by reversing this:


thanks guys always present

Why are you taking all bullets/arma1 into account? You are working with bullets that have a speed > 0 and an animation of bullet1. All the actions about the bullet. there’s no mention of arma1 in any of the actions. I think you can remove this condition, and it will work just the same.

Also, why are you linking a bullet to a weapon? Once fired, a bullet should be independent of the weapon. The bullet should have parameters to control it - force, lifetime, damage etc. You shouldn’t be linking bullets back to weapons.

I connect the bullet to the weapons because based on the weapon that is firing I can deduct more or less life

but is more practical to add a variable atk_points to the bullet then check
if bullet is in collision with player or enemy
use that variable to do damage
In my games I use arrows
I set a group of Arrows
arrow_wood.Variable(atk_points) = 1
arrow_fire.Variable(atk_points) = 2
and so on…

Bullets should be independent. What happens if you switch weapons, and delete the weapon to which the bullets are linked?

you are right mrmen if I change weapon or eliminate it before the bullet hits the enemies this does not create damage.
i think i will follow ulises’ advice to create a variable to the bullet

You’ll need more than than one variable :