Ask a simple question, get a simple answer

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
Slava
Posts: 41
Joined: Sun Aug 30, 2015 2:10 pm

Re: Ask a simple question, get a simple answer

Post 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?
Test version of my Generations of Kings mod
https://drive.google.com/file/d/1DOTiuP ... drive_link
User avatar
Zo Kath Ra
Posts: 940
Joined: Sat Apr 21, 2012 9:57 am
Location: Germany

Re: Ask a simple question, get a simple answer

Post 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!
User avatar
7Soul
Posts: 212
Joined: Sun Oct 19, 2014 1:56 am
Location: Brazil

Re: Ask a simple question, get a simple answer

Post 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
Join the LoG discord server: https://discord.gg/ArgAgNN :D

My Mods
Post Reply