Pufferfish's Skills [Fabric & Forge & NeoForge]

Pufferfish's Skills [Fabric & Forge & NeoForge]

12M Downloads

get_damage_source is not a valid operation?

Closed this issue ยท 2 comments

commented

Using Puffish skills 0.15.4-1.21.1-fabric

I'm trying to create a new tree which gets exp from dealing damage of certain types. I started from the examples in the default-skill-trees mod and tried to adapt it using the documentation here: https://puffish.net/skillsmod/docs/creators/configuration/experience-sources/built-in/deal-damage

When I try to load the skill tree, it tells me the configuration is invalid, and prints the following to the log:

[Server thread/ERROR]: [puffish_skills] Data pack `pi` could not be loaded:
Expected a valid operation type at `type` at index 1 at `operations` at `is_fall` at `variables` at `data` at index 0 at `sources` at `pi:puffish_skills/categories/spells/experience.json`
Unknown variable `is_fall` at `condition` at index 0 at `experience` at `data` at index 0 at `sources` at `pi:puffish_skills/categories/spells/experience.json`
Unknown variable `amount` at `expression` at index 0 at `experience` at `data` at index 0 at `sources` at `pi:puffish_skills/categories/spells/experience.json`

Here is the experience.json that exhibits this behavior. (The actual pack is intended to use the spell_power damage types)

{
	"experience_per_level": {
		"type": "values",
		"data": {
			"values": [
				20
			]
		}
	},
	"sources": [
		{
			"type": "puffish_skills:deal_damage",
			"data": {
				"variables": {
					"amount": {
						"operations": [{
							"type": "get_dealt_damage"
						}]
					},
					"is_fall": {
						"operations": [
							{
								"type": "get_damage_source"
							},
							{
								"type": "puffish_skills:test",
								"data": {
									"damage_source": "minecraft:fall"
								}
							}
						]
					}
				},
				"experience": [
					{
						"condition": "is_fall",
						"expression": "amount"
					}
				]
			}
		}
	]
}
commented

It should be done a little differently. Please take a look at the examples in Test Damage Type Operation documentation.

Here is a fixed configuration. Keep in mind that in vanilla players never deal minecraft:fall damage, so it won't give any experience.

{
	"experience_per_level": {
		"type": "values",
		"data": {
			"values": [
				20
			]
		}
	},
	"sources": [
		{
			"type": "puffish_skills:deal_damage",
			"data": {
				"variables": {
					"amount": {
						"operations": [
							{
								"type": "get_dealt_damage"
							}
						]
					},
					"is_fall": {
						"operations": [
							{
								"type": "get_damage_source"
							},
							{
								"type": "get_type"
							},
							{
								"type": "puffish_skills:test",
								"data": {
									"damage_type": "minecraft:fall"
								}
							}
						]
					}
				},
				"experience": [
					{
						"condition": "is_fall",
						"expression": "amount"
					}
				]
			}
		}
	]
}
commented

Thanks! I knew I was just missing something simple; I didn't see that other documentation page.

As I said, the actual file is using damage types from spell_power. It's working now.