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: 3185
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

As I understand it, exits are hardcoded to spawn the party to the adjacent map of the exit.

It is possible to simply put an invisible teleporter (or a floor_trigger to a custom function) at the point of arrival, to have the party appear somewhere else.
Pompidom
Posts: 497
Joined: Sun May 06, 2018 9:42 pm

Re: Ask a simple question, get a simple answer

Post by Pompidom »

Yeah, but it comes with a lot of drawbacks.

Lostsol provided me with his fadeout/fadein script for doors that i can use for the same purpose to make my multiportal design.

So it's solved.
Pompidom
Posts: 497
Joined: Sun May 06, 2018 9:42 pm

Re: Ask a simple question, get a simple answer

Post by Pompidom »

Where do I find the gfxIndex of log2 list (default assets)

For example if I want to know the gfxIndex number of the hardstone bracelet

edit: found it

print(spawn("tome_wisdom").item:getGfxIndex());
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 »

1)How can I make monsters incorporeal so that the party can safely walk through them? Would be nice to be able create g-g-g-ghosts.

Also, why is it that the party can sometimes walk onto the tile of a monster that is placed in the editor and its "turn" and "move" components unmarked. Is it "trying" to move and the reason why the engine allows the party to move there?!

2) Is it possible to move a monster to a specific position as if it were teleported? Something along the lines of monster_1.monster:setPosition(1,2,3,4,5) or some such?! I assume correctly that this could work for all items/obstacles then?
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 »

Lorial wrote: Fri Sep 06, 2019 5:46 am 1)How can I make monsters incorporeal so that the party can safely walk through them? Would be nice to be able create g-g-g-ghosts.

Code: Select all

	zarchton_1.monster:setMonsterFlag("Collides", false)
	zarchton_1.monster:setMonsterFlag("NonMaterial", true)
	zarchton_1.dynamicObstacle:disable()
Is it possible to move a monster to a specific position as if it were teleported? Something along the lines of monster_1.monster:setPosition(1,2,3,4,5) or some such?!
Same as any other object.

Code: Select all

zarchton_1:setPosition(15,15,2,0,1) --places zarchton_1 centered on the map, facing South.
Pompidom wrote: Fri Sep 06, 2019 4:16 am Where do I find the gfxIndex of log2 list (default assets)
Grimrock 2 asset_pack\assets\textures\gui\textures\

items.dds
items_2.dds
items_3.dds

Index zero starts at top left; index 12 at the top right.
Pompidom
Posts: 497
Joined: Sun May 06, 2018 9:42 pm

Re: Ask a simple question, get a simple answer

Post by Pompidom »

I want to create magical staffs with secondary actions without a charge buildup so that they fire instantly when you rightclick them.
In this case I gave the staff of manar from dm pack a lightning bolt function as it looks a bit like a lightning rod.
I tried buildup = 0, but that doesn't work as it will produce a message: not enough energy, which is not the case.

I looked for the "weapon of power" in the g1 pack, it's some sort of gun that instantly fires a lightning projectile, but I can't find the object in the files to check for the code used.

Code: Select all

defineObject{
	name = "dm_staff_of_manar",
	baseObject = "base_dm_item",
	components = {
		{
			class = "Model",
			model = "mod_assets/dmcsb_pack/models/items/dm_staff_of_manar.fbx",
		},
		{
			class = "Item",
			uiName = "Staff of Manar",
			description = "An ancient magical staff.",
			gfxAtlas = "mod_assets/dmcsb_pack/textures/gui/dm_icoatlas.tga",
			gfxIndex = 71,
			gfxIndexPowerAttack = 150,
			impactSound = "impact_blunt",
			weight = 2.9,
			secondaryAction = "Lightning",
		},
		{
			class = "EquipmentItem",
			slot = "Weapon",
			willpower = 2,
			energy = 25,
		},
		{
			class = "CastSpell",
			name = "Lightning",
			uiName = "Lightning Bolt",
			gameEffect = "Conjures a Lightning Bolt",
			cooldown = 5,
			spell = "lightning_bolt",
			energyCost = 25,
			power = 3,
			requirements = { "concentration", 1 },
		},
	},
}
User avatar
Zo Kath Ra
Posts: 937
Joined: Sat Apr 21, 2012 9:57 am
Location: Germany

