Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple instances of the same Node share tags during activation [bug] #34

Closed
Hairic95 opened this issue Jun 28, 2023 · 5 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@Hairic95
Copy link

Describe the bug
While using GGS, I created a Scene for a enemy entity with a ShootBullet Ability. This requires two tags to start ('alive' and 'triple_shoot') and is blocked if the tag 'triple_shooting' is present, which is given on activation. This works fine when there's only 1 of these enemies, however when multiple are added to the scene, only one of them seems to performing the ability.
I noticed that the tag 'triple_shooting' is added to all entities of the same type when the Ability, instead of that specific entity. This happens within the AbilityContainer function "_handle_ability_activated".

Currently I wrote the following quick fix to avoid to add the tag to all instances by confronting who that tag is for. Probably it would be cool if the function gets called only on the target object.

immagine

Here's the ability configuration, for reference (in the chance I set something wrong):

immagine

Desktop:

  • OS: Windows 10
  • Godot version [e.g. 4.0.3]
@Hairic95 Hairic95 added the bug Something isn't working label Jun 28, 2023
@OctoD
Copy link
Owner

OctoD commented Jun 28, 2023

Hi, thank you for reporting this!

May I ask you how are you activating the ability?

If possible, may I also ask you for a minimum repr project? Thank you!

@Hairic95
Copy link
Author

Sure thing, I set the ability like this in the _process() function
immagine

I set momentarly the repo public, to give you access to the project I'm currently working on
https://github.com/Hairic95/Grelz

Thank you in advance for the help.

@OctoD
Copy link
Owner

OctoD commented Jun 28, 2023

I am debugging it (you should close your source asap). Btw, you can simplify that check to

          if activation_event.ability_container != self:
		return

@OctoD
Copy link
Owner

OctoD commented Jun 28, 2023

Ok, it's my fault (guess what? Ahaha). I have to add checks, because by design abilities are reference counted, and if you instance one ability by the editor only one instance will exist, leading to one ability connected to multiple ability containers.

Fixing right now, close your source and thank you!

@Hairic95
Copy link
Author

Glad I could have pointed to this problem, thank you for your help! I guess these checks should be made in any of the "handle_ability*".
I take the chance to say that I'm really liking this system so far. It avoids me to do silly manual timeouts around the code and seems really solid. I hope my project can help iron out this tool!

My repo is closed and secured (it's a personal project so it's not too much of a problem opening or closing it out eheh, I kinda want to release the code if the final result is any successfull).

@OctoD OctoD closed this as completed in 250e24b Jun 28, 2023
migalvalm added a commit to migalvalm/godot-gameplay-systems that referenced this issue Oct 17, 2023
* fix inventory in diablo_like example (OctoD#21)

Co-authored-by: sergwest <ksendzov.sd@gmail.com>

* chore: updates gitattributes

* chore: adds import file

* feat: adds hooks methods in Interaction (OctoD#22)

feat: adds on_before_interaction_end
feat: adds on_before_interaction_start
chore: updates sot-like example with draggable object

* chore: adds a line at the end so godot stop complaining

* Fix icon paths for attribute/ability resources/nodes (OctoD#24)

* fix icon paths missing "attributes_and_abilities"
* add available icons to ability nodes/resources

* fix abilitycontainer _ready missing preloaded abilities (OctoD#25)

* fix: fixes OctoD#26

* fix: adds condition

* chore(demo): adds example on how to use tags_to_display

* fix: closes OctoD#23 (OctoD#28)

* feat: adds _on_interaction_started and _on_interaction_ended calls (OctoD#29)

this occurs when an interactable_area is interacted and if the methods are implemented

(look at sot-like example)

* Feat/2d-and-3d-point-and-click-controllers (OctoD#30)

* feat: adds point_and_click_2d

* feat: adds PointAndClick3D node

* fix: fixes typo in tags_updated signal parameter name

* chore(docs): adds docs

* feat: adds radial menu (OctoD#31)

* chore: removes commented duped line

* feat: adds RadialMenuContainer icon

* chore: updates readme

* feat: adds initial camera shake implementation (OctoD#33)

* fix: closes OctoD#34. Thank you @Hairic95

* feat: adds SlideShow node for your game intros (OctoD#35)

* chore: migrates from 4.0 to 4.1

* fix: fixes test

* fix: fixes esc menu button

* chore: updates IDEAS.md

* feat: adds get_attributes_dict method

* Feat/turn-based-nodes (OctoD#36)

* feat: adds turn based nodes

* Update README.md (OctoD#42)

* fix: closes OctoD#39 (OctoD#41)

* chore: updates docs

* chore: adds requirement for reproj

---------

Co-authored-by: Sergwest <39670193+AFK1@users.noreply.github.com>
Co-authored-by: sergwest <ksendzov.sd@gmail.com>
Co-authored-by: octod <iamoctod@gmail.com>
Co-authored-by: OctoD <OctoD@users.noreply.github.com>
Co-authored-by: Daniel Bernard <daniel.john.bernard@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants