Page 1 of 1

Making Breakable Objects not Breakable

Posted: Sun Nov 09, 2014 8:14 pm
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.

Re: Making Breakable Objects not Breakable

Posted: Sun Nov 09, 2014 9:25 pm
by GoldenShadowGS
just put this in a script entity:

Code: Select all

cattail1.health:setInvulnerable(true)
change "cattail1" to match the name.

Re: Making Breakable Objects not Breakable

Posted: Mon Nov 10, 2014 3:15 am
by Baddock
Wont that make all Cattail entities invulnerable though? What if I want some to still be damaged as normal?

Re: Making Breakable Objects not Breakable

Posted: Mon Nov 10, 2014 3:45 am
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.