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!
User avatar
Isaac
Posts: 3179
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

minmay wrote:Do not use surfaces or sockets to add items to the map. Items cannot be removed from surfaces or sockets except by destroying the items or having the player click on them (destroying the surface/socket just taints the item and makes it impossible to pick up ever again without causing a crash).
When I mentioned using a surface, I mentioned using a surface that remains until the last item is picked up.

Consider a surface that refuses to accept items via the mouse, and only once it is empty of all items, does it get destroyed.

Is there a technical reason that this is lesser than the dummy monster? (I like it also because I can control where the surface exists, and can even randomize ~or customize where the items lay... including placement at angles, or even sticking out of the ground, like a sword stabbed in the earth.)
minmay
Posts: 2770
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

I am fully aware of what you suggested. It prevents the items from working like you'd expect items on the floor to work: pushing them around, being able to pick them up from the correct squares, etc. It is therefore highly unlikely that this approach is what Illidan is looking for.

You can customize the positions of the items much more by using a dummy monster; just move them around however you want after they are dropped.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
User avatar
Eleven Warrior
Posts: 736
Joined: Thu Apr 18, 2013 2:32 pm
Location: Australia

Re: Ask a simple question, get a simple answer

Post by Eleven Warrior »

Hi all.

Ok there is this code in the spore_mushroom and I don't know what it does exactly. I assume when the mushroom is killed it's meant to spawn something?

How does this work?

Code: Select all

onAnimationEvent = function(self, event)
				if event == "spawn" then
					-- select random spawner
					local x,y = 0,0
					local r = math.random(1,4)
					
					if r == 1 then
						x=-1
					elseif r == 2 then
						x=1
					elseif r == 3 then
						y=-1
					else
						y=1
					end
					
					for i in self.go.map:entitiesAt(self.go.x+x, self.go.y+y) do
						if i.name == "spawner" then
							local s = i.spawner
							
							-- spawn random herder
							local rand = math.random(1,5)
							if rand <= 2 then
								s:setSpawnedEntity("herder")
							elseif rand <= 4 then
								s:setSpawnedEntity("herder_small")
							else
								s:setSpawnedEntity("herder_big")
							end
							s:activate()
							
							-- spawn poison cloud
							s:setSpawnedEntity("poison_cloud_medium")
							s:activate()
						end
					end
				end
			end,
		},
minmay
Posts: 2770
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

Isle of Nex directs the monster to perform the "spawn" animation when it's time to make a new herder in the Herder's Den boss fight. That onAnimationEvent hook exists to activate the adjacent spawners on the correct frame.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
vieuxchat
Posts: 48
Joined: Wed Mar 02, 2016 3:14 pm

Re: Ask a simple question, get a simple answer

Post by vieuxchat »

Why the castle_wall_cloth isn't hit ?
It has health, shouldn't it be hittable ?
User avatar
Isaac
Posts: 3179
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

vieuxchat wrote:Why the castle_wall_cloth isn't hit ?
It has health, shouldn't it be hittable ?
Possible oversight. But it's easy to implement in one's own mods.
poomanchu
Posts: 3
Joined: Sat May 28, 2016 8:49 pm

Re: Ask a simple question, get a simple answer

Post by poomanchu »

So I downloaded the asset pack 2 but I can't figure out where to put them. Where do I put the folders?
User avatar
Isaac
Posts: 3179
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

poomanchu wrote:So I downloaded the asset pack 2 but I can't figure out where to put them. Where do I put the folders?
Anywhere you find convenient... It's not really [directly] used by the game, or in mods. To use the asset pack, you reference its internal files & folder system in your scripts; it is a partial copy of the game's internal "assets" folder; consider it an index of that folder.

It also gives [copied] direct file access to the game's internal assets, for inspection, study, or for new [derived] assets that you will include in your mod_assets folder. You do not have to include anything in the asset pack with your mod, because the game [everyone's install] already has it all internally.

I put my copy in the Almost Human folder found in my documents folder; everyone has that if they've installed the [Windows version of the] game.
poomanchu
Posts: 3
Joined: Sat May 28, 2016 8:49 pm

Re: Ask a simple question, get a simple answer

Post by poomanchu »

Isaac wrote:
poomanchu wrote:So I downloaded the asset pack 2 but I can't figure out where to put them. Where do I put the folders?
Anywhere you find convenient... It's not really [directly] used by the game, or in mods. To use the asset pack, you reference its internal files & folder system in your scripts; it is a partial copy of the game's internal "assets" folder; consider it an index of that folder.

It also gives [copied] direct file access to the game's internal assets, for inspection, study, or for new [derived] assets that you will include in your mod_assets folder. You do not have to include anything in the asset pack with your mod, because the game [everyone's install] already has it all internally.

I put my copy in the Almost Human folder found in my documents folder; everyone has that if they've installed the [Windows version of the] game.
Oh, so it's a means for making custom assets. I was looking in the models/env/and saw forest_statue_ivy_01. I cant find that in the editor under asset search though. Is that file attached to something like forest_statue_01 then?
User avatar
Isaac
Posts: 3179
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

poomanchu wrote:Oh, so it's a means for making custom assets. I was looking in the models/env/and saw forest_statue_ivy_01. I cant find that in the editor under asset search though. Is that file attached to something like forest_statue_01 then?
It's possible that it is not used in the game; and so ~not defined ~and not in the editor. There are assets in the packs for both LoG1 & 2 that are not seen in the games.
Post Reply