Page 1 of 1

Anything wrong with this?

Posted: June 13th, 2007, 5:19 am
by Nightmare
Hey, I have been looking through this script over and over and I can't seem to find whats wrong. What I did was make a script_brushmodel and I want to make it move according to an integer. "level.frogger_s1" is the speed, and for some reason, the script_brushmodel just stays in the same place. If anyone can find out whats wrong with this, it would be much appreciated.

Code: Select all

main()
{
	setCullFog (0, 13500, .32, .36, .40, 0);	
	maps\mp\_load::main();

	thread nm_frogger_1();

	level.frogger_s1 = 20;
}

nm_frogger_1() 
{ 
c1 = getent ("nm_frogger_1_1","targetname");
while(1)
{
c1 moveX (2440,level.frogger_s1,0,0);
c1 waittill ("movedone");
wait 0.05;
c1 hide();
c1 moveX (-2440,0.05,0,0);
c1 waittill ("movedone");
c1 show();
}
}

Posted: June 13th, 2007, 5:43 am
by Drofder2004
Script look fine to me (although I can already start to imagine the repetitiveness...)
Anyway, a few things to check are that the script is being run...

Code: Select all

nm_frogger_1()
{

iprintln("Thread Running");

c1 = getent ("nm_frogger_1_1","targetname");
while(1)
{

iprintln("While running");

c1 moveX (2440,level.frogger_s1,0,0);
c1 waittill ("movedone");
wait 0.05;
c1 hide();
c1 moveX (-2440,0.05,0,0);
c1 waittill ("movedone");
c1 show();
}
}
the other thing is to check how many entities you have, there is a limit not sure what it is for CoD1, possibly 1024).

Its pretty obvious by the variable name what you are attempting and I am seriously going to suggest that you consider using an array, this will cut down on so much scripting and potential problems.

GL.

Posted: June 13th, 2007, 6:00 am
by Nightmare
This would be a lot more effective if you could get on msn drofder, but anyway.

Yes the thread runs and I even made it tell the speed to make sure it was right, it also moves if I do simply

Code: Select all

c1 moveX (2440,20,0,0);
It just doesn't seem to be able to move with the variable, any other ideas?

Full script:

Code: Select all

main()
{
	setCullFog (0, 13500, .32, .36, .40, 0);	
	maps\mp\_load::main();

	thread nm_frogger_1();
	thread nm_frogger_2();
	thread nm_frogger_3();
	thread nm_frogger_4();
	thread nm_frogger_5();
	thread nm_frogger_k();
	thread nm_frogger_r();
	thread nm_frogger_l1();
	thread nm_frogger_l2();
	thread nm_frogger_l3();
	thread nm_frogger_l4();
	thread nm_frogger_l5();
	thread nm_frogger_check();
	thread nm_frogger_e();

	level.frogger_s1 = 20;
	level.frogger_s2 = 14;
	level.frogger_s3 = 30;
	level.frogger_s4 = 25;
	level.frogger_s5 = 27;
	level.frogger_level = 1;
}

nm_frogger_1() 
{ 
c1 = getent ("nm_frogger_1_1","targetname");
c2 = getent ("nm_frogger_1_2","targetname");
c3 = getent ("nm_frogger_1_3","targetname");
while(1)
{
c1 moveX (2440,level.frogger_s1,0,0);
c2 moveX (2440,level.frogger_s1,0,0);
c3 moveX (2440,level.frogger_s1,0,0);
c1 waittill ("movedone");
wait 0.05;
c1 hide();
c2 hide();
c3 hide();
c1 moveX (-2440,0.05,0,0);
c2 moveX (-2440,0.05,0,0);
c3 moveX (-2440,0.05,0,0);
c1 waittill ("movedone");
c1 show();
c2 show();
c3 show();
}
}

nm_frogger_2() 
{ 
c1 = getent ("nm_frogger_2_1","targetname");
c2 = getent ("nm_frogger_2_2","targetname");
while(1)
{
c1 moveX (1880,level.frogger_s2,0,0);
c2 moveX (1880,level.frogger_s2,0,0);
c1 waittill ("movedone");
wait 0.05;
c1 hide();
c2 hide();
c1 moveX (-1880,0.05,0,0);
c2 moveX (-1880,0.05,0,0);
c1 waittill ("movedone");
c1 show();
c2 show();
}
}

nm_frogger_3() 
{ 
c1 = getent ("nm_frogger_3_1","targetname");
c2 = getent ("nm_frogger_3_2","targetname");
while(1)
{
c1 moveX (2520,level.frogger_s3,0,0);
c2 moveX (2520,level.frogger_s3,0,0);
c1 waittill ("movedone");
wait 0.05;
c1 hide();
c2 hide();
c1 moveX (-2520,0.05,0,0);
c2 moveX (-2520,0.05,0,0);
c1 waittill ("movedone");
c1 show();
c2 show();
}
}

nm_frogger_4() 
{ 
c1 = getent ("nm_frogger_4_1","targetname");
c2 = getent ("nm_frogger_4_2","targetname");
c3 = getent ("nm_frogger_4_3","targetname");
c4 = getent ("nm_frogger_4_4","targetname");
while(1)
{
c1 moveX (-2712,level.frogger_s4,0,0);
c2 moveX (-2712,level.frogger_s4,0,0);
c3 moveX (-2712,level.frogger_s4,0,0);
c4 moveX (-2712,level.frogger_s4,0,0);
c1 waittill ("movedone");
wait 0.05;
c1 hide();
c2 hide();
c3 hide();
c4 hide();
c1 moveX (2712,0.05,0,0);
c2 moveX (2712,0.05,0,0);
c3 moveX (2712,0.05,0,0);
c4 moveX (2712,0.05,0,0);
c1 waittill ("movedone");
c1 show();
c2 show();
c3 show();
c4 show();
}
}

