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
vanblam
Posts: 243
Joined: Sun Nov 09, 2014 12:15 am

Re: Ask a simple question, get a simple answer

Post by vanblam »

Isaac wrote: Mon Aug 26, 2019 3:30 pm As in one object that changes state, and this is reflected on the automap?
I'm trying to create lava to see on the automap. Looking to create my own water basically. Change the blue to a an orange color and add lava style wave marks.
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 »

https://github.com/JKos/log2doc/wiki/Co ... -component

Example:

Code: Select all

{
	class = "MapGraphics",
	image = "mod_assets/ext/sx_urban_town/textures/bed_automap.tga",
},
User avatar
vanblam
Posts: 243
Joined: Sun Nov 09, 2014 12:15 am

Re: Ask a simple question, get a simple answer

Post by vanblam »

Isaac wrote: Mon Aug 26, 2019 5:15 pm https://github.com/JKos/log2doc/wiki/Co ... -component

Example:

Code: Select all

{
	class = "MapGraphics",
	image = "mod_assets/ext/sx_urban_town/textures/bed_automap.tga",
},
So I can use just "MapGraphics" to create an entire new water for the automap? Edges and multiple icons? Like all the things I have circled here?

Image

Edit: I think this is not possible, the "automapTile" is built in as far as I can tell.
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 »

This requires a bit of scripting in the object/component's onInit hook. When it loads, it must inspect its [4] adjacent tiles for other instances of itself, and choose the appropriate icon to blend in with these. Also: the option exists to rotate the icon; that could help cut the number of icons needed, provided you do not use hand drawn waves that need to all point upwards consistently.
(Otherwise, you will need unique icons for each of the corners, and for the cardinal walls.)
User avatar
vanblam
Posts: 243
Joined: Sun Nov 09, 2014 12:15 am

Re: Ask a simple question, get a simple answer

Post by vanblam »

Isaac wrote: Tue Aug 27, 2019 1:35 am This requires a bit of scripting in the object/component's onInit hook. When it loads, it must inspect its [4] adjacent tiles for other instances of itself, and choose the appropriate icon to blend in with these. Also: the option exists to rotate the icon; that could help cut the number of icons needed, provided you do not use hand drawn waves that need to all point upwards consistently.
(Otherwise, you will need unique icons for each of the corners, and for the cardinal walls.)
:shock: Well... I don't have the skills to pull that off. I wonder if someone else has done this, if so please link me or give a small tutorial :P. That would be much appreciated.
Pompidom
Posts: 497
Joined: Sun May 06, 2018 9:42 pm

Re: Ask a simple question, get a simple answer

Post by Pompidom »

A much more efficient instant solution is to use the "chasm" automap icon for lava and call it a day.
Since you can't walk or swim in lava, you will never be able to automap the pool of lava in your example during normal plays. Only the outer squares.

https://youtu.be/_YKfb-jOugg

defineObject{
name = "dwarf_fire",
baseObject = "base_floor_decoration",
components = {
{
class = "Model",
model = "assets/models/effects/wall_fire.fbx",
staticShadow = true,
},
{
class = "Light",
color = vec(0.75, 0.4, 0.25),
brightness = 40,
range = 6,
castShadow = false,
offset = vec(0, 1.2, 0),
},
{
class = "Particle",
particleSystem = "dwarf_fire",
offset = vec(0, 0, 0),
--destroyObject = true,
},
},
minimalSaveState = true,
editorIcon = 136,
replacesFloor = false,
automapTile = "chasm",
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 »

You can do both; use the chasm automap icon, with a partially transparent tile icon.
Image

VIDEO: https://vimeo.com/356132655

I'd post the source for this, but it's not completed/ or mod-ready just yet.

However... the tile definition is this:

Code: Select all

defineTile{
	name = "lava",
	editorIcon = 144,
	color = {255,100,50,255},
	builder = "dungeon",
	floor = {
		"lava_floor", 1,
	},
	underwater = true,
	automapTile = "chasm",
	diggable = false, --optional
	moveSound = "water_hit_small",
}
And it just uses the regular mapgraphics component to display the icon on the map.

It is easier than I had first thought, because all one needs to do for the basic lava object is to use "forest_chasm" object and add a floor model with the magma material; also a tile damager component. Use the model's offset property to lower the magma height to slightly below ground level; or to suit.

*No need to reinvent the script that does this same task for the chasm edges; but you do have to update the name it checks for, with thew name of your lava object.

It is possible to (as this one does), to use the onInit hook to spawn a platform object just below the magma surface, and allow for the party to jump out after falling in... if it's not too deep; or you can have the lava be up to their neck, with instant party death... as seen in the video.

Here is the mapgraphics component, and icon I have used:

Code: Select all

{
	class = "MapGraphics",
	image = "mod_assets/textures/gui/automap/automap_lava_tile.tga",
}
https://www.dropbox.com/s/0la683dv95zg4 ... e.dds?dl=0
User avatar
vanblam
Posts: 243
Joined: Sun Nov 09, 2014 12:15 am

Re: Ask a simple question, get a simple answer

Post by vanblam »

Ahh, I see. Thanks for the tips guys :) I didn't even know chasm existed lol.
User avatar
Lorial
Posts: 91
Joined: Sat Dec 29, 2018 12:27 pm

Re: Ask a simple question, get a simple answer

Post by Lorial »

Zo Kath Ra wrote: Mon Aug 26, 2019 2:40 pm This rock becomes gravity-less when thrown or launched.
But you can also do something when it lands, e.g. destroy the rock and create a new item at the rock's location.
The code works even when you set:
sharpProjectile = true
Thank you for the code, need to wrap my head around that one and do some testing.

akroma222 wrote: Mon Aug 26, 2019 1:32 pm Cant help with (1) but for (2), this is what you are looking for.
There are links to scripts that will manage traits and stat adding and removing too
viewtopic.php?f=22&t=9024&p=88389&hilit ... ger#p88389
Akroma
Thanks a bunch for that link. I stumbled upon that thread months ago, but completely forgot about it.
Now I no longer have to call it a "cursed item" with a gameEffect warning attached to it. :oops:

One thing I noticed, though, the spelling must be that of the trait id, not the name displayed in the traits window (Meditation - meditation). Gets a bit ugly when it hudPrints "X loses the improved_dual_wield trait". When changing to a capital "M", it doesn't work anymore, the trait won't get removed.
User avatar
Lorial
Posts: 91
Joined: Sat Dec 29, 2018 12:27 pm

Re: Ask a simple question, get a simple answer

Post by Lorial »

If I equip the last item of a custom armor set, it seems to spam the message/sound every frame.
Is there a way to get the message/sound only once? Would adding/removing a trait for that be the better choice?

Code: Select all

		{
			class = "EquipmentItem",
			protection = 2,
			evasion = 3,
			onRecomputeStats = function(self, champion)
				if champion:isArmorSetEquipped("tattered") then
--				hudPrint(champion:getName().." is now wearing the full Tattered Set.")
					champion:addStatModifier("protection", 2)
					champion:addStatModifier("evasion", 4)
				end
			end,
Post Reply