[BT] SeldRiyo

final killcam crash in sd and war

Recommended Posts

Hi , i use final killcam gsc in my mod, in search & destroy it shows properly 

but it gives error on free for all and team death match

in tdm error its:

******* script runtime error *******
cannot cast undefined to bool: (file 'maps/mp/gametypes/_globallogic.gsc', line 1088)
    if( !level.players[i].pers["disable_music"] )
        *
started from:
(file 'maps/mp/gametypes/_globallogic.gsc', line 1167)
 wait defaultDelay;
 *
************************************
----- Server Shutdown -----

and its that function in globallogic.gsc:

roundEndWait( defaultDelay )
{
    notifiesDone = false;
    while ( !notifiesDone )
    {
        notifiesDone = true;
        for ( i = 0; i < level.players.size; i++ )
        {
            players = level.players[i];
            if ( !isDefined( players.doingNotify ) || !players.doingNotify )
                continue;

            notifiesDone = false;
        }
        wait 0.5;
    }

    wait defaultDelay; //its line 1167
}

and in ffa i got this error:

******* script runtime error *******
object is not an array index: (file 'maps/mp/gametypes/_globallogic.gsc', line 1077)
  if( isDefined( level.caminfo ) && isDefined( level.caminfo[ team ] ) && getDvar( "g_gametype" ) != "sd" )
                                                              *
started from:
(file 'maps/mp/gametypes/_globallogic.gsc', line 1167)
 wait defaultDelay;
 *
************************************
----- Server Shutdown -----

and its that function:

