Page 274 of 396

Re: Ask a simple question, get a simple answer

Posted: Sat Jan 05, 2019 2:54 pm
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?

Re: Ask a simple question, get a simple answer

Posted: Sun Jan 06, 2019 3:09 am
by 7Soul
Simple question: why don't we have a discord server?

Re: Ask a simple question, get a simple answer

Posted: Sun Jan 06, 2019 3:51 am
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?

Re: Ask a simple question, get a simple answer

Posted: Sun Jan 06, 2019 5:04 am
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

Re: Ask a simple question, get a simple answer

Posted: Sun Jan 06, 2019 7:21 pm
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.

Re: Ask a simple question, get a simple answer

Posted: Sun Jan 06, 2019 7:50 pm
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! ;)

Re: Ask a simple question, get a simple answer

Posted: Sun Jan 06, 2019 9:22 pm
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

Re: Ask a simple question, get a simple answer

Posted: Sun Jan 06, 2019 9:37 pm
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"
},

Re: Ask a simple question, get a simple answer

Posted: Sun Jan 06, 2019 9:56 pm
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

Re: Ask a simple question, get a simple answer

Posted: Sun Jan 06, 2019 10:15 pm
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")