Enabling/disabling monster components [SOLVED]

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!
Post Reply
Granamir
Posts: 202
Joined: Wed Jan 07, 2015 7:19 pm

Enabling/disabling monster components [SOLVED]

Post by Granamir »

Hi eveyone,
trying to hold a monster so he can't attack and move but can do everything else. It's easy to do from editor but i also have to change these settings via script.
Anyone has a clue on how to do to enable/disable (via script) monster components such as: model, move, turn, attacks, summon, etc.?
Ty
Last edited by Granamir on Thu Feb 19, 2015 3:48 pm, edited 1 time in total.
MrChoke
Posts: 324
Joined: Sat Oct 25, 2014 7:20 pm

Re: Enabling/disabling monster components

Post by MrChoke »

Granamir wrote:Hi eveyone,
trying to hold a monster so he can't attack and move but can do everything else. It's easy to do from editor but i also have to change these settings via script.
Anyone has a clue on how to do to enable/disable (via script) monster components such as: model, move, turn, attacks, summon, etc.?
Ty
All components have a disable() enable() method. When you check and uncheck components in the editor, it is actually calling these commands in your dungeon file (Dungeon.lua).

So you can call this in a script to turn off a monster's brain for example:
trickster_1.brain:disable()
Granamir
Posts: 202
Joined: Wed Jan 07, 2015 7:19 pm

Re: Enabling/disabling monster components

Post by Granamir »

MrChoke wrote:
Granamir wrote:Hi eveyone,
trying to hold a monster so he can't attack and move but can do everything else. It's easy to do from editor but i also have to change these settings via script.
Anyone has a clue on how to do to enable/disable (via script) monster components such as: model, move, turn, attacks, summon, etc.?
Ty
All components have a disable() enable() method. When you check and uncheck components in the editor, it is actually calling these commands in your dungeon file (Dungeon.lua).

So you can call this in a script to turn off a monster's brain for example:
trickster_1.brain:disable()
Works great.
Thank you.
Post Reply