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
AndakRainor
Posts: 674
Joined: Thu Nov 20, 2014 5:18 pm

Re: Ask a simple question, get a simple answer

Post by AndakRainor »

minmay wrote:
zimberzimber wrote:Well, removing and re-adding the surface component works if it holds a single item :lol:
Actually, it doesn't. This taints the item and will cause a crash as soon as the user tries to save the game or pick up the item.
If I remember correctly, you could destroy the object with the surface component and spawn another one and be save game friendly.
minmay
Posts: 2768
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

No. That does not fix the object's fullId. The best-case scenario is that when you save and reload the game, the item is fully inserted in the new surface as if you never changed anything (and prior to the save/load, the item still considers itself a part of the surface but the surface does not consider the item to be inside it). This is the opposite of "save game friendly", it means the state of the dungeon changes when you save and load, and more to the point, it accomplishes absolutely nothing.
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
zimberzimber
Posts: 432
Joined: Fri Feb 08, 2013 8:06 pm

Re: Ask a simple question, get a simple answer

Post by zimberzimber »

Everything seems to be fine as long as the item passes through a champions inventory.
Placing/dropping/interacting with the item didn't crash anything, neither did saving/loading.
My asset pack [v1.10]
Features a bit of everything! :D
Eburt
Posts: 69
Joined: Thu Feb 05, 2015 5:44 am

Re: Ask a simple question, get a simple answer

Post by Eburt »

Is there a way to prevent the party from throwing an item from the mouse pointer, but not prevent other functionality such as movement or placement of the item on a surface?
User avatar
Isaac
Posts: 3172
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

Eburt wrote:Is there a way to prevent the party from throwing an item from the mouse pointer, but not prevent other functionality such as movement or placement of the item on a surface?
You could make the object's clickable component big enough to catch clicks across the whole screen.

Quick example:

Code: Select all

altar_1.clickable:setSize(vec(6,6,6))
Eburt
Posts: 69
Joined: Thu Feb 05, 2015 5:44 am

Re: Ask a simple question, get a simple answer

Post by Eburt »

Thanks Isaac. Yes, that works if the party is in front of something I want to place the item on, but I want to generally prevent them from throwing items at all when certain conditions are met. However, they may have to place items in surfaces, etc. under the same conditions.

I tried attaching something to the party, but its not effective since the onClick hook doesn't do anything - it just goes on to do the normal action of throwing, etc. I could do something like make them drop the item, but that would prevent normal placement. Any ideas?
minmay
Posts: 2768
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

It's not possible to prevent item throws with the user scripting interface except via GameMode.setEnableControls(false) which is obviously not what you want.
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.
minmay
Posts: 2768
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

minmay wrote:
Isaac wrote:But the question I suppose had was whether or not the geometry is denser in places of deformation, or if the mesh is uniformly dense and just deformed by the heightmap, or not.

*When I said, 'model', I did mean the floor of the entire map; not separate floor models for every tile.
The geometry is not uniformly dense.
Keep in mind that triangles are really cheap. Performance-wise, the heightmap mesh is almost free on modern GPUs.
Here's a more precise answer for you: any 3x3 square in the heightmap mesh that is deformed gets 50 triangles. Any 3x3 square that is not deformed (i.e., any tile where all adjacent tiles have the same height and no noise) gets 2 triangles.
So if you completely fill a 32x32 level with heightmapped tiles, and your heightmap+noisemap is such that every tile gets deformed...it's still just 51,200 triangles. For comparison, this scene in Isle of Nex has over 2,100,000 triangles.
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.
kelly1111
Posts: 349
Joined: Sun Jan 20, 2013 6:28 pm

Re: Ask a simple question, get a simple answer

Post by kelly1111 »

How can I make a floorsurface (inside dungeon) digable? When I try to dig inside I get the message "you can't dig here"
minmay
Posts: 2768
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

diggable = true in the tile definition.
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.
Post Reply