Ok, firstly, HAPPY EASTER, or at the least, SPRING!!! SO, i am totally a noob here. I'm not formally educated in this industry and i sincerely apologize for my lack of understanding. I have searched and read as much documentation as i can, but the answer seems to allude me still. I have been an active member of several forums (automotive, architectural, the "trades".... nothing software related) before and i do understand the search function, and the need to use it, however my issues skew all available documentation I've encountered (or potentially my ability to understand it). I am learning coding/game logic simultaneously, so any good pointers... besides "don't suck" or "get better"... ill gladly embrace.
My issue is creating a custom signal and passing the argument to another script. It all works the way i want it however when the object is instantiated it is going to the location in the file and not the updated/current location attached to my character2D node. when i print the name of the selected Marker2D it works identifying if i have one or the other selected, so i assume im accessing the correct information. I update the variable defined in the signal func to be the .position of my current marker and emit the signal with the position as the argument. In the 'main' script when the func runs i try to update the location of the node with the argument (id of Marker2D) however the image will load at the same location.
The markers are children of POINTS which is a child of player
PLAYER SCRIPT:
7) signal action1(location) #signal with added argument to broadcast/location not updating

17) if Input.is_action_just_pressed("action1") and ballone: #working running in physics process
var allmarks = $POINTS.get_children() #working
print(allmarks) #access node and get children points/ working
var marked = allmarks.pick_random() #random child picked/ working
action1.emit(marked.position) #emit signal with argument
ballone = false #reset bool
$action1.start() #timer

MAIN SCRIPT:
3) var ball = preload("res://scenes/ball.tscn") #working

19) func _on_player_action_1(location): #signal works, argument incorrect
var dropped = ball.instantiate() #working
add_child(dropped) #working
location = dropped.position #object spawned at scene location and not updated player position

I have done everything i can and looked up everything i could find. I changed location before adding child and that had no effect. If i update the dropped.position = $player.position it spawns inside the character. When i print the vector2 of the instantiated object it shows it spawning where it is in the editor, at the respective different locations. I am on a roll implementing what I've been learning but not being able to do this has created a huge roadblock moving forward for me. i erased the nodes and recreated and i am having the same effect. I watched a tutorial and believe i did it step for step... but i am having the same issue. One caveat hear is that i am using a potato... if that matters... i am running godot in compatibility mode... but i don't see where either of those should effect the situation. My potato is from 2011 (about as strong as an xbox360) but have telemetry for windows 11 adjusted and am currently up to date with that... so MAYBE, that could be some issue here, but again, i don't personally seeing that issue effecting GODOT running properly.

Is this an annoying question?

