Page 1 of 1

please help i cant see whats wrong with this script

Posted: October 14th, 2007, 4:51 pm
by Deadly
i cant see whats wrong it says script runtime error line 1 and line 55 =[ i marked line 55 for so its easier for you guys to see

Code: Select all

main()
{
 	maps\mp\_load::main();
thread dd_onspawn();
thread glass_break_01();
thread glass_break_02();
thread glass_break_03();
thread glass_break_04();
thread precacheFX();

game["allies"] = "american";
	game["axis"] = "german";

	game["american_soldiertype"] = "airborne";
	game["american_soldiervariation"] = "normal";
	game["german_soldiertype"] = "fallschirmjagergrey";
	game["german_soldiervariation"] = "normal";

	game["attackers"] = "allies";
	game["defenders"] = "axis";


}


dd_onSpawn()
{
   trig = getent("dd_arena_trig","targetname");

   for(;;)
   {
      trig waittill("trigger", other);
      other thread xarena_onPlayerSpawned();
      wait 0.05;
   }
}

xarena_onPlayerSpawned()
{
      self takeAllWeapons();
      wait 0.05;
}

glass_break_01()
{
glass_01 = getent("glass_01","targetname");
trig_glass_01 = getent("trig_glass_01","targetname");

dmg_01 = 0;
hp_01 = 120; // this is the amount of damage the glass needs to break

while(dmg_01 < hp_01)

{
   trig_glass_01 waittill ("damage", idmg); // LINE 55!!!!
   dmg_01 += idmg;
   if (dmg_01 >= hp_01)
      {
      glass_01 delete();
      trig_glass_01 delete();
      }
}
}

glass_break_02()
{
glass_02 = getent("glass_02","targetname");
trig_glass_02 = getent("trig_glass_02","targetname");

dmg_02 = 0;
hp_02 = 120; // this is the amount of damage the glass needs to break

while(dmg_02 < hp_02)

{
   trig_glass_02 waittill ("damage", idmg);
   dmg_02 += idmg;
   if (dmg_02 >= hp_02)
      {
      glass_02 delete();
      trig_glass_02 delete();
      }
}
}

glass_break_03()
{
glass_03 = getent("glass_03","targetname");
trig_glass_03 = getent("trig_glass_03","targetname");

dmg_03 = 0;
hp_03 = 120; // this is the amount of damage the glass needs to break

while(dmg_03 < hp_03)

{
   trig_glass_03 waittill ("damage", idmg);
   dmg_03 += idmg;
   if (dmg_03 >= hp_03)
      {
      glass_03 delete();
      trig_glass_03 delete();
      }
}
}

glass_break_04()
{
glass_04 = getent("glass_04","targetname");
trig_glass_04 = getent("trig_glass_04","targetname");

dmg_04 = 0;
hp_04 = 120; // this is the amount of damage the glass needs to break

while(dmg_04 < hp_04)

{
   trig_glass_04 waittill ("damage", idmg);
   dmg_04 += idmg;
   if (dmg_04 >= hp_04)
      {
      glass_04 delete();
      trig_glass_04 delete();
      }
}
}

precacheFX()
{

	level._effect["tigertankexplosion"]	= loadfx("fx/explosions/explosion1_nolight.efx");
	level._effect["fueltank"]		= loadfx("fx/explosions/fueltank_ned.efx");
	level._effect["wood_close"]		= loadfx ("fx/cannon/wood_close.efx");
    	level._effect["wood"]			= loadfx ("fx/cannon/wood.efx");
    	level._effect["dust"]			= loadfx ("fx/cannon/dust.efx");
    	level._effect["dirt"]			= loadfx ("fx/cannon/dirt.efx");
}
PLEASE HELP!!

Posted: October 14th, 2007, 5:00 pm
by Pedsdude
What's the exact error? /developer 1

Posted: October 14th, 2007, 6:03 pm
by Deadly
it says undefined is not an object
called from line 55
trig_glass_01 waittill ("damage", idmg); this is line 55

and also from line 1

main()
{
maps\mp\_load::main();

it says something about maps\mp\_load::main()

also line 5 thread glass_break_01(); thats just the thread its from though i think

Posted: October 14th, 2007, 7:35 pm
by Nightmare
Your targetnames are probably incorrect, check the map to make sure they match.

Posted: October 15th, 2007, 12:22 am
by Drofder2004
Nightmare wrote:Your targetnames are probably incorrect, check the map to make sure they match.
Yep, if that is not the case then make sure your script is loading the correct "getent".

Posted: October 15th, 2007, 1:11 am
by Pedsdude
OK, well one point I noticed (which may or may not be a problem, I'm not sure), is that you have 'thread dd_onspawn();' near the top, but you call it 'dd_onSpawn' (with a capital S) later.

Posted: October 15th, 2007, 1:25 am
by Deadly
very observant peds. i'll see if thats the prob but now i have a error of

it said something about getent used more than once on line 93

glass_03 = getent("glass_03","targetname"); // line 93

Posted: October 15th, 2007, 8:49 am
by Lethal323
when posting a error please provide the line that the game claims the error is on and 5 lines above and below due to the fact that it is sometimes wrong...

Posted: October 15th, 2007, 12:52 pm
by Drofder2004
Pedsdude wrote:OK, well one point I noticed (which may or may not be a problem, I'm not sure), is that you have 'thread dd_onspawn();' near the top, but you call it 'dd_onSpawn' (with a capital S) later.
Although some scripting languages distinguish between capitals and non-capitals, codscript does not.

The error you are getting is clearly what Nightmare has said.

Go through all your map entities and make sur ethe name you enter as the targetname is equal to the targetname of what you have in your script.

Posted: October 15th, 2007, 4:05 pm
by <LT>YosemiteSam[NL]
Deadly wrote:but now i have a error of

it said something about getent used more than once on line 93

glass_03 = getent("glass_03","targetname"); // line 93
Imo this means you have 2 or more entities in your map which have the same targetname.
Correct me if I'm wrong :)

Posted: October 15th, 2007, 5:44 pm
by Drofder2004
<LT>YosemiteSam[NL] wrote:
Deadly wrote:but now i have a error of

it said something about getent used more than once on line 93

glass_03 = getent("glass_03","targetname"); // line 93
Imo this means you have 2 or more entities in your map which have the same targetname.
Correct me if I'm wrong :)
Oops, didnt read that, I perefer natural code, not "what I thought it said" :P

And yes, you are correct. You have used the variable twice.

Posted: October 15th, 2007, 5:48 pm
by Drofder2004
Also, one thing I would suggest is to simplify your code...

Code: Select all

while(dmg_01 < hp_01)

{
   trig_glass_01 waittill ("damage", idmg); // LINE 55!!!!
   dmg_01 += idmg;
   if (dmg_01 >= hp_01)
      {
      glass_01 delete();
      trig_glass_01 delete();
      }
}
} 
You are telling the IF statement to check if the While statement is not true. Which is pointless, because the while statement is doing it already.
You will probably get problems doing it that way, so here is code without the pointless IF.

Code: Select all

   while(dmg_01 < hp_01)
   {
      trig_glass_01 waittill ("damage", idmg); // LINE 55!!!!
      dmg_01 += idmg;
   } 
   glass_01 delete();
   trig_glass_01 delete();