Page 68 of 400

Re: Ask a simple question, get a simple answer

Posted: Thu May 21, 2015 10:10 pm
by Slade
Thanks again minmay!

Re: Ask a simple question, get a simple answer

Posted: Sat May 23, 2015 8:02 pm
by The cube
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

Posted: Sat May 23, 2015 11:26 pm
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

Re: Ask a simple question, get a simple answer

Posted: Tue May 26, 2015 2:50 am
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?

Re: Ask a simple question, get a simple answer

Posted: Wed May 27, 2015 1:09 am
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 ?

Re: Ask a simple question, get a simple answer

Posted: Wed May 27, 2015 1:34 am
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

Re: Ask a simple question, get a simple answer

Posted: Wed May 27, 2015 2:10 am
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

Re: Ask a simple question, get a simple answer

Posted: Wed May 27, 2015 11:15 pm
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

Re: Ask a simple question, get a simple answer

Posted: Wed May 27, 2015 11:55 pm
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()" ??

Re: Ask a simple question, get a simple answer

Posted: Thu May 28, 2015 5:56 am
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()