Yes, go home.0%
No, it happens.100%
This poll has ended.

    REVBENT looking at it really quick, you are sending the marked position. position is local, relative to the parent node. you should instead use global_position.

    thankyou for reaching back out, especially so quickly. I do really appreciate that. I had tried using global position as well, and it instantiates in the files location. if i use the print() func it still show their positions relative to the file, so i dont believe its loading one frame and then "poofing" back into place, which i read something about somewhere. i also read that rigidbody2d cannot be updated once they are instantiated (somewhere) so i changed the order of placement to update before adding child. Unless i update the location inside the 'main' script the signal wont change where its broad casting from. I have a 'points' node with two children attached directly to my player script, i believe that is the correct method as well..... is there such a thing as a bug for something like this?

    EDIT: i remade the signals in a separate project entirely and the print() function was not showing up in the output but it was registering with the "!" symbol count, so it was "working". possibly leaning me towards a bug of sorts. i reloaded the editor and the print() func worked without changing anything. I then set my variable to position/global_position respectively and nothing seems to change. I feel like i am attaching the nodes correctly in their scenes and broadcasting my argument properly though not the information i want sent out. The fact that there was some issue with print determining the child i had picked makes me feel like this is something funky with the software or maybe my copy???, however with my level of experience.... more so the lack of experience... my most basic deductions keep pointing at ME being the problem. PLEASE.... anyone who can offer anything else to check, im starting to really see the parody of naming this engine GODOT.... in reference to the play.... though not as initially intended...

    not trying to spam.... just trying to bump?... and also update my "progress". i went over it with a friend who does networking professionally, so he's at least competent enough to help me look for simple mistakes while going thru the logic and documentation together. I downloaded godot and compiled it in his linux. Sadly it had the same effect on his machine (new/capable laptop) and positions all worked the same. That makes me suspect again that either i am attaching the marker2d incorrectly somehow, although i am pretty sure i am doing it correctly, or the vector2 ACTUALLY is not updating to the new location for what ever reason.

    I'm having difficulty understanding your problem.

    Could you upload a minimal project that illustrates the problem? Place the project folder in a .zip, but exclude the .godot subfolder.

    And concisely describe what the project is doing wrong, and state your exact Godot version (e.g. 4.2.1-stable).

    could you please, keep your posts a bit shorter? It's a tad difficult to read.
    or add some empty lines to split the text into sections.
    and use the "code" button to add highlight to code, it's the </> button.
    and you don't need to post the line number before the line. the spaces before each line however are VERY important for gdscript like they are in python.

    func _on_player_action_1(location): #signal works, argument incorrect
         var dropped = ball.instantiate() #working
         add_child(dropped) #working
         location = dropped.position #object spawned at scene location and not updated player position

    I think this is your problem
    you are passing location which is a Vector2, then you are modifying location, but the variable you are receiving is local to the function, you are receiving a VALUE, not an OBJECT.
    at the same time, the mainscript is probably outside player, which means the object is instantiated parallel to player. this means you HAVE to use global_position.

    maybe you meant to do:
    dropped.position = location

    but if you meant to modify the location you received, you should instead pass the object as an argument.

    all-but-godot.zip
    9kB
    • I'm not sure if this is the correct way to insert the zip file? I was able to drag the file on the message box and other than doing that, I'm at a loss.

    • v4.2.1.stable.official [b09f793f5] (totally see where that is super important... again... my bad)

    • I do completely believe that i am the problem here, for obvious reasons. Although i tried two examples step for step from the internet and when they run the project, the object would not appear. So adding the .global_position was the fix for them in the examples. However when i ran the same script as shown in the example... i WAS instantiating an object... just at the original position. The only reason i possibly suspect a bug of some kind (maybe my download/compatability version?) is that the print() function was showing up in the "!" count box next to the output but the actual text was not appearing. I did nothing but close the program and reload the file; running the project again showed the print function in the output box. Maybe that was coincidence.

    • PROBLEM:
      I am trying to update the location of a MARKER2D inside my "MAIN/LEVEL" script> from a "player" script> and instantiate a "ball" at the location of the MARKER2D on the players scene tree.

    • I hope that my terminology is correct with everything, as that too is a very important part of the problem solving process.

    @Jesusemora THANK YOU again... i know this noob stuff is very annoying to answer. i value the time everyone takes to build the community via forums, and i understand people aren't coming here to teach people.... so genuinely, THANKS

    @DaveTheCoder same to you for taking your time and responding to the "bump" as fast as you did. i am seemingly... absolutely stuck!

      shwew.... i uploaded the project i was in the middle of trying to move stuff around..... let me try to fix this......

      REVBENT You're sending a node reference as the signal argument while signal handler is expecting to get a position.
      Instead of:

      action1.emit(marked)

      Try:

      action1.emit(marked.position)
      newzip.zip
      9kB

      THIS SHOULD BE WORKING.... not been a good look for me. ANYWAY I was following an online tutorial (roughly)... of what i thought i knew, and have been trying to learn/apply as much as i can before moving forward. I have tried everything i could to find my error and moved a lot around, but i put it back in the order that i believe it was in. FYI i played with visual scripting far more than i should have while learning logic, so i more or less now am trying to learn what i was doing visually with code. I think i understand the concepts but for some reason this has been an embarrassment.

      @xyz thankyou, i updated that to how i should have had it.... really should have ran that file when i uploaded it.
      GLAD TO SEE THE ZIP UPLOAD WORKED LOL

      • xyz replied to this.

        REVBENT i know this noob stuff is very annoying to answer. i value the time everyone takes to build the community via forums, and i understand people aren't coming here to teach people.... so genuinely, THANKS

        No problem. We have all been noobs at one point, and I try to help people who are struggling like I was back then. It's also fun diagnosing and finding out the reason for the problems. Sometimes you think it's simple, but it's not, and sometimes you think there's a bug with the engine but it's just a typo.

        xyz Change node type of POINTS to Node2D.

        yep. I came to the same conclusion.

        See, Node doesn't have a transform, so it's children don't inherit the transform from player, so they end up at position 0 0.
        Changing Node POINTS to a Node2D solves the issue.



        @xyz YOU SIR, (perhaps presumptuous) ARE THE MAN!!!!! GENUINELY AWESOME!!!! can you help me understand why the node/node2d mattered here or more so when to use one vs the other. i will reread the documentation to understand it more thoroughly, but if there is a simple way to remember.... i'm all ears. Been having a really bad day.... so THIS was much needed.

          @Jesusemora as well... you responded while i was typing. and you answered the questions i had posted above.... with pictures... very impressive. This site has been awesome!

          REVBENT As @Jesusemora already stated, a plain Node doesn't have any transformation properties so when it's inserted into the scene tree hierarchy, it will effectively reset any cumulative positioning/rotation inherited by its ancestors, so the coordinate space for its children will "start anew" from global coordinate space. In contrast to that, a Node2D has normal transformation properties and will inherit and pass on positioning/rotation to its children.

          @xyz thankyou for your input as well. I do have a good understanding of the differences... now anyway lol. having it explained has been really helpful. I've been in a state of documentation learning, where the answers seem so convoluted without better understanding.

          REVBENT node/node2d

          You can see this clearly in the documentation:

          Node
          https://docs.godotengine.org/en/4.2/classes/class_node.html
          Inherits: Object
          Scroll down to Properties. There's no position property.

          Node2D
          https://docs.godotengine.org/en/4.2/classes/class_node2d.html
          Inherits: CanvasItem < Node < Object
          A 2D game object, inherited by all 2D-related nodes. Has a position, rotation, scale, and Z index.
          Scroll down to Properties. There is a position property.

          i do remember looking at that before and i was thinking that the node was acting simply as a place holder for the markers, so it wouldn't matter that the parent had no location. reading better may have worked, but now i see how to use the documentation and what to look for. honestly i thought "node" was more so used generally like an organizer, just to be able to collapse the children and make it look "pretty" . i see now that i was very mistaken there. i still cant really get my logic to understand why the parent needed the position, but i will go on the understanding that it just bc that is what the "inherited by" chart says, so just do that. a node would work to organize timers/etc, where as "things/canvas items" need to be represented by their respective bodies node path. you have gone above and beyond

          • xyz replied to this.

            One thing that may not be obvious. (At least it wasn't obvious to me.) If you have a chain of Node2D's (parent/child/grandchild etc.), then changing the position of one of them will also move its descendants. But if you stick a Node (not Node2D) in the middle of the chain, that will break that behavior.