Page 1 of 1

HELP!!, PLZ!!

Posted: Thu Aug 21, 2003 12:39 am
by MrOblongo
Hello all im new here :lol:

I came here cos i need help and someone told me that here are the best modders

Here is my error, i got this in console:
Script Error: array index 2 out of range
for (local.playerno = 1;$player[local.playerno]! = NIL; local.playerno++ (global/view.scr, 53)
for (local.playerno = 1$player

Is part of a realism mod that make your view moves simulating breathing.
All works great, only problem is that i cant restart :? .

Posted: Thu Aug 21, 2003 2:07 am
by Alcoholic
Are you testing this by yourself? Because that usually means $player #2 doesn't exist. :(

Posted: Thu Aug 21, 2003 2:14 am
by MrOblongo
That appear when i host alone and when i host with people

Script

Posted: Thu Aug 21, 2003 3:35 am
by tltrude
Please post the script.

Posted: Thu Aug 21, 2003 6:19 pm
by jv_map
! =

should be

!=

And add a final ) :wink:

Easier:
for(local.playerno = 1; local.playerno <= $player.size; local.playerno++)

Posted: Thu Aug 21, 2003 11:16 pm
by MrOblongo
main:
if (level.already_run != 1)
{
level waittill spawn
thread check
}

end

check:
if (level.already_run != 1)
{
level.already_run = 1
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
}
else
end
thread dm_view
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

for (local.playerno = 1;$player[local.playerno] != NIL;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

Posted: Fri Aug 22, 2003 12:09 am
by Alcoholic
hey can you post it in {code} brackets? (not the curly ones, the straight ones). it would make it a lot easier for me to read. :)

Posted: Fri Aug 22, 2003 1:44 am
by Bjarne BZR
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 :cry: ), 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 :wink:

GREAT stuff man!

PS: I think a soldier with less than 15 health should bob a little more... he IS practically dead you know... :twisted:

Posted: Fri Aug 22, 2003 1:50 am
by Bjarne BZR
Oh, and welcome to .MAP by the way. :wink:
MrOblongo wrote:I came here cos i need help and someone told me that here are the best modders
You can go a long way with a little flatter. He he.
From what I've seen, I take it you have just added another one of the best modders to this forum. :D

Posted: Fri Aug 22, 2003 2:50 am
by MrOblongo
Ok, guys thx for all, BUT i didint make that script. I cant be that fag to steal a script. was made by RIKUSYO (something like that) hes japanesse. I colect realism stuff and make it work together to have an ultimate realism. believe m}, is not very easy to make all the stuff work in 1 mod (buzz goodies, realism, hudkiller, breathing effect). BUT THE GENIUS HERE IS RIKUSYO.

RIKUSYO!!
Thx for the help, i apreciate it for my crusade for mohaa realism

by the way i bird told me that someone discovered how to add weapons attached to a skin, that way u can have more than 6 weapons per side 8-) .

Posted: Fri Aug 22, 2003 3:55 am
by Bjarne BZR
MrOblongo wrote:RIKUSYO!!
Well OK, but you are still welcome :wink: