Ask a simple question, get a simple answer
Re: Ask a simple question, get a simple answer
Thanks again minmay!
Re: Ask a simple question, get a simple answer
Is it possible to make a monster that ONLY takes damage from backstabs and does not take damage from anything else?
Re: Ask a simple question, get a simple answer
too lazy to test this but it should work: give the monster "immune" for all its resistances, add a PartyComponent.onAttack hook that checks if such a monster is in front of the party and facing the same direction and removes its resistances if so, and add an onPostAttack to all MeleeAttackComponents and (if you have light firearms) FirearmAttackComponents that gives the monster its resistances back
any other approach will remove the monster's resistances for too long (you cannot rely on MonsterComponent.onDamage because attacks can miss even with inf accuracy and -inf evasion, and the monster could be hit by another damage source on the same frame)
i don't recommend doing this, it's a pretty ugly hack and backstabbing in log2 isn't exactly hard in the first place =P
any other approach will remove the monster's resistances for too long (you cannot rely on MonsterComponent.onDamage because attacks can miss even with inf accuracy and -inf evasion, and the monster could be hit by another damage source on the same frame)
i don't recommend doing this, it's a pretty ugly hack and backstabbing in log2 isn't exactly hard in the first place =P
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Re: Ask a simple question, get a simple answer
Can a delayedCall fire more than once in a given frame? Eg., if a function calls itself by a delayed call with a delay of 0.0001, will that call happen more than once in a frame?
- AndakRainor
- Posts: 674
- Joined: Thu Nov 20, 2014 5:18 pm
Re: Ask a simple question, get a simple answer
I tested PushableBlock and I see that it only works with pushable_block_floor under the destination. Is there any way to create a block pushable anywhere without those specific floors ? Is there a technical reason this limitation was set or is it just because of game play choices ? Could a pushable and destroyable block cause problems ?
- Zo Kath Ra
- Posts: 940
- Joined: Sat Apr 21, 2012 9:57 am
- Location: Germany
Re: Ask a simple question, get a simple answer
Is there a way to get the game's version?
Something like:
Something like:
Code: Select all
if (version < 224) then
hudPrint("This mod requires version 2.2.4 or greater")
end
Re: Ask a simple question, get a simple answer
For this specific case you could check for the existence of any field added in 2.2.4:Zo Kath Ra wrote:Is there a way to get the game's version?
Something like:Code: Select all
if (version < 224) then hudPrint("This mod requires version 2.2.4 or greater") end
Code: Select all
if not GameMode.getGameFlags then
hudPrint("This mod requires version 2.2.4 or greater")
end
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
- Eleven Warrior
- Posts: 752
- Joined: Thu Apr 18, 2013 2:32 pm
- Location: Australia
Re: Ask a simple question, get a simple answer
Hi all. I have forgot how to do this (code below) When floor_trigger_3 is down something happens. If floor_trigger_3 is up something happens. The error I am getting is with the (isDown) bit. Please help I know it's easy imam sure thxs 

Code: Select all
function checkLevers()
if floor_trigger_3:isDown() then
hudPrint("hello")
else if floor_trigger_3:isUp() then
hudPrint("bye")
end
end
end
Re: Ask a simple question, get a simple answer
Shouldn't there be something like
And I can't find "isDown()" - maybe you mean "isActivated()" ??
Code: Select all
floor_trigger_3.floortrigger
Re: Ask a simple question, get a simple answer
You must always specify the .component of a object you manipulate. You can see the components listed when you click object, however I noticed some components use activated and some use enabled
examples:
floor_trigger_3.floortrigger:isActivated()
aan_reset_timer.timer:start()
aan_stones_reset_button.clickable:disable()
aan_pushable_block_floor_1.controller:isActivated()
aan_pushable_block_floor_1.controller:activate()
examples:
floor_trigger_3.floortrigger:isActivated()
aan_reset_timer.timer:start()
aan_stones_reset_button.clickable:disable()
aan_pushable_block_floor_1.controller:isActivated()
aan_pushable_block_floor_1.controller:activate()