Cloning

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
User avatar
Kuro01
Posts: 36
Joined: Tue Jun 23, 2015 2:05 pm

Cloning

Post by Kuro01 »

Hello there, I been having trouble with (cloneObject), I heard there might be a bug but not certain. Cloning was easy for me in LGR1 but nat as in 2. I been trying this but get an error
'cloneObject" (a nil value). I been using defineObject at the moment just to get it to work.

Here's what I have so far maybe someone can help.

cloneObject{ name = "test_rock",
baseObject = "rock",
components = {
{
uiName = "Test Rock",
weight = 0.4,
description = "This is a test."
},
}
}
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: Cloning

Post by minmay »

There is no cloneObject function in Grimrock 2. Instead the functionality is rolled into defineObject. Just include the baseObject field in your defineObject table; you'll get the same behaviour as LoG1's cloneObject, and additionally all components in the baseObject will be added to the new object (except for any that you overwrite by defining new components with the same name). There are plentiful examples in the asset pack.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
User avatar
Kuro01
Posts: 36
Joined: Tue Jun 23, 2015 2:05 pm

Re: Cloning

Post by Kuro01 »

Thanks
Azel
Posts: 808
Joined: Thu Nov 06, 2014 10:40 pm

Re: Cloning

Post by Azel »

Kuro01 wrote:Hello there, I been having trouble with (cloneObject), I heard there might be a bug but not certain. Cloning was easy for me in LGR1 but nat as in 2. I been trying this but get an error
'cloneObject" (a nil value). I been using defineObject at the moment just to get it to work.
I use the JKos clone script: viewtopic.php?f=22&t=8450

Clean and easy :mrgreen:
Post Reply