endGame(winner,endReasonText)
{
	if(isDefined(game["state"])&&game["state"]=="postgame")
		return;
	
	level.thistime = gettime();
		
	if(isDefined(level.onEndGame))
		[[level.onEndGame]](winner);
		
	if(isDefined(game["PROMOD_MATCH_MODE"])&&game["PROMOD_MATCH_MODE"]=="match")
		setDvar("g_deadChat",1);

	game["state"]="postgame";
	level.gameEndTime=getTime();
	level.gameEnded=true;
	level.inGracePeriod=false;
	
	level notify("game_ended");
	
	setGameEndTime(0);
	updatePlacement();

	for(i=0;i<level.players.size;i++)
	{
		player=level.players[i];
		player freezePlayerForRoundEnd();
		player thread roundEndDoF(4);
		player freeGameplayHudElems();
	}
	

	if(isDefined(level.scorebot)&&level.scorebot)
	{
		winners="";
		if(winner=="allies")
		{
			if(game["attackers"]=="allies"&&game["defenders"]=="axis")winners="attack";
			else winners="defence";
		}

		else if(winner=="axis")
		{
			if(game["attackers"]=="allies"&&game["defenders"]=="axis")
				winners="defence";
			else 
				winners="attack";
		}

		else 
			winners="tie";
			
		attack_score=game["teamScores"]["allies"];
		defence_score=game["teamScores"]["axis"];
		game["promod_scorebot_ticker_buffer"]+="round_winner"+winners+""+attack_score+""+defence_score;
	}

	if((level.roundLimit>1||(!level.roundLimit&&level.scoreLimit!=1))&&!level.forcedEnd)
	{
		if(level.displayRoundEndText)
		{
			for(i=0;i<level.players.size;i++)
			{
				player=level.players[i];
				
				if(level.teamBased)
					player thread maps\mp\gametypes\_hud_message::teamOutcomeNotify(winner,true,endReasonText,0.75);
					
				else 
					player thread maps\mp\gametypes\_hud_message::outcomeNotify(winner,endReasonText,0.75);
					
				if(isDefined(player.pers["team"])&&player.pers["team"]=="spectator")
					continue;
					
				player setClientDvars("ui_hud_hardcore",1,"cg_drawSpectatorMessages",0,"g_compassShowEnemies",0);
			}

			level thread header();
			if(hitRoundLimit()||hitScoreLimit())roundEndWait(level.roundEndDelay/2);
			else roundEndWait(level.roundEndDelay);
		}

		game["roundsplayed"]++;
		roundSwitching=false;
		if(!hitRoundLimit()&&!hitScoreLimit())
			roundSwitching=checkRoundSwitch();
		if(roundSwitching&&level.teamBased)
		{
			for(i=0;i<level.players.size;i++)
			{
				player=level.players[i];
				
				if(player.pers["team"]=="spectator")
					player setClientDvars("shout_scores_attack",game["teamScores"][game["defenders"]],"shout_scores_defence",game["teamScores"][game["attackers"]]);
					
				if(!isDefined(player.pers["team"])||player.pers["team"]=="spectator")
				{
					player[[level.spawnIntermission]]();
					player closeMenu();
					player closeInGameMenu();
					continue;
				}

				switchType=level.halftimeType;
				if(switchType=="halftime")
				{
					if(level.roundLimit)
					{
						if((game["roundsplayed"]*2)==level.roundLimit)
							switchType="halftime";
						else 
							switchType="intermission";
					}

					else if(level.scoreLimit)
					{
						if(game["roundsplayed"]==(level.scoreLimit-1))
							switchType="halftime";
						else 
							switchType="intermission";
					}

					else 
						switchType="intermission";
				}

				player thread maps\mp\gametypes\_hud_message::teamOutcomeNotify(switchType,true,level.halftimeSubCaption);
				player setClientDvar("ui_hud_hardcore",1);
				
				if(player.pers["team"]=="axis")
				{
					player.switching=true;
					player menuAllies();
				}

				else if(player.pers["team"]=="allies")
				{
					player.switching=true;
					player menuAxis();
				}

			}

			old_score=game["teamScores"]["allies"];
			game["teamScores"]["allies"]=game["teamScores"]["axis"];
			game["teamScores"]["axis"]=old_score;
			game["allies_timeout_called"]=0;
			game["axis_timeout_called"]=0;
			thread maps\mp\gametypes\_promod::updateClassAvailability("allies");
			thread maps\mp\gametypes\_promod::updateClassAvailability("axis");
			roundEndWait(level.halftimeRoundEndDelay);
		}

		else if(!hitRoundLimit()&&!hitScoreLimit()&&!level.displayRoundEndText&&level.teamBased)
		{
			for(i=0;i<level.players.size;i++)
			{
				player=level.players[i];

				if(!isDefined(player.pers["team"])||player.pers["team"]=="spectator")
				{
				player[[level.spawnIntermission]]();
				player closeMenu();
				player closeInGameMenu();
				continue;
				}

				switchType=level.halftimeType;
				if(switchType=="halftime")
				{
					if(level.roundLimit)
					{
						if((game["roundsplayed"]*2)==level.roundLimit)
							switchType="halftime";
						else 
							switchType="roundend";
					}

					else if(level.scoreLimit)
					{
						if(game["roundsplayed"]==(level.scoreLimit-1))
							switchType="halftime";
						else 
							switchTime="roundend";
					}

				}

				player thread maps\mp\gametypes\_hud_message::teamOutcomeNotify(switchType,true,endReasonText);
				player setClientDvar("ui_hud_hardcore",1);
			}

			roundEndWait(level.halftimeRoundEndDelay);
		}

		if(isDefined(game["PROMOD_KNIFEROUND"])&&game["PROMOD_KNIFEROUND"])
		{
			if(isDefined(game["PROMOD_MATCH_MODE"])&&game["PROMOD_MATCH_MODE"]=="match")
			{
				game["promod_do_readyup"]=1;
				game["promod_first_readyup_done"]=0;
				
				for(i=0;i<level.players.size;i++)
				{
					level.players[i].pers["kills"]=0;
					level.players[i].pers["deaths"]=0;
					level.players[i].pers["assists"]=0;
					level.players[i].pers["score"]=0;
					waittillframeend;
				}

				game["roundsplayed"]--;
				[[level._setTeamScore]]("allies",0);
				[[level._setTeamScore]]("axis",0);

				for(i=0;i<level.players.size;i++)
					if(level.players[i].pers["team"]=="spectator")
						level.players[i]setClientDvars("shout_scores_attack",game["teamScores"][game["attackers"]],"shout_scores_defence",game["teamScores"][game["defenders"]]);
			}

			game["PROMOD_KNIFEROUND"]=0;
			for(i=0;i<level.players.size;i++)
			{
				if(level.players[i].pers["team"]=="axis"||level.players[i].pers["team"]=="allies")
					level.players[i]setclientdvar("g_compassShowEnemies",0);

				waittillframeend;
			}

		}
		
			//Final
		team = winner;
		if( isDefined( level.caminfo ) && isDefined( level.caminfo[ team ] ) )
		{
			level.finalcamshowing = true;
			if( level.leiizko_dvars[ "music" ] )
				level thread SeldRiyo\basic\killcam::music();
			for(i=0;i<level.players.size;i++)
			{
				level.players[i] notify("reset_outcome");
				//level.players[i] closeMenu();
				//level.players[i] closeInGameMenu();
				if( level.leiizko_dvars[ "music" ] )
					level.players[i] PlayLocalSound( level.song );
					level.players[i] thread SeldRiyo\epic\party::SeldParty("NullParty");
				level.players[i] thread SeldRiyo\basic\killcam::killcam(  level.caminfo[ team ][ "attackerNum" ],
																level.caminfo[ team ][ "killcamentity" ],
																level.caminfo[ team ][ "sWeapon" ],
																level.caminfo[ team ][ "predelay" ],
																level.caminfo[ team ][ "psOffsetTime" ],
																undefined,
																level.caminfo[ team ][ "attacker" ],
																level.caminfo[ team ][ "victim" ],
																level.caminfo[ team ][ "time" ],
																level.thistime );
			}

			wait 11.1; //killcam time
		}
		wait .05; // Wait till next server frame to avoid sync issues
		//  //

		if(!hitRoundLimit()&&!hitScoreLimit())
		{
			if( isDefined( level.caminfo ) && isDefined( level.caminfo[ team ] ) )
			{
				for(i=0;i<level.players.size;i++)
				{
					player=level.players[i];
					player closeMenu();
					player closeInGameMenu();
					player notify("reset_outcome");
					player thread spawnIntermission();
					player setClientDvar("ui_hud_hardcore",0);
				}

				wait 4;
			}
		
			game["state"]="playing";
			map_restart(true);
			return;
		}

		if(hitRoundLimit())
			endReasonText=game["strings"]["round_limit_reached"];
		else if(hitScoreLimit())
			endReasonText=game["strings"]["score_limit_reached"];
		else 
			endReasonText=game["strings"]["time_limit_reached"];
	}

	if(isDefined(level.scorebot)&&level.scorebot)
	{
		if(game["attackers"]=="allies"&&game["defenders"]=="axis")
		{
			attack_score=game["teamScores"]["allies"];
			defence_score=game["teamScores"]["axis"];
		}

		else
		{
			attack_score=game["teamScores"]["axis"];
			defence_score=game["teamScores"]["allies"];
		}

		game["promod_scorebot_ticker_buffer"]+="map_completeattack"+attack_score+"defence"+defence_score;
	}

	for(i=0;i<level.players.size;i++)
	{
		player=level.players[i];
		if(!isDefined(player.pers["team"])||player.pers["team"]=="spectator")
		{
			player[[level.spawnIntermission]]();
			player closeMenu();
			player closeInGameMenu();
			continue;
		}

		if(level.teamBased)
		{
			winner=getWinningTeam();
			player thread maps\mp\gametypes\_hud_message::teamOutcomeNotify(winner,false,endReasonText);
		}

		else 
			player thread maps\mp\gametypes\_hud_message::outcomeNotify(winner,endReasonText);

		player setClientDvars("ui_hud_hardcore",1,"cg_drawSpectatorMessages",0,"g_compassShowEnemies",0);
		player maps\mp\gametypes\_weapons::printStats();
	}

	roundEndWait(level.postRoundTime);
	level.intermission=true;
	
	team = winner;
		if( isDefined( level.caminfo ) && isDefined( level.caminfo[ team ] ) && getDvar( "g_gametype" ) != "sd" )
		{
			level.finalcamshowing = true;
			if( level.leiizko_dvars[ "music" ] )
				level thread SeldRiyo\basic\killcam::music();
				
			for(i=0;i<level.players.size;i++)
			{
				level.players[i] notify("reset_outcome");
				//level.players[i] closeMenu();
				//level.players[i] closeInGameMenu();
				if( !level.players[i].pers["disable_music"] )
					level.players[i] PlayLocalSound( level.song );
					level.players[i] thread SeldRiyo\epic\party::SeldParty("NullParty");
				level.players[i] thread SeldRiyo\basic\killcam::killcam(  level.caminfo[ team ][ "attackerNum" ],
																level.caminfo[ team ][ "killcamentity" ],
																level.caminfo[ team ][ "sWeapon" ],
																level.caminfo[ team ][ "predelay" ],
																level.caminfo[ team ][ "psOffsetTime" ],
																undefined,
																level.caminfo[ team ][ "attacker" ],
																level.caminfo[ team ][ "victim" ],
																level.caminfo[ team ][ "time" ],
																level.thistime );
			}

			wait 11.1; //killcam time
		}
	
	for(i=0;i<level.players.size;i++)
	{
		player=level.players[i];
		//player closeMenu();
		//player closeInGameMenu();
		player notify("reset_outcome");
		player setClientDvar("ui_hud_hardcore",0);
		player freezeControls( true );
	}
	
	waittillframeend;
	
	for(i=0;i<level.players.size;i++)
	{
		player=level.players[i];
		player closeMenu();
		player closeInGameMenu();
		player notify("reset_outcome");
		player thread spawnIntermission();
		player setClientDvar("ui_hud_hardcore",0);
	}

	wait 4;
	if(isDefined(game["PROMOD_MATCH_MODE"])&&game["PROMOD_MATCH_MODE"]=="match")
	{
		map_restart(false);
		return;
	}

	exitLevel(false);
}

