UGX-Mods

Call of Duty 5: World at War => Tutorial Desk => Scripting => Topic started by: Harry Bo21 on July 27, 2016, 09:01:13 am

Title: G-Spawn Bug
Post by: Harry Bo21 on July 27, 2016, 09:01:13 am
I just found this in treyarchs stupid ass code...

Explains why people had GSpawn errors with my  perks, as well as without

in zombiemode_utility.gsc - youll find this function

Code Snippet
Plaintext
check_point_in_active_zone( origin )
{
player_zones = GetEntArray( "player_zone", "script_noteworthy" );
if( !isDefined( level.zones ) || !isDefined( player_zones ) )
{
return true;
}

scr_org = spawn( "script_origin", origin+(0, 0, 40) );

one_valid_zone = false;
for( i = 0; i < player_zones.size; i++ )
{
if( scr_org isTouching( player_zones[i] ) )
{
if( isDefined( level.zones[player_zones[i].targetname] ) &&
isDefined( level.zones[player_zones[i].targetname].is_enabled ) )
{
one_valid_zone = true;
}
}
}

return one_valid_zone;
}


Not only do they spawn a script_origin that they dont delete - meaning every time this function is called another ent is created and lost

They also check if is_enabled "is Defined" - but not if its "true" - so this will always return true even if the zone "isnt" active...

Replace it with this :

Code Snippet
Plaintext
check_point_in_active_zone( origin )
{
player_zones = GetEntArray( "player_zone", "script_noteworthy" );
if( !isDefined( level.zones ) || !isDefined( player_zones ) )
return true;

scr_org = spawn( "script_origin", origin + ( 0, 0, 40 ) );

one_valid_zone = false;
for( i = 0; i < player_zones.size; i++ )
{
if( scr_org isTouching( player_zones[ i ] ) )
{
if( isDefined( level.zones[ player_zones[ i ].targetname ] ) && isDefined( level.zones[ player_zones[ i ].targetname ].is_enabled ) && level.zones[ player_zones[ i ].targetname ].is_enabled )
one_valid_zone = true;

}
}
scr_org delete();
return one_valid_zone;
}
Title: Re: G-Spawn Bug
Post by: mala15 on July 27, 2016, 09:29:33 am
Nice, great find!

Do you know when and how often that function is used?
Title: Re: G-Spawn Bug
Post by: Harry Bo21 on July 27, 2016, 09:47:02 am
Nice, great find!

Do you know when and how often that function is used?
in my perks? A lot

treyarchs, prob quite a bit but off hand can only think of monkey bombs
Title: Re: G-Spawn Bug
Post by: Tim Smith on July 27, 2016, 09:48:02 am
Great find harry! +1.
Title: Re: G-Spawn Bug
Post by: Scobalula on July 27, 2016, 09:51:13 am
I just found this in treyarchs stupid ass code...

Explains why people had GSpawn errors with my  perks, as well as without

in zombiemode_utility.gsc - youll find this function

Code Snippet
Plaintext
check_point_in_active_zone( origin )
{
player_zones = GetEntArray( "player_zone", "script_noteworthy" );
if( !isDefined( level.zones ) || !isDefined( player_zones ) )
{
return true;
}

scr_org = spawn( "script_origin", origin+(0, 0, 40) );

one_valid_zone = false;
for( i = 0; i < player_zones.size; i++ )
{
if( scr_org isTouching( player_zones[i] ) )
{
if( isDefined( level.zones[player_zones[i].targetname] ) &&
isDefined( level.zones[player_zones[i].targetname].is_enabled ) )
{
one_valid_zone = true;
}
}
}

return one_valid_zone;
}


Not only do they spawn a script_origin that they dont delete - meaning every time this function is called another ent is created and lost

They also check if is_enabled "is Defined" - but not if its "true" - so this will always return true even if the zone "isnt" active...

Replace it with this :

