scrpting format

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
MaxInfinity
Posts: 3
Joined: Sat Jan 07, 2017 12:46 am

scrpting format

Post 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
User avatar
THOM
Posts: 1281
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: scrpting format

Post 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.
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
MaxInfinity
Posts: 3
Joined: Sat Jan 07, 2017 12:46 am

Re: scrpting format

Post by MaxInfinity »

Thanx THOM

so any componet will be enable/disable and controllers will be activate/deactivate etc
User avatar
THOM
Posts: 1281
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: scrpting format

Post 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...
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
MaxInfinity
Posts: 3
Joined: Sat Jan 07, 2017 12:46 am

Re: scrpting format

Post 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
Post Reply