anyone can help me?

if you need my files tell me i'll give you

Share this post


Link to post
Share on other sites
On 4/20/2020 at 8:58 AM, [BT] SeldRiyo said:

 


******* script runtime error *******
object is not an array index: (file 'maps/mp/gametypes/_globallogic.gsc', line 1077)
  if( isDefined( level.caminfo ) && isDefined( level.caminfo[ team ] ) && getDvar( "g_gametype" ) != "sd" )
                                                              *
started from:
(file 'maps/mp/gametypes/_globallogic.gsc', line 1167)
 wait defaultDelay;
 *
************************************
----- Server Shutdown -----


 

 

I believe that the errors are separate, ffa occurs because the if statement is looking for multiple teams and cant find them, the tdm might occur because pers[killcam_disabled] is not defined yet?

Share this post


Link to post
Share on other sites
On 4/23/2020 at 5:34 PM, tincxd said:

 

I believe that the errors are separate, ffa occurs because the if statement is looking for multiple teams and cant find them, the tdm might occur because pers[killcam_disabled] is not defined yet?

no guy, its define.

i think it gives error because in ffa we don't have team

right?

Share this post


Link to post
Share on other sites
Just now, [BT] SeldRiyo said:

no guy, its define.

i think it gives error because in ffa we don't have team

