Making Breakable Objects not Breakable

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
Baddock
Posts: 12
Joined: Tue Nov 04, 2014 8:28 pm

Making Breakable Objects not Breakable

Post by Baddock »

So I wanted to use the Cattails from the beach assets, but don't want them to be breakable. I know I can go in and add a new defined object that doesn't have a Health Class, and has no onDie actions to spawn the next version... but my question is: In the editor shouldn't I just be able to place one of the cat-tail objects and click the "Health" check box off and that would remove its health value, thusly not making it breakable? I have done this and yet it can still break them.

Anyone know if this is doable without defining another object? I know I would also later in my module use the broken creates and pots with out them being breakable in a few cases as well.
GoldenShadowGS
Posts: 168
Joined: Thu Oct 30, 2014 1:56 am

Re: Making Breakable Objects not Breakable

Post by GoldenShadowGS »

just put this in a script entity:

Code: Select all

cattail1.health:setInvulnerable(true)
change "cattail1" to match the name.
User avatar
Baddock
Posts: 12
Joined: Tue Nov 04, 2014 8:28 pm

Re: Making Breakable Objects not Breakable

Post by Baddock »

Wont that make all Cattail entities invulnerable though? What if I want some to still be damaged as normal?
GoldenShadowGS
Posts: 168
Joined: Thu Oct 30, 2014 1:56 am

Re: Making Breakable Objects not Breakable

Post by GoldenShadowGS »

It only affects the one named cattail1. if you want to do more, you would either need to copy the code several times like this:

Code: Select all

cattail1.health:setInvulnerable(true)
cattail2.health:setInvulnerable(true)
cattail3.health:setInvulnerable(true)
or use a for loop to add lots without needing to type so much.

Code: Select all

for i = 1,8 do
local ct = findEntity("cattail"..i)
ct.health:setInvulnerable(true)
end
This will find the cattails named cattail1,cattail2,catail3, etc... up to cattail8 and make them invulnerable.

Only the ones with those names will be affected.
Post Reply