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
Slade
Posts: 45
Joined: Tue Oct 21, 2014 6:31 pm

Re: Ask a simple question, get a simple answer

Post by Slade »

Thanks again minmay!
User avatar
The cube
Posts: 94
Joined: Tue Apr 23, 2013 6:09 pm
Location: Barren Desert

Re: Ask a simple question, get a simple answer

Post by The cube »

Is it possible to make a monster that ONLY takes damage from backstabs and does not take damage from anything else?
minmay
Posts: 2789
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

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
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.
Eburt
Posts: 69
Joined: Thu Feb 05, 2015 5:44 am

Re: Ask a simple question, get a simple answer

Post by Eburt »

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?
User avatar
AndakRainor
Posts: 674
Joined: Thu Nov 20, 2014 5:18 pm

Re: Ask a simple question, get a simple answer

Post by AndakRainor »

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

Re: Ask a simple question, get a simple answer

Post by Zo Kath Ra »

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
minmay
Posts: 2789
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

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
For this specific case you could check for the existence of any field added in 2.2.4:

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.
User avatar
Eleven Warrior
Posts: 752
Joined: Thu Apr 18, 2013 2:32 pm
Location: Australia

Re: Ask a simple question, get a simple answer

Post by Eleven Warrior »

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
User avatar
THOM
Posts: 1280
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: Ask a simple question, get a simple answer

Post by THOM »

Shouldn't there be something like

Code: Select all

floor_trigger_3.floortrigger
And I can't find "isDown()" - maybe you mean "isActivated()" ??
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
User avatar
aaneton
Posts: 189
Joined: Fri Sep 21, 2012 1:53 pm

Re: Ask a simple question, get a simple answer

Post by aaneton »

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()
My Grimrock mod (LoG1): The Onkalo Project
My Android (and windows desktop) game: Balloon Gentleman
Post Reply