JetteBoyTV Remove three 2d nodes and replace one animationsprite3d node
Issues with hiding weapons in fps weapon swapping code
Ask ChatGPT.
xyz the solution chatgpt gave me didnt work
JetteBoyTV the solution chatgpt gave me didnt work
Ask it again. Sometimes it gives wrong answers and sometimes it gives right answers. A very knowledgeable chatgpt expert told me that.
JetteBoyTV that stuff didnt work, im basically just trying to hide the weapon scenes canvas layer when that weapon isnt the active weapon
what exactly is the problem?
xyz Ask ChatGPT.
you keep saying that, but it's not good advice. it almost sounds like you are trying to start a meme.
JetteBoyTV xyz the solution chatgpt gave me didnt work
don't use chatGPT.
xyz Ask it again. Sometimes it gives wrong answers and sometimes it gives right answers. A very knowledgeable chatgpt expert told me that.
it always, consistently, gives bad answers.
the problem with stupidGTP is it doesn't have context of your project and it only gives you code, but making a game also requires you to click on shit in the tree, the inspector and the tools, and to use the animationplayer, etc.
it also can't tell the difference between godot 3 and 4 code, because it's a stupid chatbot. and it will only get worse as it continues to mix old code, new code, and code from other engines, and made up shit.
just look at it playing chess: king takes its own pawn and generates a bishop outside the board.
Jesusemora it always, consistently, gives bad answers.
Not according to DaveThePrompter.
- Edited
xyz chatgpt didnt work, asking it again wont work, every time i have asked it to help solve other problems in the past it hasnt worked, just dont say anything or actually try to help me instead of telling me to ask a ai that never gives working solutions to problems in godot, chatgpt is good at a lot of things, but solving problems in godot is not one of them
Jesusemora my problem is that the weapon swapping code wont hide the currently unused weapons
ok let's look at your code again:
is this working? are the weapons hidden when the game starts?
func _ready():
for child in get_child_count():
get_child(child).hide()
get_child(child).set_process(false)
get_child(Current_Weapon).show()
get_child(Current_Weapon).set_process(true)
instead of using for child in get_child_count()
I would use:
for i in get_children():
i.hide()
this could be causing problems:
get_child(Current_Weapon).set_process(true)
use a variable to tell the weapon if it should be active or not, setting this to true or false could be causing show()
and hide()
to not work.
var is_active : bool = true
func _process(delta):
if is_active:
if Input.is_action_just_pressed... etc
for i in get_children():
i.hide()
i.is_active = false
get_child(Current_Weapon).show()
get_child(Current_Weapon).is_active = true
Current_weapon
is an int? so you are using the index for get_child.
you should make sure the variable is restored to 0 if it overflows, otherwise it will return null
https://docs.godotengine.org/en/stable/classes/class_node.html#class-node-method-get-child
if Input.is_action_just_released("Next_Weapon"):
Current_Weapon = Current_Weapon+1
if Current_Weapon > 3:#max number weapons
Current_Weapon = 0
switch_weapon()
here is the same thing, the problem is probably because you are setting process to false, which disables logic on the node and prevents the show()
and hide()
functions from working?
func switch_weapon():
for child in get_child_count():
get_child(child).hide()
get_child(child).set_process(false)
get_child(Current_Weapon-1).show()
get_child(Current_Weapon-1).set_process(true)
you are also using Current_Weapon-1
for some reason.
also this code is problematic, I would just remove it:
if Current_Weapon == get_child_count():
Current_Weapon = 0
also try adding a print to
if Input.is_action_just_released("Next_Weapon"):
Current_Weapon = Current_Weapon+1
switch_weapon()
print("next weapon")
if you are using the scroll wheel it could be causing problems, the scroll wheel is weird. try using a button like q
and see if it works.
- Edited
JetteBoyTV xyz chatgpt didnt work, asking it again wont work, every time i have asked it to help solve other problems in the past it hasnt worked, just dont say anything or actually try to help me instead of telling me to ask a ai that never gives working solutions to problems in godot, chatgpt is good at a lot of things, but solving problems in godot is not one of them
Maybe you're just ignorant about ai. You need to treat chatgpt like a very knowledgeable person who sometimes gives right and sometimes wrong answers. Just make sure that the answer is right before using it.
xyz dude, chatgpt isnt designed to fix problems in a video game engine, its designed to do writing, asking chatgpt to help problems in godot will damn near never be correct because asking it about something like that is simply misusing the ai because its not designed to do that. chatgpt cant even tell the difference between godot 3 and 4 code, and any code solution it gives you could be completely made up, this happens because, CHATGPT IS NOT DESIGNED TO FIX GAME ENGINE CODE
Jesusemora turns out the solution to my problem was just to add get_node("CanvasLayer").hide() https://forum.godotengine.org/t/issues-with-hiding-unselected-weapons-in-fps-weapon-swapping-code/75400/7
JetteBoyTV As I replied 5 days ago, animationsprite3d node doesn't need canvaslayer node,so there will be no such problem.
JetteBoyTV dude, chatgpt isnt designed to fix problems in a video game engine, its designed to do writing, asking chatgpt to help problems in godot will damn near never be correct because asking it about something like that is simply misusing the ai because its not designed to do that. chatgpt cant even tell the difference between godot 3 and 4 code, and any code solution it gives you could be completely made up, this happens because, CHATGPT IS NOT DESIGNED TO FIX GAME ENGINE CODE
Would you mind explaining that to Dave"TheCoder"?
xyz Ai is foolish. You have to train it. One's manifestation pattern determines whether or not you get the wrong answer, a half right answer, or a copy and paste nugget. It takes practice. I use GPT 4. If you are not careful, Ai will take you down a rabbit hole, and you could easily scrap 200 lines and have to reset. You have to be witty, the hallucinations are real. If you play "the game" with Ai, and fight through the 3 and 4 code mixup, you will get through it. Ai is a learning bot. Think classical music. You are the conductor, Ai is just a player. It will go where you lead it.
ZV9GAMES Ai is foolish. You have to train it. One's manifestation pattern determines whether or not you get the wrong answer, a half right answer, or a copy and paste nugget. It takes practice. I use GPT 4. If you are not careful, Ai will take you down a rabbit hole, and you could easily scrap 200 lines and have to reset. You have to be witty, the hallucinations are real. If you play "the game" with Ai, and fight through the 3 and 4 code mixup, you will get through it. Ai is a learning bot. Think classical music. You are the conductor, Ai is just a player. It will go where you lead it.
Would you mind explaining that to Dave"TheCoder"?
xyz how about instead of just saying "wOuLD yOU mInD exPLAinInG tHaT tO dAVe tHE cODer" try to give a actual counter argument, because saying "wOuLD yOU mInD exPLAinInG tHaT tO dAVe tHE cODer" doesn't mean shit, why should i take his opinion about chatgpt over my (and many others) experience of chatgpt being horrible at helping godot problems no matter how much i (and many others) try
- Edited
JetteBoyTV try to give a actual counter argument
Don't shoot me, I'm just a messenger bringing you Dave's infinite wisdom. I don't have any arguments nor counter arguments. If you want any of those - you'll have ask Dave. I'm merely parroting what he said, sorta like how chatgpt does things.