Page 1 of 1

scrpting format

Posted: Sat Jan 07, 2017 12:53 am
by MaxInfinity
H i guys im new to this and having probs with the scripting.

I have a room with torches all have particle light and sound unchecked. I want them to be lit via a script how do I activate the components

Code: Select all

function lightup1()
torch_holder_11.particle.activate()
torch_holder_11.light.activate()
torch_holder_11.sound.activate()
end
ive been reading forums and tutorials for a couple of days but just cant work it out
Thanx in advance

Re: scrpting format

Posted: Sat Jan 07, 2017 1:17 am
by THOM
components can just be enabled or disabled. So in your case it would be

torch_holder_11.particle:enable()
...

only if your obeject owns a controller-component, you can set this controller to activate:

teleporter.controller:activate()

The controller needs a script to know what to do when activated. Have a look at the Grimrock asset-pack and there at the generic-file in the objects folder. It tells a lot how this works.

Re: scrpting format

Posted: Sat Jan 07, 2017 1:47 am
by MaxInfinity
Thanx THOM

so any componet will be enable/disable and controllers will be activate/deactivate etc

Re: scrpting format

Posted: Sat Jan 07, 2017 1:54 am
by THOM
Yes. But mind than an object must have

Code: Select all

minimalSaveState = false,
to keep it's component-state after a save/reload action.

On the other hand: having too many objects with no minimalSaveState will slow down saving/reloading an can possibly crash the game during that...

Re: scrpting format

Posted: Sat Jan 07, 2017 2:22 am
by MaxInfinity
Much appreciated

How would I apply the same technique to a touch being carried by the party.
I messed around with the Torch Douser/Anti-Light Area code by lmaoBoat but had no joy with it