Skip to content

Instantly share code, notes, and snippets.

@Jeremi360
Created June 6, 2024 06:39
Show Gist options
  • Save Jeremi360/85f9bde6423b6d92e675e5978f9841b3 to your computer and use it in GitHub Desktop.
Save Jeremi360/85f9bde6423b6d92e675e5978f9841b3 to your computer and use it in GitHub Desktop.
to help some one on the intenet with InvetorySystem
# In Player script
var stats := {
healt = 0,
mana = 0,
}
var healt := 0: # change to 0.0 if you want float
set(value):
stats.healt = value
get: return stats.healt
var mana := 0: # change to 0.0 if you want float
set(value):
stats.mana = value
get: return stats.mana
# In ItemDataConsumable
var stats := {
healt = 0,
mana = 0,
}
@export
var healt := 0: # change to 0.0 if you want float
set(value):
healt = value # to make sure it's saved in Resource
stats.healt = value
get: return healt
@export
var mana := 0: # change to 0.0 if you want float
set(value):
mana = value # to make sure it's saved in Resource
stats.mana = value
get: return mana
func use(target):
target.stats += stats
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment