0 votes

im trying to make a first person shooter but im trying to get my ammo to show up with this

weaponui.text = weapondata["Name"] + ": " + weapon_data["Ammo"] + "/" + "ExtraAmmo"

but apparently it wont work here is the rest of the code btw this is from another script

var weapondata = {
"Name" : weapon
"Image" : weaponimage,
"ExtraAmmo" : str(extra
"Ammo" : str(ammoinmag)

Godot version 3.3.2
in Engine by (12 points)

When you are typing in keywords/variables with underscores, surround it with the backwards apostrophe character. For example: weapon_ui.text = weapon_data["Name"] + ": " + weapon_data["Ammo"] + "/" + "ExtraAmmo"

1 Answer

0 votes

This weapon_data["Ammo"] (extra underscore) conflicts with var weapondata.

by (1,646 points)

thanks friend

no wait the underscore isnt showing

im following a tutorial by skyvastern its called Godot FPS Tutorial - Part 3 - Firing, Reloading and Ammo Management and on 21:44 is what im stuck on

Maybe try downloading his project files here:

Open up his part 3 project and then scroll down the script side-by-side with your project to see what differences there are. If you can't find anything, try pasting his entire code into yours and see if it actually works with your version.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.