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.
Making Breakable Objects not Breakable
-
- Posts: 168
- Joined: Thu Oct 30, 2014 1:56 am
Re: Making Breakable Objects not Breakable
just put this in a script entity:
change "cattail1" to match the name.
Code: Select all
cattail1.health:setInvulnerable(true)
Re: Making Breakable Objects not Breakable
Wont that make all Cattail entities invulnerable though? What if I want some to still be damaged as normal?
-
- Posts: 168
- Joined: Thu Oct 30, 2014 1:56 am
Re: Making Breakable Objects not Breakable
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:
or use a for loop to add lots without needing to type so much.
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.
Code: Select all
cattail1.health:setInvulnerable(true)
cattail2.health:setInvulnerable(true)
cattail3.health:setInvulnerable(true)
Code: Select all
for i = 1,8 do
local ct = findEntity("cattail"..i)
ct.health:setInvulnerable(true)
end
Only the ones with those names will be affected.