~Basic Scripting and Editor Help(Easy Scripting Updated!)

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
zeltak
Posts: 119
Joined: Fri May 04, 2012 2:33 am

Re: ~Basic Scripting and Editor Help(Easy Scripting Updated!

Post by zeltak »

On the teleporter problem: I found out that I can enable/disable all the components separately.. it works, but takes more work. But I was so accustomed to the LoG1 -style easy mode :roll:
User avatar
Lark
Posts: 178
Joined: Wed Sep 19, 2012 4:23 pm
Location: Springfield, MO USA

Re: ~Basic Scripting and Editor Help(Easy Scripting Updated!

Post by Lark »

Okay, Zeltak, it's pretty easy and I learned from your question, thank you!

All of the components of an object can be enabled or disabled at will. So the structure is <object name>.<component>:enable()/disable(). So if you want the teleporter there, but not working, you can place it, uncheck at least "particle", "light", "sound", and "teleporter". You can then enable/disable them as you wish using this, for example:

Code: Select all

function activateTeleporter()
  teleporter_1.teleporter:enable()
  teleporter_1.particle:enable()
  teleporter_1.sound:enable()
  teleporter_1.light:enable()
  end
User avatar
Komag
Posts: 3658
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: ~Basic Scripting and Editor Help(Easy Scripting Updated!

Post by Komag »

You could probably do something like

Code: Select all

for each i in teleporter_1 do
  i:enable
end for
Finished Dungeons - complete mods to play
User avatar
petri
Posts: 1917
Joined: Thu Mar 01, 2012 4:58 pm
Location: Finland

Re: ~Basic Scripting and Editor Help(Easy Scripting Updated!

Post by petri »

A better way is to use the controller:

Code: Select all

teleport_1.controller:activate()
teleport_1.controller:deactivate()
teleport_1.controller:toggle()
User avatar
zeltak
Posts: 119
Joined: Fri May 04, 2012 2:33 am

Re: ~Basic Scripting and Editor Help(Easy Scripting Updated!

Post by zeltak »

Thanks, I was sure that I dabbled with the controller, but apparently not. That makes everything easy.
Post Reply