[Solved]Strange formula for weapons/bullets attacks

Good day peeps.
I’m trying to figure out how to add for each bullet various attributes.
I’ll try to explain as simple as possible what i want.

In my game I’ve various weapons that do different things with different patterns.

  1. For Eg a whip here

in this ss the moment the whip’s collision object (p1hit) is created i assigned a variable that i use in other events to assign various kind of attributes (DMG, elements,effects ecc…) and do enemy dmg at collisions.This works bcs at creation is picked so after the deletetion i can re-whip again with the same or different weapon to get different dmg.

2)I here i’m throwing a dagger to the enemy with the bullet extension

Here i want the same thing…but bcs i may have more than 1 bullet on the screen without cancel or deletetion i can’t figure out how to separate each bullet var while they move around… i’ve the repeat for each…and it works…
but i guess that bcs the creat object is integrated in the extension behaviour, …the bullet is not picked so the trick above (for the whip) dowesn’t work in this case.

here a vid

I wonder if i’m missing something here…probably due to overwork…

i’m thinking to edit the extension at bullet creation …or maybe… if it should be interpreted as a feature request…

Any help appreciated.

edit:here part of the hit consequences.


Edit2: i moved this on the featurer requests…

I looked at your events again. I’m not convinced this is related. Apologies.

I’m not positive that this is the issue but I’ve had it happen.

Here

It’s changing the variable for p1
In a subevent, it’s creating the same object.
I think what’s happening is that the act of changing the variable is causing the objects to be picked. So, when you change the variable again after the object is added. It’s changing the value of the object variable for the new and old objects. I don’t think it should don’t that but I was told by someone from GD that it’s how it’s supposed to be.

Try adding a subevent and moving the actions the actions that set the value of the existing objects to the subevent. That will make it so the other events aren’t a subevent of the actions.

Here’s how I tested it using an action to rotate the bullet. When the variable action is where the scribble is then all of the bullets rotate. But when the actions are moved to their own subevents that are equal to fhe other events, it works. The variable actions create their own object list but since the other events aren’t subevents, the other actions don’t use that list.

If i can find my previous post, I’ll add a link to it.

1 Like

What happen

at collision i calculate DMG on enemy.
My weapons system assign a variable at creation for each weapon to detect the equipped slot and which weapon started the attack.
While it works …let’s say for phisical weapons (sword,whip,axes,doble hands ecc…) ,i can’t calculate the dmg for bullet…cos they don’t reset at a hit. …cos i guess i can’t delete em…

Can you explain further. I’m not understanding the iasue. What is happening and what should halpen.

What happen

at collision i calculate DMG on enemy.
My weapons system assign a variable at creation for each weapon to detect the equipped slot and which weapon started the attack.
While it works …let’s say for phisical weapons (sword,whip,axes,doble hands ecc…) ,i can’t calculate the dmg for bullets…cos they don’t reset at a hit. …cos i guess i can’t delete em…

i know i can fix it by creating a dagger object and adding a force on direction of the attack…this way the dagger is picked at creation and the variable follow the bullet until it hit something…
I can’t get this result with the bullet extension…it looks like the bullet in extension is picked like a group of objects instead of a single created bullet

more in depth…

let’s say i attack with a whip , i do 50 dmg, during the same attack
i throw a dagger that do 10 dmg.
the moment i attack with the whip during the same attacki have 60 dmg.

I don’t understand. Maybe, I’m also tired.

What doesn’t reset? What can’t you delete?

Is the bullet related to p1hit? Or is that just for non-bullets. Are you detecting the collision with the bullets? Do the bullets need similar variables as the p1hit or am I way off base.

lol, wait i’m gonna explain further later…let me go to check again :).
It can be anything, hopefully one of my faults. Yoiu can have a sleep for now.

1 Like

ok i’m trying to explain again:

i have this Var DMG that change depending on equipped weapons…There are two kind of attacks depending on the button pressed.

1)let’s say i attack with a whip —50 dmg done.
2) i throw a dagger—assigning to that dagger 10 dmg.
3) i throw a second dagger–that idd do 10 dmg.
4) while the daggers are stll in air…another whip attack…with 60 dmg…(this is unwanted)
I may be wrong but when you manually create a bullet object; you can use for each object condition than assign a var to that bullet at creation cos is picked.
That bullet keep that var as long it does hit something.And you can edit that variable for the next bullet…when created

I basically want to reset the dmg value the moment the non-bullet attack is done
while bullets are still in air…and they can still hit with their DMG var…for any weapons.
I found this easier to do with non-bullet weapons cos at the end of their animations they are deleted so the next attack can start. But for bullets, since they’re still in air during attacks, i’m not able to restart the dmg value at each attacks bcs they’re still in air. …and ofc i don’t want to delete em if they don’t hit something.

I’m not able to do it with the bullet extension.

