cloneObject for LoG2 (update: modifyObjects)

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
cromcrom
Posts: 549
Joined: Tue Sep 11, 2012 7:16 am
Location: Chateauroux in a socialist s#!$*&% formerly known as "France"

Re: cloneObject for LoG2

Post by cromcrom »

Hi JKos, it seems that

Code: Select all

cloneObject{ name = "crom_iron_ore",
   baseObject = "rock",
   components = {
   
		{
			class ="Item",
			uiName = "Iron ore",
			weight = 0.8,
			description = "Iron Ore. Used in crafting."
		},
   }   
 } 

 cloneObject{ name = "crom_iron_chunks",
   baseObject = "ore",
   components = {
		{
			class ="Item",
			uiName = "Iron chunks",
			weight = 0.4,
			description = "Bits of iron ore. Used in crafting."
		},
   }   
 }  

only returns iron_chunks. I would like to create both iron or and iron chunks, both cloning the rock model.
A trip of a thousand leagues starts with a step.
User avatar
JKos
Posts: 464
Joined: Wed Sep 12, 2012 10:03 pm
Location: Finland
Contact:

Re: cloneObject for LoG2

Post by JKos »

You have defined ore as a baseObject of the crom_iron_chunks. Maybe you should change it to rock?

Code: Select all

    cloneObject{ name = "crom_iron_ore",
       baseObject = "rock",
       components = {
       
          {
             class ="Item",
             uiName = "Iron ore",
             weight = 0.8,
             description = "Iron Ore. Used in crafting."
          },
       }   
     }

     cloneObject{ name = "crom_iron_chunks",
     baseObject = "rock",
       components = {
          {
             class ="Item",
             uiName = "Iron chunks",
             weight = 0.4,
             description = "Bits of iron ore. Used in crafting."
          },
       }   
     } 



- LoG Framework 2http://sites.google.com/site/jkoslog2 Define hooks in runtime by entity.name or entity.id + multiple hooks support.
- cloneObject viewtopic.php?f=22&t=8450
User avatar
cromcrom
Posts: 549
Joined: Tue Sep 11, 2012 7:16 am
Location: Chateauroux in a socialist s#!$*&% formerly known as "France"

Re: cloneObject for LoG2

Post by cromcrom »

Thanks JKos, this ore stuff was a mistake. Cloning both items to rock still returns iron chunks instead of iron ore.

When I put the iron ore cloned object below the chunks, the chunks are ore. So maybe your script overrides the prvious item clones, and only keep the last one ?
A trip of a thousand leagues starts with a step.
User avatar
JKos
Posts: 464
Joined: Wed Sep 12, 2012 10:03 pm
Location: Finland
Contact:

Re: cloneObject for LoG2

Post by JKos »

Ok, I tested it and now I understand what you mean, this seems to be a bug in cloneObject, I'll try to fix it.
- LoG Framework 2http://sites.google.com/site/jkoslog2 Define hooks in runtime by entity.name or entity.id + multiple hooks support.
- cloneObject viewtopic.php?f=22&t=8450
User avatar
JKos
Posts: 464
Joined: Wed Sep 12, 2012 10:03 pm
Location: Finland
Contact:

Re: cloneObject for LoG2

Post by JKos »

Yeah, it's confirmed that cloneObject has a pretty serious bug. Sorry about that to everyone, but I will fix it.
- LoG Framework 2http://sites.google.com/site/jkoslog2 Define hooks in runtime by entity.name or entity.id + multiple hooks support.
- cloneObject viewtopic.php?f=22&t=8450
User avatar
cromcrom
Posts: 549
Joined: Tue Sep 11, 2012 7:16 am
Location: Chateauroux in a socialist s#!$*&% formerly known as "France"

Re: cloneObject for LoG2

Post by cromcrom »

Thank you so much for taking the time to test. I am glad I helped find a bug :-)
Take care :-)
A trip of a thousand leagues starts with a step.
User avatar
JKos
Posts: 464
Joined: Wed Sep 12, 2012 10:03 pm
Location: Finland
Contact:

Re: cloneObject for LoG2 (important bug fix 31.11)

Post by JKos »

Ok, I fixed it, let's hope that there is no more bugs :)
- LoG Framework 2http://sites.google.com/site/jkoslog2 Define hooks in runtime by entity.name or entity.id + multiple hooks support.
- cloneObject viewtopic.php?f=22&t=8450
User avatar
Aisuu
Posts: 61
Joined: Fri Oct 31, 2014 2:07 pm

Re: cloneObject for LoG2 (important bug fix 30.11)

Post by Aisuu »

After update it give me this error: :cry:
clone_object.lua:46: bad argument #1 to 'insert' (table expected, got nil)
User avatar
cromcrom
Posts: 549
Joined: Tue Sep 11, 2012 7:16 am
Location: Chateauroux in a socialist s#!$*&% formerly known as "France"

Re: cloneObject for LoG2 (important bug fix 30.11)

Post by cromcrom »

same here, it seems that

Code: Select all

if component.name == name or string.lower(component.class) == name then
the component.class returns nil

line 24
A trip of a thousand leagues starts with a step.
User avatar
JKos
Posts: 464
Joined: Wed Sep 12, 2012 10:03 pm
Location: Finland
Contact:

Re: cloneObject for LoG2 (important bug fix 30.11)

Post by JKos »

Ok, I made a bugfix for the bugfix, maybe it works now? :mrgreen:
- LoG Framework 2http://sites.google.com/site/jkoslog2 Define hooks in runtime by entity.name or entity.id + multiple hooks support.
- cloneObject viewtopic.php?f=22&t=8450
Post Reply