Help with a Script, Please

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
moonax
Posts: 7
Joined: Thu Jan 29, 2015 10:16 am

Help with a Script, Please

Post by moonax »

Hi,
I'm having trouble with a script that says it returns a nil value and I'm not sure why. Similar scripts have worked elsewhere. Any ideas?

function checkItems(alcove)

if alcove.contents("rock")
then teleporter_3:activate()
else
teleporter_3:deactivate()
end
end

Thanks!
User avatar
Skuggasveinn
Posts: 562
Joined: Wed Sep 26, 2012 5:28 pm

Re: Help with a Script, Please

Post by Skuggasveinn »

I think you need to define what part of the teleporter you are activating, that is the nil value you are getting.

Code: Select all

function checkItems(alcove)
if alcove.contents("rock")
then teleporter_3.controller:activate()
else
teleporter_3.controller:deactivate()
end
end
Link to all my LoG 2 assets on Nexus.
Link to all my LoG 1 assets on Nexus.
moonax
Posts: 7
Joined: Thu Jan 29, 2015 10:16 am

Re: Help with a Script, Please

Post by moonax »

Thanks for the reply Skuggasveinn.

How would I define the part of the teleporter I'm using. I've set a target, and I'm not using spin. Is there something more?
Sorry, I'm new to scripting and modding.
User avatar
msyblade
Posts: 792
Joined: Fri Oct 12, 2012 4:40 am
Location: New Mexico, USA
Contact:

Re: Help with a Script, Please

Post by msyblade »

Look at Skuggs code. It has

"then teleporter_3.controller:activate()"

that's the "part"
Currently conspiring with many modders on the "Legends of the Northern Realms"project.

"You have been captured by a psychopathic diety who needs a new plaything to torture."
Hotel Hades
moonax
Posts: 7
Joined: Thu Jan 29, 2015 10:16 am

Re: Help with a Script, Please

Post by moonax »

Ah, thanks. For some reason I missed seeing that bit. That works!

Thank you very much! [Sorry for my blindness]
Post Reply