disabled button issue

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By KKIILLOOUU

i have a kinematicbody wich has an instancied scene with a button ( panel’scene). This scene is a panel with points and clicking on button uses those points. The button is disabled when point = 0. It works but in the kinematic body’ scene has an other instancied scene (kinematic body with the panel scene). If i use point by clicking on button and point = 0 in one of the panel, the two panel’s scene have the button wich is disabled. I have changed the name of the panel and the name of script, but same problem.

> ->Kinematicbody1
>      ->Panel (script related to panel)
>           -  > Button
>    -  >kinematicbody2
>            - >panel2 ( script related to panel 2)
>                -   > Button


what is your button script? are buttons instanced in code or are they added to the panel node in the editor? where is your script which defines what the buttons are doing?

from your description, you’re using the same script for all instances hence id the condition in met once, it’s met for all instances.

it will be difficult to help you unless you can provide the code or sample project.

Macryc | 2020-07-06 12:23

:bust_in_silhouette: Reply From: KKIILLOOUU

a piece of script related to panel1 or panel2 (name of script : script1 for panel1 or script2 for panel2)

   func _physics_process(delta):
          if available_points == 0:
        		for button in get_tree().get_nodes_in_group("AddingButtons"):
    func _on_AddingAgi_pressed():
        	if agility < 99:	
        		agility += 1
        		available_points -= 1
        		invisible_points += 1
        		esquive += 2
        		vitesse += 2
        		timeskill += 0.5
        	if available_points == 0:
        		for button in get_tree().get_nodes_in_group("AddingButtons"):

script are attached to panel so there are one script for panel1 and one script for panel 2, even if scene and script’s names are different, the code is the same. Because i would like to copy for many scene into the roots and don’t change all button’s name for each panel instancied.

Ok i think i find answer when reading my comments. maybe is get_node_in_groupe. i didn’t understand why they where linked but now i understand.

KKIILLOOUU | 2020-07-06 20:32