First I must say: this mod is really cool. I hate realism ( Read: all n00bs use machineguns a and snipes full auto from the other side of the map, sure its realistic, but I want to have fun

), but this is the kind of realism that adds... ehh...
realism... without destroying the original game ( that is rather fun from the beginning ).
Now the code: I re-worked it and tested it. Works fine when I tested it alone on the server. Also worked fine to restart it.
Code: Select all
main:
// I changed here
waitthread init
level waittill spawn
thread dm_view
end
init:
// ...and here
level.view_p = 0
level.view_y = 0
level.view_p_mid = 0
level.view_y_mid = 0
level.view_p_high = 0
level.view_y_high = 0
level.view_toggle_p = -0.001
level.view_toggle_y = -0.001
end
dm_view:
local.pitch_max = 0.035
local.pitch_jitter = 0.0012
local.yaw_max = 0.01
local.yaw_jitter = 0.0006
while (1) {
wait 0.02
if(level.view_p > local.pitch_max) {
level.view_toggle_p = -local.pitch_jitter
} else {
if(level.view_p < -local.pitch_max) {
level.view_toggle_p = local.pitch_jitter
}
}
if(level.view_y > local.yaw_max) {
level.view_toggle_y = -local.yaw_jitter
} else {
if(level.view_y < -local.yaw_max) {
level.view_toggle_y = local.yaw_jitter
}
}
level.view_p += level.view_toggle_p
level.view_y += level.view_toggle_y
level.view_p_mid += level.view_toggle_p * 1.5
level.view_y_mid += level.view_toggle_y * 1.5
level.view_p_high += level.view_toggle_p * 2.5
level.view_y_high += level.view_toggle_y * 2.5
// And I changed the loop test tere
for (local.playerno = 1 ; local.playerno <= $player.size ; local.playerno++) {
if($player[local.playerno].health > 50) {
$player[local.playerno].viewangles = $player[local.playerno].viewangles + (level.view_p level.view_y 0)
} else {
if($player[local.playerno].health <= 50 && $player[local.playerno].health > 15) {
$player[local.playerno].viewangles = $player[local.playerno].viewangles + (level.view_p_mid level.view_y_mid 0)
} else {
if($player[local.playerno].health <= 15) {
$player[local.playerno].viewangles = $player[local.playerno].viewangles + (level.view_p_high level.view_y_high 0)
}
}
}
}
}
end
...I think you just out smarted yourself with that
if clause in the main and check methods
GREAT stuff man!
PS: I think a soldier with less than 15 health should bob a little more... he IS practically dead you know...
