please help i cant see whats wrong with this script

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

Moderator: Core Staff

Post Reply
Deadly
CJ Fan
CJ Fan
Posts: 138
Joined: July 14th, 2007, 8:53 pm
Location: New Jersey
Contact:

please help i cant see whats wrong with this script

Post by Deadly » October 14th, 2007, 4:51 pm

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!!
Image

Pedsdude
Site Admin
Site Admin
Posts: 15909
Joined: October 15th, 2004, 7:18 pm
Location: UK

Post by Pedsdude » October 14th, 2007, 5:00 pm

What's the exact error? /developer 1
Image
Image

Deadly
CJ Fan
CJ Fan
Posts: 138
Joined: July 14th, 2007, 8:53 pm
Location: New Jersey
Contact:

Post by Deadly » October 14th, 2007, 6:03 pm

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
Image

User avatar
Nightmare
Core Staff
Core Staff
Posts: 2688
Joined: January 12th, 2006, 10:09 pm
Contact:

Post by Nightmare » October 14th, 2007, 7:35 pm

Your targetnames are probably incorrect, check the map to make sure they match.
Coding is Poetry. Mapping is Art.
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet

-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Post by Drofder2004 » October 15th, 2007, 12:22 am

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".
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

Pedsdude
Site Admin
Site Admin
Posts: 15909
Joined: October 15th, 2004, 7:18 pm
Location: UK

Post by Pedsdude » October 15th, 2007, 1:11 am

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.
Image
Image

Deadly
CJ Fan
CJ Fan
Posts: 138
Joined: July 14th, 2007, 8:53 pm
Location: New Jersey
Contact:

Post by Deadly » October 15th, 2007, 1:25 am

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
Image

Lethal323

Post by Lethal323 » October 15th, 2007, 8:49 am

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...

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Post by Drofder2004 » October 15th, 2007, 12:52 pm

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.
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

User avatar
<LT>YosemiteSam[NL]
Core Staff
Core Staff
Posts: 2155
Joined: December 7th, 2004, 2:07 am
Location: Netherlands
Contact:

Post by <LT>YosemiteSam[NL] » October 15th, 2007, 4:05 pm

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 :)

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Post by Drofder2004 » October 15th, 2007, 5:44 pm

<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.
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Post by Drofder2004 » October 15th, 2007, 5:48 pm

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();
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

Post Reply

Who is online

Users browsing this forum: No registered users and 32 guests