PDA

View Full Version : Script Error



AnGeR
14th December 2013, 16:45
Hey,

I have a problem with my Hide & Seek mod on 1.2 & 1.3 everything works perfect but on 1.0 I get this error :


******* script runtime error *******
cannot cast undefined to bool: (file 'maps/mp/gametypes/hns2.gsc', line 1620)
if(!level.newround)
*
called from:
(file 'maps/mp/gametypes/hns2.gsc', line 705)
count();

This is the Part of the script :


if(!level.newround)
{
if (self.pers["team"]=="allies")
{
self.pers["team"]="axis";
self.sessionteam="axis";
self.hud_skills destroy();
self.hud_skill1 destroy();
self.hud_skill2 destroy();
self.hud_skill3 destroy();
self.hud_skillt destroy();
count();

wait 2;
if(doKillcam && level.killcam) self maps\mp\gametypes\_killcam::killcam(attackerNum, 2, psOffsetTime, true);
if (isDefined(self.blackscreen)) self.blackscreen destroy();
if (isDefined(self.hud_kiir)) self.hud_kiir destroy();
self thread moveplayer("axis");
}
else
{
self.hud_skills destroy();
self.hud_skill1 destroy();
self.hud_skill2 destroy();
self.hud_skill3 destroy();
self.hud_skillt destroy();

wait 1.5;
if(doKillcam && level.killcam) self maps\mp\gametypes\_killcam::killcam(attackerNum, 2, psOffsetTime, true);
self thread respawn();
}
}

RobsoN
14th December 2013, 18:31
define the 'level.newround'

IzNoGoD
14th December 2013, 18:32
Im kinda tired of these kind of posts.
Lets analyze your error shall we?



cannot cast undefined to bool: (file 'maps/mp/gametypes/hns2.gsc', line 1620)
if(!level.newround)
*
Now, what the error is saying:
cannot cast undefined to bool

The star indicates what variable cannot be cast to a bool because it's undefined.

the star is under level.newround.

So this tells us

the script throws an error
because
level.newround is undefined
and
it is used as a bool(ean).

You get the picture?

The variable is undefined
and you are trying to use it as a bool

to fix this
define it!