New round?
Moderator: Core Staff
New round?
How can you start a new round in CoD4 when a round ends?
-
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Re: New round?
You're going to have to be more specific.
I do not think there is simply one function that restarts a round in the way of scripting.
Are you writing your own gametype, function or other?
I do not think there is simply one function that restarts a round in the way of scripting.
Are you writing your own gametype, function or other?
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
Re: New round?
Sorry, my bad.
I would like to keep the gametype files untouched so it can be used for all gametypes.
When a map ends (so for example a TDM match) I want that a new extra round gets started if value x = true.
It should be something like this:
I would like to keep the gametype files untouched so it can be used for all gametypes.
When a map ends (so for example a TDM match) I want that a new extra round gets started if value x = true.
It should be something like this:
Code: Select all
check_new_round()
{
waittill( "round_end" ); // I don't know if something like this exist?
if( x )
level thread start_new_round();
}
start_new_round()
{
// I have no clue
}
-
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Re: New round?
TDM already starts a new round, so what you actually want to do is reverse your "if statement".
So:
if(x > 0)
// next round
becomes
if(x < 0)
// end game
The function required is found in globallogic.gsc
endGame( winner, endReason )
For example, I used it in the codjumper mod when restarting or changing map by the ingame vote menu:
thread maps\mp\gametypes\_globallogic::endGame(undefined, "Vote Passed - Changing Map");
Hopefully that helps, as I do not believe there is a "notify" for ending rounds, there are just threads that restart.
So:
if(x > 0)
// next round
becomes
if(x < 0)
// end game
The function required is found in globallogic.gsc
endGame( winner, endReason )
For example, I used it in the codjumper mod when restarting or changing map by the ingame vote menu:
thread maps\mp\gametypes\_globallogic::endGame(undefined, "Vote Passed - Changing Map");
Hopefully that helps, as I do not believe there is a "notify" for ending rounds, there are just threads that restart.
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
Re: New round?
Thank you for your help
I already thought it was the endGame function (because it was also in the gametype files etc). But I don't know how to use it to add an extra round. But I will check it out tomorrow.
I already thought it was the endGame function (because it was also in the gametype files etc). But I don't know how to use it to add an extra round. But I will check it out tomorrow.
-
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Re: New round?
To ADD a round?
Based on what?
The game already has criteria for this, such as timelimits and scorelimits. There are threads that monitor these before they issue an endgame call.
They can also be found in the globallogic - i.e hitRoundLimit()
Based on what?
The game already has criteria for this, such as timelimits and scorelimits. There are threads that monitor these before they issue an endgame call.
They can also be found in the globallogic - i.e hitRoundLimit()
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
Re: New round?
That is what I tried, play a new round by using the threads that are already in the game. But I did not knew how to do this.
Thank you for the info, I will check it tomorrow.
If I fail I will report back
Thank you for the info, I will check it tomorrow.
If I fail I will report back
Re: New round?
Sorry for the double post.
EDIT:
I have been working on it and as far as I know it is only possible by editing the gametype files (war.gsc, dm.gsc, etc).
Or is there an other method to do what I want without touching the gametype files?
EDIT:
I have been working on it and as far as I know it is only possible by editing the gametype files (war.gsc, dm.gsc, etc).
Or is there an other method to do what I want without touching the gametype files?
-
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Re: New round?
gametype files do nothing but define the gametypes. The magic is done in the globallogic.gsc file, as this is where the core scripting is.
I cannot go into much detail at the minute (up for work in 6 hours >.>) but bump the topic and I will have a look tomorrow.
I cannot go into much detail at the minute (up for work in 6 hours >.>) but bump the topic and I will have a look tomorrow.
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
Re: New round?
Alright, thank you in advance
I searched my ass of but I have no clue how to stop the game from running the game type file (war.gsc for example). The first round it should just load the game type file. But when x = true it should not load the game type file.
EDIT
When I removed the main() out of the game type file (war.gs) to see which script gives the error I got this error code. The problem is that it does not shows where the error was called from.
I searched my ass of but I have no clue how to stop the game from running the game type file (war.gsc for example). The first round it should just load the game type file. But when x = true it should not load the game type file.
EDIT
When I removed the main() out of the game type file (war.gs) to see which script gives the error I got this error code. The problem is that it does not shows where the error was called from.
File Handles:
----------------------
48600 files in iwd files
Loading fastfile mp_crash
Waited 286 msec for asset 'maps/mp/mp_crash.d3dbsp' of type 'col_map_mp'.
------- Game Initialization -------
gamename: Call of Duty 4
gamedate: Jun 18 2008
----------------------
Game: G_SetupWeaponDef
----------------------
********************
ERROR: Could not find label 'main' in script 'maps/mp/gametypes/war'
********************
----- Server Shutdown -----
Resolving cod4master.activision.com
cod4master.activision.com resolved to 63.146.124.21:20810
Sending heartbeat to cod4master.activision.com
==== ShutdownGame (1) ====
---------------------------
-
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Re: New round?
Find and downlaod a program called "Windows Grep", load that up so it is pointed at the RAW or Maps folder. Now search for the term you want ("::main()")
This will help you find where functions are being called from.
Anyway
Globallogic.gsc
Line 1173-1503
EndGame()
This function handles everything, from single rounds, many rounds, halftimes and map restarts and map changes.
that is the code to restart the round.
You will need to edit this "if statement" and possibly the previous ones to get your desired mod.
For example:
That would restart the round if a variable called "level.moustache_new_round" was set to true and it would ignore any round or score limits.
You would almost definitly need to change more code however to stop some errors popping up.
This will help you find where functions are being called from.
Anyway
Globallogic.gsc
Line 1173-1503
EndGame()
This function handles everything, from single rounds, many rounds, halftimes and map restarts and map changes.
Code: Select all
if ( !hitRoundLimit() && !hitScoreLimit() )
{
level notify ( "restarting" );
game["state"] = "playing";
map_restart( true );
return;
}
You will need to edit this "if statement" and possibly the previous ones to get your desired mod.
For example:
Code: Select all
if ( ( !hitRoundLimit() && !hitScoreLimit() ) || level.moustache_new_round == true)
{
level notify ( "restarting" );
game["state"] = "playing";
map_restart( true );
return;
}
You would almost definitly need to change more code however to stop some errors popping up.
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
Who is online
Users browsing this forum: No registered users and 1 guest