same error
cloneObject for LoG2 (update: modifyObjects)
- 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)
cough cough ahem, JKos ? It still doesn't
same error
same error
A trip of a thousand leagues starts with a step.
Re: cloneObject for LoG2 (important bug fix 30.11)
It seems to work for me 
Re: cloneObject for LoG2 (important bug fix 30.11)
Can you post the non working cloneObject definition? Have you defined the name or the class properties for the components?cromcrom wrote:cough cough ahem, JKos ? It still doesn't![]()
![]()
same error
- 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
- cloneObject viewtopic.php?f=22&t=8450
- 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)
here are the 2 objects I am trying to clone:
Code: Select all
cloneObject{ name = "crom_iron_chunks",
baseObject = "rock",
components = {
{
uiName = "Iron chunks",
weight = 0.4,
description = "Bits of iron ore. Used in crafting."
},
}
}
cloneObject{ name = "crom_iron_ore",
baseObject = "rock",
components = {
{
uiName = "Iron ore",
weight = 0.8,
description = "Iron Ore. Used in crafting."
},
}
} what do you mean ?Have you defined the name or the class properties for the components?
A trip of a thousand leagues starts with a step.
Re: cloneObject for LoG2 (important bug fix 30.11)
The name or the class property is required for components (just like with defineObject), without them cloneObject can't know which component it should clone from the baseObject.
So this should work.
So this should work.
Code: Select all
cloneObject{ name = "crom_iron_chunks",
baseObject = "rock",
components = {
{
uiName = "Iron chunks",
weight = 0.4,
description = "Bits of iron ore. Used in crafting.",
class="Item"
},
}
}
cloneObject{ name = "crom_iron_ore",
baseObject = "rock",
components = {
{
uiName = "Iron ore",
weight = 0.8,
description = "Iron Ore. Used in crafting.",
class="Item"
},
}
}
- 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
- cloneObject viewtopic.php?f=22&t=8450
- 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)
It perfectly works, thank you so much for your time and commitment, I am crediting you (again
) and adding this thread to TLC 2 
A trip of a thousand leagues starts with a step.
- 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)
Please, how would I disable a component from a base in a clone object (if I want to remove the meleeattack component from a branch, for example, when creating a small branch clone ?
never mind, silly stupid me, I just defined a new object
never mind, silly stupid me, I just defined a new object
A trip of a thousand leagues starts with a step.
Re: cloneObject for LoG2 (important bug fix 30.11)
Update: added modifyObjects function
Description: Modifies multiple objects filtered by component names
Example: Add meleeattack.onHitMonster hook to all objects which do have both item and meleeattack components (which means all melee weapons).
Warning: will override default values, so in this example all default onHitMonster-hooks on melee weapons will be overridden.
I will probably add more filters later, for example traits or tags could be useful.
Edit: I changed the installation method, see opening post.
Description: Modifies multiple objects filtered by component names
Example: Add meleeattack.onHitMonster hook to all objects which do have both item and meleeattack components (which means all melee weapons).
Code: Select all
modifyObjects{
filter = {
hasComponents = {'item','meleeattack'}
},
components = {
{
name = 'meleeattack',
onHitMonster = function(self, monster, tside, damage, champion)
print(champion:getName(),'hits',monster.go.id,'with',self.go.name,'from',tside,'dealing damage:',damage)
end
}
}
}
I will probably add more filters later, for example traits or tags could be useful.
Edit: I changed the installation method, see opening post.
- 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
- cloneObject viewtopic.php?f=22&t=8450
Re: cloneObject for LoG2 (update: modifyObjects)
Quite useful! Thanks!
Writer and sometimes artist of the very slightly acclaimed comic series Scrambled Circuits. A comic series about a robot written by a human.
Grimrock 2 socketSystem: viewtopic.php?f=22&t=8546 / Github
Grimrock 2 socketSystem: viewtopic.php?f=22&t=8546 / Github
Re: cloneObject for LoG2 (update: modifyObjects)
supercool, thanks !