Teardown

Teardown

Destructible robots
H3xx 6 Apr, 2024 @ 2:50am
Making Campaign Robots destructible
I know the current system cannot override game files, but as a user, I can. Is there a way to modify the in game robots? Like the X-ray Off Mod that requires you to edit one of the lua files?
< >
Showing 1-2 of 2 comments
DrunkenOrca 20 May, 2024 @ 5:41pm 
To make robots die in pain for all their crimes change \data\script\robot.lua

At line 1811 (inside "update" function) just BEFORE this line:
robot.stunned = clamp(robot.stunned - dt, 0.0, 6.0)

Add this:
if robot.stunned > 5.0 then PlaySound(disableSound, robot.bodyCenter, 1.0, false) for i=1, #robot.allShapes do SetShapeEmissiveScale(robot.allShapes, 0)
end
SetTag(robot.body, "disabled")
robot.enabled = false
end
Last edited by DrunkenOrca; 20 May, 2024 @ 6:18pm
DrunkenOrca 20 May, 2024 @ 6:17pm 
Wachtung!
Changes posted in my previous comment may be incompatible with this mod! :D As they changing base robot class.

Script uses stunned level instead of health (i was not able to find health var for robots), so its a bit stupid way, but it will work.

To make it right :
1. Add robot.health variable with some init value (+a bit of random ;-))
2. Add health consumption in "hitByExplosion" and "hitByShot" functions
3. In "update" function do robots health check and if it is time to die then kill him the same way as in post before.
(optional) add Explosion(robot.bodyCenter, 4.0) to make his death more deadly

And after all of that .. its still possibly be incompatible with this mod :D
Last edited by DrunkenOrca; 20 May, 2024 @ 6:34pm
< >
Showing 1-2 of 2 comments
Per page: 1530 50