Code Snippet
Plaintext
check_point_in_active_zone( origin )
{
player_zones = GetEntArray( "player_zone", "script_noteworthy" );
if( !isDefined( level.zones ) || !isDefined( player_zones ) )
return true;

scr_org = spawn( "script_origin", origin + ( 0, 0, 40 ) );

one_valid_zone = false;
for( i = 0; i < player_zones.size; i++ )
{
if( scr_org isTouching( player_zones[ i ] ) )
{
if( isDefined( level.zones[ player_zones[ i ].targetname ] ) && isDefined( level.zones[ player_zones[ i ].targetname ].is_enabled ) && level.zones[ player_zones[ i ].targetname ].is_enabled )
one_valid_zone = true;

}
}
scr_org delete();
return one_valid_zone;
}

And this script is from the same people, who the person who shall not be mentioned said have no issues in their scripts, and we are to blame for any bugs.. ::)

+1 though, now we have a working function for checking active zones. :D
Title: Re: G-Spawn Bug
Post by: PlutoBro on July 27, 2016, 11:50:34 am
I just found this in treyarchs stupid ass code...

Explains why people had GSpawn errors with my  perks, as well as without

in zombiemode_utility.gsc - youll find this function

Code Snippet
Plaintext
check_point_in_active_zone( origin )
{
player_zones = GetEntArray( "player_zone", "script_noteworthy" );
if( !isDefined( level.zones ) || !isDefined( player_zones ) )
{
return true;
}

scr_org = spawn( "script_origin", origin+(0, 0, 40) );

one_valid_zone = false;
for( i = 0; i < player_zones.size; i++ )
{
if( scr_org isTouching( player_zones[i] ) )
{
if( isDefined( level.zones[player_zones[i].targetname] ) &&
isDefined( level.zones[player_zones[i].targetname].is_enabled ) )
{
one_valid_zone = true;
}
}
}

return one_valid_zone;
}


Not only do they spawn a script_origin that they dont delete - meaning every time this function is called another ent is created and lost

They also check if is_enabled "is Defined" - but not if its "true" - so this will always return true even if the zone "isnt" active...

Replace it with this :

Code Snippet
Plaintext
check_point_in_active_zone( origin )
{
player_zones = GetEntArray( "player_zone", "script_noteworthy" );
if( !isDefined( level.zones ) || !isDefined( player_zones ) )
return true;

scr_org = spawn( "script_origin", origin + ( 0, 0, 40 ) );

one_valid_zone = false;
for( i = 0; i < player_zones.size; i++ )
{
if( scr_org isTouching( player_zones[ i ] ) )
{
if( isDefined( level.zones[ player_zones[ i ].targetname ] ) && isDefined( level.zones[ player_zones[ i ].targetname ].is_enabled ) && level.zones[ player_zones[ i ].targetname ].is_enabled )
one_valid_zone = true;

}
}
scr_org delete();
return one_valid_zone;
}

Great find harry! Good work fixing.

And this script is from the same people, who the person who shall not be mentioned said have no issues in their scripts, and we are to blame for any bugs.. ::)

+1 though, now we have a working function for checking active zones. :D

Even the biggest of companies have bad/badly written scripts. Can be a result of many things. "He who shall not be named" sounds like a Harry Potter thing.
Title: Re: G-Spawn Bug
Post by: Sebra on July 27, 2016, 11:51:48 am
Awesome +1
Title: Re: G-Spawn Bug
Post by: alaurenc9 on July 27, 2016, 01:10:17 pm
Lol I found this too a while back, amazing how they managed to fuck this though. But they fixed it in BO1, doesn't suprise me.
Title: Re: G-Spawn Bug
Post by: Harry Bo21 on July 27, 2016, 01:49:33 pm
Lol I found this too a while back, amazing how they managed to fuck this though. But they fixed it in BO1, doesn't suprise me.
somehow i knew you were going to say that