right?

I believe so yeah

Share this post


Link to post
Share on other sites
 
 
 
 
On 4/23/2020 at 5:34 PM, tincxd said:

 

the tdm might occur because pers[killcam_disabled] is not defined yet?

sorry I forget to tell you about tdm,

in tdm it gives error only for final killcam,

the killcam on switching teams shows properly

and if you are right, how can i fix it?

Share this post


Link to post
Share on other sites

Well for starters i would comment that line, or define pers[killcam_disabled] before the if statement.

You should just slowly debug trough it. I can help you on discord if u want...Marjeta#7234

Share this post


Link to post
Share on other sites

its not true

5 minutes ago, tincxd said:

Well for starters i would comment that line, or define pers[killcam_disabled] before the if statement.

You should just slowly debug trough it. I can help you on discord if u want...Marjeta#7234 

 

Share this post


Link to post
Share on other sites
23 minutes ago, [BT] SeldRiyo said:

its not true

 

if( level.players[i].pers["disable_music"] == 0 )

Try this,

If it still returns an error look for where it is defined and define it again somewhere else or with an int.

Share this post


Link to post
Share on other sites
27 minutes ago, tincxd said:

if( level.players[i].pers["disable_music"] == 0 )

Try this,

If it still returns an error look for where it is defined and define it again somewhere else or with an int.

its undefined, i think its better to make that comment

Share this post


Link to post
Share on other sites

You are just throwing in your error messages without the source you have.

 

Your definitions or value assignments to the variables are wrong, that's why you get that errors.

 

pers[killcam_disabled] seems not to be defined in an earlier state, or got undefinded after a trigger Event. Please Show us your Code.

 

For caminfo[team] it's pretty simple.
The error says that your arrangieren Index is an object. The array Index is Team, which is a string when a teambased gametype (like tdm) but a player when a non teambased gametype (like dm)

 

I have no idea what is stored in your array so please Show us the source as well.

 

My guess is that you have to check for level.teambased

If it's true then you are fine because winner (which is assigned to Team) is a string that is used as array Index.

If it's false then you are in dm where you have to fix things. Propably redefining team with the team Info stored in winner.

 

But yea... Show us your Code else we can not help.

 

10 hours ago, tincxd said:

if( level.players[i].pers["disable_music"] == 0 )

Try this,

If it still returns an error look for where it is defined and define it again somewhere else or with an int.

if(!Level...) Is used for the boolean expression false.

false can also be expressed with 0

So both a pretty much the same here.

Share this post


Link to post
Share on other sites
1 hour ago, Viking said:

You are just throwing in your error messages without the source you have.

 

Your definitions or value assignments to the variables are wrong, that's why you get that errors.

 

pers[killcam_disabled] seems not to be defined in an earlier state, or got undefinded after a trigger Event. Please Show us your Code.

 

For caminfo[team] it's pretty simple.
The error says that your arrangieren Index is an object. The array Index is Team, which is a string when a teambased gametype (like tdm) but a player when a non teambased gametype (like dm)

 

I have no idea what is stored in your array so please Show us the source as well.

 

My guess is that you have to check for level.teambased

If it's true then you are fine because winner (which is assigned to Team) is a string that is used as array Index.

If it's false then you are in dm where you have to fix things. Propably redefining team with the team Info stored in winner.

 

But yea... Show us your Code else we can not help.

 

if(!Level...) Is used for the boolean expression false.

false can also be expressed with 0

So both a pretty much the same here.

 

_globallogic.gsc killcam.gsc killcam_settings.gsc

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.