HELP!!, PLZ!!

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
MrOblongo
Lance Corporal
Posts: 15
Joined: Thu Aug 21, 2003 12:35 am

HELP!!, PLZ!!

Post 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 :? .
User avatar
Alcoholic
General
Posts: 1470
Joined: Sat May 17, 2003 5:57 am
Location: California
Contact:

Post by Alcoholic »

Are you testing this by yourself? Because that usually means $player #2 doesn't exist. :(
MrOblongo
Lance Corporal
Posts: 15
Joined: Thu Aug 21, 2003 12:35 am

Post by MrOblongo »

That appear when i host alone and when i host with people
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

Script

Post by tltrude »

Please post the script.
Tom Trude,

Image
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

! =

should be

!=

And add a final ) :wink:

Easier:
for(local.playerno = 1; local.playerno <= $player.size; local.playerno++)
Image
MrOblongo
Lance Corporal
Posts: 15
Joined: Thu Aug 21, 2003 12:35 am

Post 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
User avatar
Alcoholic
General
Posts: 1470
Joined: Sat May 17, 2003 5:57 am
Location: California
Contact:

Post 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. :)
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post 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:
Admin .MAP Forums
Image
Head above heels.
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post 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
Admin .MAP Forums
Image
Head above heels.
MrOblongo
Lance Corporal
Posts: 15
Joined: Thu Aug 21, 2003 12:35 am

Post 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-) .
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

MrOblongo wrote:RIKUSYO!!
Well OK, but you are still welcome :wink:
Admin .MAP Forums
Image
Head above heels.
Post Reply