G'day, I've been looking all over the place trying to find a command to determine what game is running from the script.
For eg, many maps and mods can be compatable for AA SH & BT, only some small changes are needed to keep all versions happy.
In the scripts can be a game check at the top, something like;
level.gamever = ????? //mystery command to check it
if (level.gamever == "Allied Assault")
{
do all your scriptmaster stuff for sounds etc etc..
}
//Scriptmaster stuff skipped if not Allied Assault
//continue with rest of the script
I remember seeing something like this done in a mod a few years back, but I can't find it now. It was supposed to be compatable with all three game versions.
Grassy
Game Version command
Moderator: Moderators
Game Version command
An ambiguous question will get a similar answer...
Thanks JV, this is what I get.
Grassy
So..... would this method work?** Spearhead **
"version" is:"Medal of Honor Spearhead 2.15 win-x86 Mar 4 2003" default:"Medal of Honor Spearhead 2.15 win-x86 Mar 4 2003"
"shortversion" is:"2.15" default:"2.15"
** Allied Assault **
"version" is:"Medal of Honor Allied Assault 1.11 win-x86 Mar 5 2002" default:"Medal of Honor Allied Assault 1.11 win-x86 Mar 5 2002"
"shortversion" is:"1.11" default:"1.11"
** Breakthrough **
"version" is:"Medal of Honor: Breakthrough 0.00 win-x86 Dec 1 2003" default:"Medal of Honor: Breakthrough 0.00 win-x86 Dec 1 2003"
"shortversion" is:"2.40" default:"2.40"
Code: Select all
level.gamever = int( getcvar ( shortversion ))
if (level.gamever !=NIL)
{
if(level.gamever==2.15)
{
level.gamename = "Spearhead" //dont need names, but names are easier to remember down the script ;-)
}
if(level.gamever==1.11)
{
level.gamename = "AlliedAssault"
thread do_sound_aliases
}
if(level.gamever==2.40)
{
level.gamename = "Breakthrough"
}
else
{
println "** It seems your game version is not up to date **"
println "** There are patches available that you need to install **"
}
}An ambiguous question will get a similar answer...
i use this:
just clean up the stuff u dont need.
game.game is what i use in other scripts to run parts for the game. its from anti camper.
I dont check the whole string or the patch num cos they mightve diff for some people. more then one version was released of mohaa at diff dates etc;). However the title, That shouldnt of changed. no one has said it dont work to me so far and in testing it works.
Code: Select all
getgame:
local.game = getcvar "version"
local.i=15
if(local.game[local.i]==" ")
{
local.i= 17
}
local.gamestates = waitexec game.camperfile::statefiles
for(local.g=1;local.g <= local.gamestates.size;local.g++)
{
if(local.game[local.i]==local.gamestates[local.g][1])
{
local.state = local.gamestates[local.g] [2]
break
}
}
switch(local.game[local.i])
{
case "A":
setcvar "g_statefile" local.state
local.campersettings = waitexec game.camperfile::weaponsaa
game.game = "AA"
end local.campersettings
break
case "S":
setcvar "g_statefile" local.state
game.game = "SH"
local.campersettings = waitexec game.camperfile::weaponssh
end local.campersettings
break
case "B":
setcvar "g_statefile" local.state
game.game = "BT"
local.campersettings = waitexec game.camperfile::weaponsbt
end local.campersettings
break
}
end local.cmdwant
game.game is what i use in other scripts to run parts for the game. its from anti camper.
I dont check the whole string or the patch num cos they mightve diff for some people. more then one version was released of mohaa at diff dates etc;). However the title, That shouldnt of changed. no one has said it dont work to me so far and in testing it works.
I just tried a shorter more simpler way, seems to work ok.
Returns in logfiles
Code: Select all
//---------------------------------------------------------------------------
// Method to determine what game the player is using
//---------------------------------------------------------------------------
level.gamever = int( getcvar ( shortversion ))
waitframe
if(level.gamever > 1)
{
level.gamename = "Spearhead or Breakthrough"
}
if(level.gamever < 2)
{
level.gamename = "AlliedAssault"
waitthread Do_AA_sound_aliases
thread Start_sound_loops
}
println "------------------------/zz/-------------------------"
println "Game Version : " level.gamever
println "Game type : " level.gamename
println "------------------------/zz/-------------------------"//returns this in Spearhead
//------------------------/zz/-------------------------
//Game Version : 2
//Game type : Spearhead or Breakthrough
//------------------------/zz/-------------------------
//returns this in AlliedAssault
//------------------------/zz/-------------------------
//Game Version : 1
//Game type : AlliedAssault
//------------------------/zz/-------------------------
An ambiguous question will get a similar answer...
nice idea, but SH or bt. i needed all 3 , anyway
the reason i check for null is because in these 3 sentances. the A and S of allied and spearhead are at place 15. on breakthrough 15 is " ". The b of breakthrough comes in at 17.
medal of honor allied assault
medal of honor spearhead
medal of honor: breakthrough
the reason i check for null is because in these 3 sentances. the A and S of allied and spearhead are at place 15. on breakthrough 15 is " ". The b of breakthrough comes in at 17.
medal of honor allied assault
medal of honor spearhead
medal of honor: breakthrough
