Page 399 of 399

Re: Ask a simple question, get a simple answer

Posted: Thu Dec 26, 2024 9:38 am
by Slava
Can you please tell me why it's not working
GameMode.setMaxStatistic(“secrets_found”, 100)
GameMode.setMaxStatistic(“treasures_found”, 0)
are they hardcoded?

Re: Ask a simple question, get a simple answer

Posted: Thu Dec 26, 2024 2:19 pm
by Zo Kath Ra
Slava wrote: Thu Dec 26, 2024 9:38 am Can you please tell me why it's not working
GameMode.setMaxStatistic(“secrets_found”, 100)
GameMode.setMaxStatistic(“treasures_found”, 0)
are they hardcoded?
Works for me.
If you upload a test dungeon to Nexusmods, we can try to reproduce the error.

Merry Christmas!

Re: Ask a simple question, get a simple answer

Posted: Thu Dec 26, 2024 6:22 pm
by 7Soul
Slava wrote: Wed Dec 25, 2024 8:47 am
7Soul wrote: Tue Dec 24, 2024 7:37 pm But this causes an exception saying addItem requires an ItemComponent:
Try this

Code: Select all

local gem = "blue_gem"
for e in self.go.map:entitiesAt(self.go.x, self.go.y + dy) do
	if e and e.surface then
		local o = spawn(gem).item		
		e.go.surface:addItem(o) 
		break
	end
end
That's the same code I posted, just more verbal. As such the same error happens


This works:

Code: Select all

local altar = findEntity(altarId)
if altar then
	altar.surface:addItem(spawn("blue_gem").item) -- addItem accepts the item
end
This doesn't:

Code: Select all

for e in self.go.map:entitiesAt(self.go.x, self.go.y) do
	if e.surface then 
		e.surface:addItem(spawn("blue_gem").item) -- addItem says parameter 1 is not an item
		break
	end
end