Re: Ask a simple question, get a simple answer
Posted: Sat Jan 05, 2019 2:54 pm
Official Legend of Grimrock Forums
http://grimrock.net/forum/
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,
}
}
}
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?
No, I want to cast the darkness spell, according to a riddle, and open a door.Zo Kath Ra wrote: ↑Sat Jan 05, 2019 2:54 pmWhat kind of spell is it?
Does the spell create a projectile, and when it hits the door, you want the door to open?
Isaac wrote: ↑Sun Jan 06, 2019 3:51 amHere is one way to do it:thank you, I'm going to look at that!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, } } }
Some monsters don't have any resistances, like the Forest Ogre.
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)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" },
Code: Select all
resistances = { ["poison"] = "weak" },
Code: Select all
resistances = { poison = "immune" },
Code: Select all
function onDamageMonster(self, damage, damageType)
print(self:getResistance())
print(self:getEvasion())
end
Code: Select all
nil
-10
I thought "maybe he's calling the function w/o any arguments".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):
On a turtle that printsCode: Select all
function onDamageMonster(self, damage, damageType) print(self:getResistance()) print(self:getEvasion()) end
Code: Select all
nil -10
Code: Select all
getResistance("fire")
getResistance("cold")
getResistance("poison")
getResistance("shock")
getResistance("physical")