Question concerning setHp

Scripting help, tricks, and tips. How to use the editor.
Post Reply
KittyBeast
Posts: 22
Joined: Sat Jun 09, 2012 2:42 am
Location: Norway

Question concerning setHp

Post by KittyBeast »

I've had a question for a while regarding setHp on parts with parents.

I did a quick test in the editor recently, and found that if I set part 1, connected to part 0 (the core) and part 2 (connected to part 1) to 0 hp, they both get destroyed with a single shot if I shoot part 1.

However, if I set the hp of part 1 and part 2 to 1 hp, then part 1 (with part 2 connected to it) will take 13 shots to destroy, meanwhile, part 2 will take 1 shot to destroy.

This pattern continues: with 2 hp, part 1 will take 23 hits to destroy, while part 2 still only takes 1 shot. With 3 hp, part 1 will take 33 hits to destroy, and part 2 will only take 1 shot to destroy.

Until part 2 gets 10 hp, it will be 1 shot, while part 1 seems to have over 100 times as much hp. How come this is the case? Does anyone have an answer for this?

I've been wanting to change the hp of parent parts but the result is so dramatic that I have to un-parent the parts, and connect them to the core, then change the hp of the part so it doesn't get any bonus hp for being a parent.
Last edited by KittyBeast on Fri Jan 04, 2019 11:41 pm, edited 1 time in total.
KittyBeast
Posts: 22
Joined: Sat Jun 09, 2012 2:42 am
Location: Norway

Re: Question concerning setHp

Post by KittyBeast »

It almost seems like the parent part is supposed to get an additional 30% health increase for being a parent, but that it's been miscalculated and gotten 100x more health and then the bonus 30% for being a parent of one part. I might be very off here, just an assumption!
KittyBeast
Posts: 22
Joined: Sat Jun 09, 2012 2:42 am
Location: Norway

Re: Question concerning setHp

Post by KittyBeast »

I've done another quick test and found that the 100x health scaling only happens to the first parent of a child part. Example: I connected part 1 to part 2, part 2 to part 3, part 3 to part 4 and part 4 to part 0 (the core). I set each part (excluding the core) to 1 hp and this is the result:

Part 1 dies in 1 shot (up till it gets 10 hp)
part 2 dies in 13 shots (100x + 30% more than part 1)
part 3 dies in 16 shots ((flat +30% from part 2's base 100x boost?) increase for being a parent)
part 4 dies in 19 shots ((flat +30% from part 2's base 100x boost?)increase for being a parent to part 3)

Interestingly, if you take the same setup and change part 3, 2 and 1's hp to 0, whilst keeping part 4 at 1 hp you get this odd result:

part 1 dies in 1 shot
part 2 dies in 2 shots
part 3 dies in 4 shots
part 4 dies in 19 shots

Using makeTrigger,time,1,setHp,(hp),(part) seems to be a fix to this. I read it in a post here when MD first released the update with these commands, however. It looks like 1000 hp = 10 shots to take down if you do it this way. When you set hp like this, you also ignore any parent part health scaling so if you execute this command:

makeTrigger,time,1,setHp,1000,1,2,3,4
with the same set up as the previous two examples you get this result:

part 1 dies in 10 shots
part 2 dies in 10 shots
part 3 dies in 10 shots
part 4 dies in 10 shots

This stays true no matter what part you use it on, even the core dies in 10 shots.

I'm still curious why setHp doesnt work by itself though, wonder if I'll get an answer!
Post Reply