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!
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

Nowhere, because they don't affect stats. onComputeCooldown is called whenever a MeleeAttackComponent, FirearmAttackComponent, ThrowAttackComponent, or RangedAttackComponent is used. onComputeCritChance and onComputeAccuracy are called whenever the champion's crit chance or accuracy is wanted (either they make an attack or they have the stats or inventory panel open).
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.
bongobeat
Posts: 1076
Joined: Thu May 16, 2013 5:58 pm
Location: France

Re: Ask a simple question, get a simple answer

Post by bongobeat »

Hi there,

I just wonder, when you use some tileset with the floor set as heightmap/material (e.g. beach ground), does this kind of floor count as object(s) or anything? Does this need more ressources or take more size in the savegame?
My asset pack: viewtopic.php?f=22&t=9320

Log1 mod : Toorum Manor: viewtopic.php?f=14&t=5505
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 »

bongobeat wrote:Hi there,

I just wonder, when you use some tileset with the floor set as heightmap/material (e.g. beach ground), does this kind of floor count as object(s) or anything? Does this need more ressources or take more size in the savegame?
It must be one object per tile, exactly as for any other "flat" floors. But a flat floor with a basic model of only one square face takes less memory than any more detailed model.
User avatar
Isaac
Posts: 3185
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

AndakRainor wrote:It must be one object per tile, exactly as for any other "flat" floors. But a flat floor with a basic model of only one square face takes less memory than any more detailed model.
I assumed that any deformation in the ground would cause/generate a divided model for the floor of any tile that it crosses, or is it some kind of render hack?
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

Tiles only place the objects they have in their "floor", "ceiling", "wall", "pillar", etc. tables. The forest_ground tile, for example, places no objects whatsoever.
The actual heightmap mesh is created by HeightmapComponent. This doesn't create additional objects, and in fact the heightmap mesh is not saved in savegames, it gets generated again every time the game is loaded (you can test this quite easily). It is a single mesh for the entire level, not multiple meshes, and the mesh is contiguous along contiguous tiles.
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
Isaac
Posts: 3185
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

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.
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 »

Is there a way to remove an item from a surface via scripts? (Something like what a removeItem() if it existed)
Destroying them throught GameObject:destroy() or erasing their table seems to leave their ghost on the surface...
That raises the problem where if you trigger the destroy script again, it'll destroy every instance of that item on the map, even though their ID is nil.
My asset pack [v1.10]
Features a bit of everything! :D
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

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.
zimberzimber wrote:Is there a way to remove an item from a surface via scripts? (Something like what a removeItem() if it existed
Impossible unless you find a security hole.
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 »

Well, removing and re-adding the surface component works if it holds a single item :lol:
My asset pack [v1.10]
Features a bit of everything! :D
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

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.
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