If it can help this is my damage formula…(not simplified yet…but pretty simple)…don’t mind the resistence…they’re not implemented yet

Trying to fix this problem i decided to separate my group of attacks with bullet attacks (p1blullet) and weapons white attacks (p1hit).
There is an addition between the two.

When one of the two objects is created the other part of the formula is zero and vice versa…at least it is what i would like…

…it looks like to have a var for each single bullet while they’re still in air and while the player concatenate attacks… :crazy_face:…awsome …in words
Senza titolo

thaz why i’m still not sure this is an how do i instead of a feature request…

Ok… let’s to try to simplify things a la How Do I.

How do i

assign a Variable for each bullet that is kept to that bullet until collision while other bullets are fired and other attacks are performed that change the same variable…(while the bullet is still in the air).
with the Fire Bullet extension

hopefully i’m gonna get something i can fit.

this is easily fixable with manual bullet creation, but since i may gonna need some shoot effects, angle ecc…later if possible i prefer the extension

ok more in depth what happen:

when the first attack and the second one happen (whip and bullet) the formula above is the result of the Addition of both damages.(before the collision)…something i don’t want…
i need a method that nullify the shoot after each bullets (or any other attacks) is fired…this is drivin me nuts…(but it was expected)… :call_me_hand:

I guess I’m just not getting the full picture. I modified my previous test and assigned each bullet an ID. This test is unrelated to your game.

The ID was assigned to each bullet as the fire behavior created them. When they collided with my test object, a wall, the ID of the bullet was still the same as the value it was originally given.

Objects are identical whether you create them or the behavior does. The only thing you need to make sure is there are no other bullets picked when the object is created because old objects can be set to the new value. When reading the value of a bullet, you need to make sure that only 1 bullet is picked otherwise it will use the oldest object and read its value. You also need to only take a bullet into account when it’s in collision and the delete the object.

This formula use both the hit and bullet to calculate the damage.

Maybe, the formula needs to be separated. If the bullet is in collision then only use the bullet. If it’s not a bullet then only use the hit.

1 Like

that is indeed what i need…and i can’t figure out…
you used ID , i used secondwepn variable…both do the same things. (second screenshot).

About the formula i already had in mind to split it up…i tried what i can to automate the process…bcs 2 patterns of attacks is still manageable…i wonder what will happen with 4 or 5…

edit: but wait you used the counter trick…(btw i hate it) :wink:
if u 're telling me that the extension still pick the object at creation i’m gonna try the same…cos it doesn’t looks so to me…but i may be wrong

ok…let’s try…it will needs a while…i’m gonna report here…moved to how do i.

…ok for some reasons it’s now working without the needs to use the ID counter method…fortunately…

I confirm that the object is picked even with the behaviour at creation…I apologize for thinking otherwise

the problem looks like to be in the formula…

removin the enemy resistences parts seems to fix the dmg issues i had…but everything is related…i need to spend more time on this… :timer_clock: :timer_clock: :timer_clock:

for now …solved…i guess.

thx Keith for the input as usual :+1: :handshake:

1 Like

I’m glad it’s working. Just to be clear. My ID example was just an unrelated test. Have a good one.

1 Like

it would have worked in my game too, with a bit of efforts.

but luckily I had already separated variables for each weapon type…in anticipation that it would happen…but honestly i had luck this time…

The problem is still there…but i guess it’s now a matter to how to fixx that damn formula…
that ill probably end to split

1 Like

Keith i’m gonna change everything again…
I’m gonna use IDs for each attacks , so i can merge every attack to a group and simplify the whole thing…the answer was there…but when you have so many things on the screen it’s hard to remember everything.

Thx again for your input…i totally forget about the counter trick.

SOLVED

1 Like

Keith i’ve fixed that part…now things works very well…i love it…
But now i’m more interested into this:

Probably you already know it would happen…but let’s say i want 1 player bullet and 1 enemy bullets destroy at collision…

I’m creating my bullets cleaning event …like this .

in the SS for p1 attacks:
if collision with light delete
if collision with enemy bullets delete
if collision with platforms elements delete.

for enemies attacks
thhe same…i guess.

I assigned a destroy var if a bullet can be destroyed.
If both bullets collides in air and both have DESTROY var = 1 delete…

basically this:

Thaz what i would like…Problem is sometimes it happens sometimes don’t.
I deunnpo if due to the speed of bullets (cos the collision may be skipped…)
I still dunno if i can implement this without problems…
I mean i need to be sure that it happens when it should happen.

Also some enemies bullets are 2d particles objects (mosts spherical) whit their untouched collision masks. I noticed that check collision with 2d parrticles works but it’s a bit tricky.

Edit: i want to point out that my collisions aren’t working bcs the 2D particles tiny emitter’s box…i opened a feature request for this.
Until then. i’ll use proxy for collisions.

whoever is reading this please ignore this last post