nm_frogger_5() 
{ 
c1 = getent ("nm_frogger_5_1","targetname");
c2 = getent ("nm_frogger_5_2","targetname");
c3 = getent ("nm_frogger_5_3","targetname");
while(1)
{
c1 moveX (-2440,level.frogger_s5,0,0);
c2 moveX (-2440,level.frogger_s5,0,0);
c3 moveX (-2440,level.frogger_s5,0,0);
c1 waittill ("movedone");
wait 0.05;
c1 hide();
c2 hide();
c3 hide();
c1 moveX (2440,0.05,0,0);
c2 moveX (2440,0.05,0,0);
c3 moveX (2440,0.05,0,0);
c1 waittill ("movedone");
c1 show();
c2 show();
c3 show();
}
}

nm_frogger_k()
{
c1 = getent ("nm_frogger_1_1","targetname");
c2 = getent ("nm_frogger_1_2","targetname");
c3 = getent ("nm_frogger_1_3","targetname");
c4 = getent ("nm_frogger_2_1","targetname");
c5 = getent ("nm_frogger_2_2","targetname");
c6 = getent ("nm_frogger_3_1","targetname");
c7 = getent ("nm_frogger_3_2","targetname");
c8 = getent ("nm_frogger_4_1","targetname");
c9 = getent ("nm_frogger_4_2","targetname");
c10 = getent ("nm_frogger_4_3","targetname");
c11 = getent ("nm_frogger_4_4","targetname");
c12 = getent ("nm_frogger_5_1","targetname");
c13 = getent ("nm_frogger_5_2","targetname");
c14 = getent ("nm_frogger_5_3","targetname");
z = getent ("nm_frogger_z","targetname");
while (1)
{
z waittill ("trigger",user);
if (user istouching((c1)||(c2)||(c3)||(c4)||(c5)||(c6)||(c7)||(c8)||(c9)||(c10)||(c11)||(c12)||(c13)||(c14)))
	{
	user suicide();
	wait 5;
	}
wait 0.05;
}
}

nm_frogger_r()
{
t = getent ("nm_frogger_r","targetname");
while (1)
{
t waittill ("trigger",user);
user suicide();
wait 5;
}
wait 0.05;
}

nm_frogger_l1() 
{ 
l = getent ("nm_frogger_l1","targetname");
while(1)
{
l moveX (1704,27,0,0);
l waittill ("movedone");
wait 0.05;
l hide();
l moveX (-1704,0.05,0,0);
l waittill ("movedone");
l show();
}
}

nm_frogger_l2() 
{ 
l = getent ("nm_frogger_l2","targetname");
while(1)
{
l moveX (-1752,25,0,0);
l waittill ("movedone");
wait 0.05;
l hide();
l moveX (1752,0.05,0,0);
l waittill ("movedone");
l show();
}
}

nm_frogger_l3() 
{ 
l = getent ("nm_frogger_l3","targetname");
while(1)
{
l moveX (1800,30,0,0);
l waittill ("movedone");
wait 0.05;
l hide();
l moveX (-1800,0.05,0,0);
l waittill ("movedone");
l show();
}
}

nm_frogger_l4() 
{ 
l = getent ("nm_frogger_l4","targetname");
while(1)
{
l moveX (-1872,14,0,0);
l waittill ("movedone");
wait 0.05;
l hide();
l moveX (1872,0.05,0,0);
l waittill ("movedone");
l show();
}
}

nm_frogger_l5() 
{ 
l = getent ("nm_frogger_l5","targetname");
while(1)
{
l moveX (1872,20,0,0);
l waittill ("movedone");
wait 0.05;
l hide();
l moveX (-1872,0.05,0,0);
l waittill ("movedone");
l show();
}
}

nm_frogger_e()
{
trigger = getent("nm_frogger_e","targetname");
while(1)
{
	trigger waittill("trigger",user);
	wait 1;
	iprintln(user.name+" ^7finished level "+level.frogger_level+"!");
	iprintln("Speed 1: "+level.frogger_s1+"!");
	iprintln("Speed 2: "+level.frogger_s2+"!");
	iprintln("Speed 3: "+level.frogger_s3+"!");
	iprintln("Speed 4: "+level.frogger_s4+"!");
	iprintln("Speed 5: "+level.frogger_s5+"!");
	wait 3;
	level.frogger_s1--;
	level.frogger_s2--;
	level.frogger_s3--;
	level.frogger_s4--;
	level.frogger_s5--;
	level.frogger_level++;
	iprintln("Level "+level.frogger_level+"!");
      	user setOrigin((-128, -480,8));
	wait 2;
}
}
Yes I know, I should have made these arrays...

Posted: June 13th, 2007, 8:16 pm
by Drofder2004
You are calling your thread BEFORE you set your variables.

Try reaarange your main thread and put your "level.Variable" at the top before the threads.

Posted: June 15th, 2007, 1:34 am
by Nightmare
D'oh

Of course, stupid me. Thanks again drofder :D

Posted: June 15th, 2007, 10:34 am
by Drofder2004
No probs..