Teardown
Destructible robots
H3xx 2024 年 4 月 6 日 上午 2:50
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?
< >
正在显示第 1 - 2 条,共 2 条留言
DrunkenOrca 2024 年 5 月 20 日 下午 5:41 
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
最后由 DrunkenOrca 编辑于; 2024 年 5 月 20 日 下午 6:18
DrunkenOrca 2024 年 5 月 20 日 下午 6:17 
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
最后由 DrunkenOrca 编辑于; 2024 年 5 月 20 日 下午 6:34
< >
正在显示第 1 - 2 条,共 2 条留言
每页显示数: 1530 50