Re: Ask a simple question, get a simple answer

Post by Zo Kath Ra »

Pompidom wrote: Fri Sep 06, 2019 11:37 am I want to create magical staffs with secondary actions without a charge buildup so that they fire instantly when you rightclick them.
In this case I gave the staff of manar from dm pack a lightning bolt function as it looks a bit like a lightning rod.
I tried buildup = 0, but that doesn't work as it will produce a message: not enough energy, which is not the case.

I looked for the "weapon of power" in the g1 pack, it's some sort of gun that instantly fires a lightning projectile, but I can't find the object in the files to check for the code used.

Code: Select all

defineObject{
	name = "dm_staff_of_manar",
	baseObject = "base_dm_item",
	components = {
		{
			class = "Model",
			model = "mod_assets/dmcsb_pack/models/items/dm_staff_of_manar.fbx",
		},
		{
			class = "Item",
			uiName = "Staff of Manar",
			description = "An ancient magical staff.",
			gfxAtlas = "mod_assets/dmcsb_pack/textures/gui/dm_icoatlas.tga",
			gfxIndex = 71,
			gfxIndexPowerAttack = 150,
			impactSound = "impact_blunt",
			weight = 2.9,
			secondaryAction = "Lightning",
		},
		{
			class = "EquipmentItem",
			slot = "Weapon",
			willpower = 2,
			energy = 25,
		},
		{
			class = "CastSpell",
			name = "Lightning",
			uiName = "Lightning Bolt",
			gameEffect = "Conjures a Lightning Bolt",
			cooldown = 5,
			spell = "lightning_bolt",
			energyCost = 25,
			power = 3,
			requirements = { "concentration", 1 },
		},
	},
}
This works:
buildup = 0.1

This, too:
buildup = 0.01

But this will just show "Out of energy":
buildup = 0.001

It's fast, but not immediate.
If you want truly immediate secondary actions, maybe try PartyComponent.onClickItemSlot(self, champion, container, slot, button)
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 »

Isaac wrote: Fri Sep 06, 2019 6:43 am
Lorial wrote: Fri Sep 06, 2019 5:46 am 1)How can I make monsters incorporeal so that the party can safely walk through them? Would be nice to be able create g-g-g-ghosts.

Code: Select all

	zarchton_1.monster:setMonsterFlag("Collides", false)
	zarchton_1.monster:setMonsterFlag("NonMaterial", true)
	zarchton_1.dynamicObstacle:disable()
Thanks, what would I have to use in a monster lua, though? No variation of the above seems to work.
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 »

Lorial wrote: Fri Sep 06, 2019 8:44 pm Thanks, what would I have to use in a monster lua, though? No variation of the above seems to work.
If you mean in the definition... then you would put it in an onInit function, and use the self.go variable prefix.

Code: Select all

defineObject{
	name = "ghost_elemental",
	baseObject = "ice_guardian",
	components = {
		{
			class = "Null",
			onInit = function(self) 
				self.go.monster:setMonsterFlag("Collides", false)
				self.go.monster:setMonsterFlag("NonMaterial", true)
				self.go.dynamicObstacle:disable()
			end,
		}
	}
}
*The onInit function could be put in the monster (or any other) component, instead of adding a Null, but you would have to duplicate the component exactly, then add the onInit function. This way (with the Null) all you need do is change the baseObject, and it will work for any monster type.
Pompidom
Posts: 497
Joined: Sun May 06, 2018 9:42 pm

Re: Ask a simple question, get a simple answer

Post by Pompidom »

Would it be simple to detach elemental resistances from their corresponding stats?

+2 elemental resistance for each point of strength/vitality/dexterity/willpower for example leads quickly to 100% resists in my mod.

I know Magic of grimrock toned it down by 1 % increase for each stat. That should be acceptable as well.
Post Reply