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
Zo Kath Ra
Posts: 932
Joined: Sat Apr 21, 2012 9:57 am
Location: Germany

Re: Ask a simple question, get a simple answer

Post by Zo Kath Ra »

bongobeat wrote: Sat Jan 05, 2019 2:09 pm I want to open a door whith the party casting a special spell, but I can't figure how to do that correctly.
What kind of spell is it?
Does the spell create a projectile, and when it hits the door, you want the door to open?
User avatar
7Soul
Posts: 209
Joined: Sun Oct 19, 2014 1:56 am
Location: Brazil

Re: Ask a simple question, get a simple answer

Post by 7Soul »

Simple question: why don't we have a discord server?
Join the LoG discord server: https://discord.gg/ArgAgNN :D

My Mods
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 »

bongobeat wrote: Sat Jan 05, 2019 2:09 pm I want to open a door whith the party casting a special spell, but I can't figure how to do that correctly.
Here is one way to do it:

Code: Select all

defineObject{
	name = "party",
	baseObject = "party",
	components = {
		{
			class = "Party",
			onCastSpell = function(self, champion, spell) 
				if spell == "darkness" and
					true --substitute TRUE for your own condition to restrict the trigger.
				 then 
						tomb_door_stone_1.door:open() --triggered event.
				end
				return true
			end,
		}
	}
}
7Soul wrote: Sun Jan 06, 2019 3:09 am Simple question: why don't we have a discord server?
Why is this question so often asked? It was just asked on the InXile forums as well. What would be the point?—what would be the benefit?
Last edited by Isaac on Sun Jan 06, 2019 10:11 pm, edited 1 time in total.
User avatar
7Soul
Posts: 209
Joined: Sun Oct 19, 2014 1:56 am
Location: Brazil

Re: Ask a simple question, get a simple answer

Post by 7Soul »

7Soul wrote: Sun Jan 06, 2019 3:09 am Simple question: why don't we have a discord server?
Why is this question so often asked? It was just asked on the InXile forums as well. What would be the point?—what would be the benefit?
It could be fun :) Forums are too formal, it's like sending an email
Join the LoG discord server: https://discord.gg/ArgAgNN :D

My Mods
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 »

Zo Kath Ra wrote: Sat Jan 05, 2019 2:54 pm
bongobeat wrote: Sat Jan 05, 2019 2:09 pm I want to open a door whith the party casting a special spell, but I can't figure how to do that correctly.
What kind of spell is it?
Does the spell create a projectile, and when it hits the door, you want the door to open?
No, I want to cast the darkness spell, according to a riddle, and open a door.
With a projectile it would be easy, but not for this spell.
My asset pack: viewtopic.php?f=22&t=9320

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

Isaac wrote: Sun Jan 06, 2019 3:51 am
bongobeat wrote: Sat Jan 05, 2019 2:09 pm I want to open a door whith the party casting a special spell, but I can't figure how to do that correctly.
Here is one way to do it:

Code: Select all

defineObject{
	name = "party",
	baseObject = "party",
	components = {
		{
			class = "Party",
			onCastSpell = function(self, champion, spell) print( spell:match("fireball") )
				if spell == "darkness" and
					true --substitute TRUE for your own condition to restrict the trigger.
				 then 
						tomb_door_stone_1.door:open() --triggered event.
				end
				return true
			end,
		}
	}
}
thank you, I'm going to look at that! ;)
My asset pack: viewtopic.php?f=22&t=9320

Log1 mod : Toorum Manor: viewtopic.php?f=14&t=5505
User avatar
7Soul
Posts: 209
Joined: Sun Oct 19, 2014 1:56 am
Location: Brazil

Re: Ask a simple question, get a simple answer

Post by 7Soul »

Does monster:getResistance() not work?

I added an onDamage hook to a monster and :getEvasion(), :getProtection(), etc work fine, but :getResistance() returns nil
Join the LoG discord server: https://discord.gg/ArgAgNN :D

My Mods
User avatar
Zo Kath Ra
Posts: 932
Joined: Sat Apr 21, 2012 9:57 am
Location: Germany

Re: Ask a simple question, get a simple answer

Post by Zo Kath Ra »

7Soul wrote: Sun Jan 06, 2019 9:22 pm Does monster:getResistance() not work?

I added an onDamage hook to a monster and :getEvasion(), :getProtection(), etc work fine, but :getResistance() returns nil
Some monsters don't have any resistances, like the Forest Ogre.
The Air Elemental has resistances to all damage types:

Code: Select all

resistances = {
	fire = "immune",
	cold = "immune",
	poison = "immune",
	shock = "absorb",
	physical = "immune"
},
User avatar
7Soul
Posts: 209
Joined: Sun Oct 19, 2014 1:56 am
Location: Brazil

Re: Ask a simple question, get a simple answer

Post by 7Soul »

Zo Kath Ra wrote: Sun Jan 06, 2019 9:37 pm Some monsters don't have any resistances, like the Forest Ogre.
The Air Elemental has resistances to all damage types:

Code: Select all

resistances = {
	fire = "immune",
	cold = "immune",
	poison = "immune",
	shock = "absorb",
	physical = "immune"
},
You're probably right to assume I didn't test on a monster with resistances (customer support 101 lol)

But anyway I did and it still returns nil

Btw the turtle's resistances are listed like this:

Code: Select all

resistances = { ["poison"] = "weak" },
But something like the herder is like this

Code: Select all

resistances = { poison = "immune" },
I tried both styles and both still give me nil

Here's the code (the hook calls this function):

Code: Select all

function onDamageMonster(self, damage, damageType)
	print(self:getResistance())
	print(self:getEvasion())
end
On a turtle that prints

Code: Select all

nil
-10
Join the LoG discord server: https://discord.gg/ArgAgNN :D

My Mods
User avatar
Zo Kath Ra
Posts: 932
Joined: Sat Apr 21, 2012 9:57 am
Location: Germany

Re: Ask a simple question, get a simple answer

Post by Zo Kath Ra »

7Soul wrote: Sun Jan 06, 2019 9:56 pm You're probably right to assume I didn't test on a monster with resistances (customer support 101 lol)
Here's the code (the hook calls this function):

Code: Select all

function onDamageMonster(self, damage, damageType)
	print(self:getResistance())
	print(self:getEvasion())
end
On a turtle that prints

Code: Select all

nil
-10
I thought "maybe he's calling the function w/o any arguments".
But then I thought "that can't be it, he must be calling it on a monster w/o any resistances"

getResistance() needs a string argument, even if the Scripting Reference doesn't say so:

Code: Select all

getResistance("fire")
getResistance("cold")
getResistance("poison")
getResistance("shock")
getResistance("physical")
Post Reply