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
TheLastOrder
Posts: 104
Joined: Wed Oct 17, 2012 1:56 am

Re: Ask a simple question, get a simple answer

Post by TheLastOrder »

How can I ask in a function for a teleporter to check if it´s activated or not?

if teleporter_a_1.controller:isActivated() doesn´t work.
if teleporter_a_1.teleporter:isActivated() neither.

I´ve checked the script reference but it seems that there´s no way to call it...

teleporter_a_1.controller:isEnabled() works, but always. Because it exists. And what I need is to check if it´s activated, not if it´s "there" (either activated or not).

:roll:
Last edited by TheLastOrder on Fri Dec 19, 2014 8:08 pm, edited 1 time in total.
User avatar
Thorham
Posts: 80
Joined: Sat May 04, 2013 5:12 pm

Re: Ask a simple question, get a simple answer

Post by Thorham »

TheLastOrder wrote:How can I ask in a function for a teleporter to know if it´s activated or not?

Code: Select all

teleporter_a_1.teleporter:isEnabled()
User avatar
TheLastOrder
Posts: 104
Joined: Wed Oct 17, 2012 1:56 am

Re: Ask a simple question, get a simple answer

Post by TheLastOrder »

Thorham wrote:

Code: Select all

teleporter_a_1.teleporter:isEnabled()
teleporter_a_1.controller:isEnabled() works, but always. Because it exists. And what I need is to check if it´s activated, not if it´s "there" (either activated or not).
The problem with this is that it returns always true (it´s always enabled, but it has 2 states: deactivated or activated).

I need it to return true ONLY if it´s activated. :roll:
User avatar
Thorham
Posts: 80
Joined: Sat May 04, 2013 5:12 pm

Re: Ask a simple question, get a simple answer

Post by Thorham »

TheLastOrder wrote:
Thorham wrote:

Code: Select all

teleporter_a_1.teleporter:isEnabled()
teleporter_a_1.controller:isEnabled() works, but always. Because it exists. And what I need is to check if it´s activated, not if it´s "there" (either activated or not).
The problem with this is that it returns always true (it´s always enabled, but it has 2 states: deactivated or activated).

I need it to return true ONLY if it´s activated. :roll:
Yes, that's why it should be:

Code: Select all

teleporter_a_1.teleporter:isEnabled()
And not:

Code: Select all

teleporter_a_1.controller:isEnabled()
Just like I wrote before. You tried controller:isEnabled(), while it should be teleporter:isEnabled(). This works. I tested it.
User avatar
TheLastOrder
Posts: 104
Joined: Wed Oct 17, 2012 1:56 am

Re: Ask a simple question, get a simple answer

Post by TheLastOrder »

I´m an idiot... why I never tested that.... WHY???

Thanks a lot, you´re a true hero!!! :mrgreen:

I need to embrace the fact that not all controllers are teleporters but all teleporters are controllers...
User avatar
Eleven Warrior
Posts: 736
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 know how to give the party Exp for things but how do you Minus Exp or is it possible? Thxs :)
minmay
Posts: 2770
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

Just pass a negative number to gainExp(). You can't lower a champion's level this way, though (nor by any other means that I am aware of).
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: 736
Joined: Thu Apr 18, 2013 2:32 pm
Location: Australia

Re: Ask a simple question, get a simple answer

Post by Eleven Warrior »

Thxs minmay will try this out. I was thinking of putting a Minus sign next to the numbers , but thought nahhhh that wont work. Should have tried it anyway.
User avatar
TheLastOrder
Posts: 104
Joined: Wed Oct 17, 2012 1:56 am

Re: Ask a simple question, get a simple answer

Post by TheLastOrder »

Hi guys!
Q: How to avoid that the dormant entity can be attacked by the party before being awake and functional as an enemy?
Thank you so much!
GoldenShadowGS wrote:
ReFreezed wrote:How do I wake up summon_stone_dormant monsters in a script? I can't seem to find a method for it.

Code: Select all

summon_stone_dormant.controller:activate()
User avatar
Sutekh
Posts: 126
Joined: Sun Nov 25, 2012 9:58 am
Location: UK

Re: Ask a simple question, get a simple answer

Post by Sutekh »

The summon stone's wake-up animation takes about 5 seconds by my reckoning, so here's one quick and dirty solution:

1: Place an invisible wall object on the same tile as the summon stone to 'shield' it.
2: Place a timer (with timer unchecked and disableSelf checked) set to 5 seconds and connect it to a script that destroys the invisible wall.
3: Use the same trigger that activates the summon stone's controller to also start the timer, which will destroy the invisible wall at about the same time the summon stone is fully awake.
Post Reply