Uninit variable

Have questions about CoD2 mapping that aren't covered in the tutorials section? Post here!

Moderator: Core Staff

Post Reply
User avatar
Rezil
Core Staff
Core Staff
Posts: 2030
Joined: July 24th, 2006, 11:21 am
Location: Cramped in a small cubicle/making another jump map

Uninit variable

Post by Rezil » November 2nd, 2010, 7:18 pm

Code: Select all

func()
{
	num_origins = 5;
	for(i=0;i<=num_origins;i++) o[i] = getent("whatever"+i,"targetname");
	t = getent("whatever_trig","targetname");
	
	for(;;)
	{
		t waittill("trigger", user);
		
		user setorigin(o[0].origin);
		user setplayerangles(o[0].angles);
	}
}
Why does this give me an 'uninitialized variable o' error?
Drofder2004: Drofder's rules for reviewing a map
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.

IzNoGoD
CJ Worshipper
CJ Worshipper
Posts: 343
Joined: January 6th, 2009, 8:39 pm
Location: Netherlands/Holland

Re: Uninit variable

Post by IzNoGoD » November 2nd, 2010, 8:09 pm

It most likely errors on the user setorigin(o[0].origin); correct?
This is because cod is stupid and thinks it can skip for() loops on compilecheck.
Make o=[]; before that loop and you're fine
LMGTFY!

Its not a glitch... Its the future!

User avatar
Rezil
Core Staff
Core Staff
Posts: 2030
Joined: July 24th, 2006, 11:21 am
Location: Cramped in a small cubicle/making another jump map

Re: Uninit variable

Post by Rezil » November 2nd, 2010, 8:13 pm

Ah yeah, forgot that. Thanks.
Drofder2004: Drofder's rules for reviewing a map
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests