How to Unlock Secret Background Image without Finishing Special Operations

Download and install some cool Army Men Mods made by our community.
Post Reply
User avatar
Secg
Half Track L2
Half Track L2
Posts: 200
Joined: Sat Jun 10, 2017 12:28 am
United States of America

How to Unlock Secret Background Image without Finishing Special Operations

Post by Secg »

I'm working on a re-release of my mod Army Men RTS Heroic.

I've successfully downloaded the Secret Background Image (with Vikki) which will stand in for the normal background after players have finished AMRTS on PS2 & gotten Gold Medals in Boot Camp, Campaign, Great Battles, and Special Operations. 8)

This seems to be the condition if_shell.cfg:

Code: Select all

If("user.vars.keys", "==", "user.vars.shell.totalkeys")
Is there any way to modify it & remove requirements to complete Special Operations? :?

Thanks beforehand!
ImageImage
User avatar
TommyCD1
Moderator
Moderator
Posts: 1144
Joined: Tue Jun 04, 2013 8:55 am
Location: East Coast
Contact:
United States of America

Re: How to Unlock Secret Background Image without Finishing Special Operations

Post by TommyCD1 »

Change the "==" into "!=" and it will display the secret screen instead, switching to the regular after you complete the game 100%
=))
I may not make the best maps, or be the best player, but I put a lot of time, effort, and care into my stuff. That counts for something, right? No.
Image
"Can we order a pizza?"
GameRanger ID: 913974
User avatar
Secg
Half Track L2
Half Track L2
Posts: 200
Joined: Sat Jun 10, 2017 12:28 am
United States of America

Thanks & Another Question

Post by Secg »

TommyCD1 wrote: Sat Jul 14, 2018 11:59 am Change the "==" into "!=" and it will display the secret screen instead, switching to the regular after you complete the game 100%
=))
I did it like you said & the Secret Background if_background1_complete.tga actually showed up; & when I complete the whole game, the default if_background1.tga appears. However, when change "!=" back to "==", go to the user folder to delete all, the game remains "completed", meaning that I cannot lock the Secret Background back. :(

Are there any way to lock the unlocked background?
ImageImage
User avatar
TommyCD1
Moderator
Moderator
Posts: 1144
Joined: Tue Jun 04, 2013 8:55 am
Location: East Coast
Contact:
United States of America

Re: How to Unlock Secret Background Image without Finishing Special Operations

Post by TommyCD1 »

If you have the if_background1_complete.tga file, then rename it to if_background1.tga and place it in a folder named 'shell' in your client/p folder. That way it will supercede the original.
I may not make the best maps, or be the best player, but I put a lot of time, effort, and care into my stuff. That counts for something, right? No.
Image
"Can we order a pizza?"
GameRanger ID: 913974
User avatar
Secg
Half Track L2
Half Track L2
Posts: 200
Joined: Sat Jun 10, 2017 12:28 am
United States of America

Background Image: Default and Secret

Post by Secg »

This is the code to display Background Images in my shell > if_shell.cfg:

Code: Select all

//
// Background Image
//
CreateControl("Shell::Bkgnd", "Shell::Window")
{
  Style("Inert");

  If("user.vars.keys", "!=", "user.vars.shell.totalkeys")
  {
    CreateControl("BackgroundImg", "Static")
    {
      Geometry("Parentwidth", "Parentheight", "HCentre", "VCentre");
      ColorGroup("Sys::Texture");
      Image()
      {
        Image("if_background1_complete.tga");
        Filter(1);
      }
    }
  }
  Else()
  {
    CreateControl("BackgroundImg", "Static")
    {
      Geometry("Parentwidth", "Parentheight", "HCentre", "VCentre");
      ColorGroup("Sys::Texture");
      Image()
      {
        Image("if_background1.tga");
        Filter(1);
      }
    }
  }
}
The if_background1.tga should be the Default Background (featuring only one hero: Sarge); while if_background1_complete.tga should be the Secret Background (featuring 6 heroes: Sarge, Vikki, Riff, Scorch, Thick, and Hoover).

It's been a long time since I last touched this, so I completely forgot how it works.

Does it mean:
  • If the player would have gotten all the keys (by completing all 3 tutorials missions and earning Gold Medals on all 15 Campaign, Great Battles, and Special operations missions), then the Secret Background if_background1_complete.tga shall be displayed;
    Or else the Default Background if_background1.tga shall be displayed.
Or the reverse:
  • If the player would have gotten all the keys (by completing all 3 tutorials missions and earning Gold Medals on all 15 Campaign, Great Battles, and Special Operations missions), then the Default Background if_background1.tga shall be displayed;
    Or else the Secret Background if_background1_complete.tga shall be displayed.
Because I modded my AMRTS Heroic copy so many times so possibly if_background1_complete.tga has ended up being the name of Default Background (featuring Sarge only) while if_background1.tga has ended up being the name of Secret Background (featuring six heroes).

The background which is displaying right now is the Default Background, featuring only Sarge:

https://ibb.co/94yVYLR

I have also deleted all data in user > data.cfg, deleted all Saved Games, and re-locked all unlocked Great Battles and Special Operations missions. So in a manner of speaking, I have made the game "incomplete" again after the last time I completed it.

My question:
If I would again complete completing all 3 tutorials missions and earning Gold Medals on all 15 Campaign, Great Battles, and Special Operations missions, would the Secret Background (featuring six heroes) be displayed?
Can only be answered if I still remember how the code works, yet I already forgot how.

Can somebody help?
ImageImage
User avatar
TommyCD1
Moderator
Moderator
Posts: 1144
Joined: Tue Jun 04, 2013 8:55 am
Location: East Coast
Contact:
United States of America

Re: How to Unlock Secret Background Image without Finishing Special Operations

Post by TommyCD1 »

Secg wrote: Mon Nov 27, 2023 7:03 pm
  • If the player would have gotten all the keys (by completing all 3 tutorials missions and earning Gold Medals on all 15 Campaign, Great Battles, and Special operations missions), then the Secret Background if_background1_complete.tga shall be displayed;
    Or else the Default Background if_background1.tga shall be displayed.
Secg wrote: Mon Nov 27, 2023 7:03 pmIf I would again complete completing all 3 tutorials missions and earning Gold Medals on all 15 Campaign, Great Battles, and Special Operations missions, would the Secret Background (featuring six heroes) be displayed?
This is correct. The way the secret background works is:
Every time you complete a mission with bronze, you earn a key for that mission. And ever time you complete a mission with silver or gold, you earn an additional two keys for that mission respectively. This means that essentially, every mission has three keys to earn by earning medals on them. The number of keys you have accumulated so far is tracked by the variable
  • user.vars.keys
Now, when loading the main menu, it must determine whether you have unlocked the full game or not. It does this by comparing your keys variable to another internal variable
  • user.vars.shell.totalkeys
In your code specifically, if the number of keys earned is NOT EQUAL TO the number of keys defined by the second variable, then the default background will be displayed. Otherwise, if they match, then the secret background is unlocked.

Some things to keep in mind, however.
  • Both the user.vars.keys and user.vars.shell.totalkeys variables are created / declared directly within the source code. I don't remember the default value of the totalkeys var, but I remember that it does not work when directly porting the special operations over. That is, if your game has exactly 15 story missions, 8 great battles, and 8 special ops, then earning gold on all these missions will end up with the keys var different from the totalkeys var. I fixed this in my own add-on by redefining the totalkeys var to the number it would need to be in runcode_main_shell.cfg. (108 keys)
  • IIRC, the three Boot Camp missions do not contribute any keys upon completion. They may be explicitly coded exceptions somewhere in source, or the entire boot camp "campaign" may be ignored in the same manner. Should test just to make sure.
  • ALL MISSIONS will earn the players keys when completed. This includes multiplayer maps (if they are launched as single player missions) and custom missions. If you install a custom mission and play it to completion, then it earn keys as expected.
  • A missions keys is kept track of according to which mission file is played. That is, if you replace Mission 15 with Mission 1, then earn a gold medal, the game will see that you have completed the mission "missions\story\S15" on gold and give those keys.
  • In your code, if you earn extra keys, whether by mistake or by the use of custom missions, then your unlock background will stop displaying again. I would recommend changing your comparison to ">=" to be greater than or equal to. That way, if the player has extra keys, or decides to play custom missions after finishing everything else, they will not lose their reward background.
  • Technically, it is possible for a mission to have more than two medal goals. I have no idea how the game will react in this situation, but I would imagine it earns a key for each goal completed?
  • Doing the math in my head right now, earning a gold on every possible mission would only earn you 93 keys, which as I remember wasn't enough to account for actual completion. There is some other way to earn keys that I don't know for sure. Maybe unlocking groups also earn keys? That is, unlocking a mission from earning several gold medals also counts?
I may not make the best maps, or be the best player, but I put a lot of time, effort, and care into my stuff. That counts for something, right? No.
Image
"Can we order a pizza?"
GameRanger ID: 913974
User avatar
Secg
Half Track L2
Half Track L2
Posts: 200
Joined: Sat Jun 10, 2017 12:28 am
United States of America

Re: TommyCD1 regarding Keys & Backgrounds

Post by Secg »

Thanks for the explanation!
Both the user.vars.keys and user.vars.shell.totalkeys variables are created / declared directly within the source code. I don't remember the default value of the totalkeys var, but I remember that it does not work when directly porting the special operations over. That is, if your game has exactly 15 story missions, 8 great battles, and 8 special ops, then earning gold on all these missions will end up with the keys var different from the totalkeys var. I fixed this in my own add-on by redefining the totalkeys var to the number it would need to be in runcode_main_shell.cfg. (108 keys)
This is the code in my base > interface > runcode_main_shell.cfg

Code: Select all

///////////////////////////////////////////////////////////////////////////////
//
// Pandemic Studios
//
// Shell Runcode
//


//
// First-time setup
//

// Has the user been presented with the name change dialog
Cmd("user.createinteger shell.offerednamechange 0");

// The name of a multiplayer session
Cmd("user.createstring shell.network.session");

// Do we want to do the default shell entry
Cmd("user.createinteger shell.default");


//
// Shell Entry Script
//

// Reset default entry
Cmd("op 'user.vars.shell.default' '=' 1");

// Always shutdown multiplayer
Cmd("multiplayer.abort");

// Process optional flow
Switch("gamegod.flow.action")
{
  // Have we finished a campaign
  Case("Campaign::Completed")
  {
    // Which campaign is it
    Switch("gamegod.flow.state")
    {
      // Story
      Case("missions\story")
      {
        // Show the credits
        Cmd("gamegod.missions.select credits missions\shells");

        // Do not process default flow
        Cmd("op 'user.vars.shell.default' '=' 0");
      }

      // Great battles
      Case("missions\gb")
      {
        // Treat as single missions
        Cmd("op 'gamegod.flow.action' '=' 'Campaign'");
      }

      // Special operations
      Case("missions\so")
      {
        // Treat as single missions
        Cmd("op 'gamegod.flow.action' '=' 'Campaign'");
      }
    }
  }
}

// Process default flow
If("user.vars.shell.default")
{
  // Choose a shell
  Switch("gamegod.flow.action")
  {
    Case("Debriefing")
    {
      Cmd("gamegod.missions.select briefing missions\shells");
    }

    Default()
    {
      Cmd("gamegod.missions.select main missions\shells");
    }
  }
}

// Always ask for the players name in a dev build (multiplayer testing off server)
If("sys.buildtype", "!=", "release")
{
  Cmd("user.vars.shell.offerednamechange 0");
}

// Launch the selected mission
Cmd("gamegod.missions.launch");
I will need your instruction on how to code the number of required keys in. Thanks beforehand!
Maybe unlocking groups also earn keys?
Very likely. In my modded AMRTS, when I unlocked just one (!) Great Battles mission or a Special Operaions mission, the game would display the Secret Background instead of the Default Background. :-w
ImageImage
User avatar
TommyCD1
Moderator
Moderator
Posts: 1144
Joined: Tue Jun 04, 2013 8:55 am
Location: East Coast
Contact:
United States of America

Re: How to Unlock Secret Background Image without Finishing Special Operations

Post by TommyCD1 »

Inside the runcode, include this line to set the number of total keys. Make sure it is near the top and not within an If() or Switch() block so it is executed immediately and without condition.

Code: Select all

// Set the total number of keys needed to unlock the whole game
Cmd("user.vars.shell.totalkeys 108");
I assume that since unlocking even one single mission gives the secret background, then the var is initialized as 0 or 1 or something like that in that case.

As for what you should set it to, if you're using the same number of missions, 15 story, 8 great battles, 8 special ops, then you can use the number I also use for my own mod, which is 108.

Otherwise, if you have a different number of missions, or your unlocking conditions differ, then I recommend you do the following method.
  1. Complete all maps to 100%. If this is a bit too time consuming, I recommend cheating or using dummy missions that complete automatically.
  2. Code a way for the game to print the value to user.vars.keys to you. An easy way to do that is to modify an existing interface control that displays a var already and hijack it. For example: the window to change your multiplayer name can be tweaked to change the desired var instead.
    Lines 200 - 210 of if_shell_mp_changename.cfg

    Code: Select all

        CreateControl("NewName", "Edit")
        {
          Geometry("ParentWidth");
          ColorGroup("Shell::EditText");
          Pos(22, 69);
          Size(-44, 16);
          MaxLength(16);
          Font("System");
          UseVar("user.vars.displayname");  // change this to user.vars.keys
          NotifyParent("Edit::Notify::Entered", "Change");
        }
  3. After you have 100% completion, open the multiplayer name change window and write down the number that it prints.
I may not make the best maps, or be the best player, but I put a lot of time, effort, and care into my stuff. That counts for something, right? No.
Image
"Can we order a pizza?"
GameRanger ID: 913974
User avatar
Secg
Half Track L2
Half Track L2
Posts: 200
Joined: Sat Jun 10, 2017 12:28 am
United States of America

Re: TommyCD1 regarding Keys & Backgrounds

Post by Secg »

I assume that since unlocking even one single mission gives the secret background, then the var is initialized as 0 or 1 or something like that in that case.
So, without coding in user.vars.shell.totalkeys in runcode_main_shell.cfg, I re-wrote the relevent coding in if_shell_mp_changename.cfg lines 200 - 210 like this:

Code: Select all

    
    CreateControl("NewName", "Edit")
    {
      Geometry("ParentWidth");
      ColorGroup("Shell::EditText");
      Pos(22, 69);
      Size(-44, 16);
      MaxLength(16);
      Font("System");
      UseVar("user.vars.shell.totalkeys");
      NotifyParent("Edit::Notify::Entered", "Change");
    }
Containing user.vars.shell.totalkeys instead of user.vars.displayname

& this is the result:

https://ibb.co/gv91mkN

The name is "0", meaning that, with respect to my own AMRTS version, the value of user.vars.shell.totalkeys is 0 (hard-coded?).

Anyways, I have a lot of cheatings ( :tehe: ) to do so as to complete all 31 missions (Campaign, GB, & SO) and get the correct number of total keys needed with this coding:

Code: Select all

    
    CreateControl("NewName", "Edit")
    {
      Geometry("ParentWidth");
      ColorGroup("Shell::EditText");
      Pos(22, 69);
      Size(-44, 16);
      MaxLength(16);
      Font("System");
      UseVar("user.vars.keys");
      NotifyParent("Edit::Notify::Entered", "Change");
    }
Again, many thanks!
ImageImage
User avatar
Secg
Half Track L2
Half Track L2
Posts: 200
Joined: Sat Jun 10, 2017 12:28 am
United States of America

Re: Tommy CD1 on the total number of Keys

Post by Secg »

TommyCD1:
Doing the math in my head right now, earning a gold on every possible mission would only earn you 93 keys, which as I remember wasn't enough to account for actual completion. There is some other way to earn keys that I don't know for sure. Maybe unlocking groups also earn keys? That is, unlocking a mission from earning several gold medals also counts?
I think I've figured why there are 108 keys in total:

Only earning Medals (bronze & silver & gold) after finishing a mission (Campaign, Great Battles, or Special Operations) in fact does not earn the player any key; yet:
When a player completes a Campaign, GB, or SO mission with Bronze Medal (i.e. by completing 0 goal), 1 intelligence file is coded to be unlocked and 1 key rewarded;
Likewise:
When a player completes a Campaign, GB, or SO with Silver Medal (i.e. by completing 1 goal), 2 intelligence files are coded to be unlocked and 2 keys rewarded;
When a player completes a Campaign, GB, or SO with Gold Medal (i.e. by completing 2 goals), 3 intelligence files are coded to be unlocked and 3 key rewarded.
When a player completes 15 Campaign missions, 8 GB missions, and 8 SO missions with Gold Medals,

15*3 + 8*3 + 8*3 = 45 + 24 + 24 = 93

intelligence files are coded to be unlocked and 93 keys rewarded.

However, there are 96 intelligence files:

Image

(credits to TommyCD1 for this screenshot from his Custom Campaigns \ Missions Add-on Support mod)

Then where are the last 3 intelligence files?

I speculate that when each of the Boot Camp mission is completed, 1 intelligence file is coded to be unlocked and 1 key rewarded; and so when all 3 Boot Camp missions are completed, 3 intelligence files are coded to be unlocked and 3 keys rewarded.

To test if this thesis of mine were correct, we can examine folder (bc_s in the AMRTS PS2 version?) containing the Boot Camp missions T01.x, T02.x, & T03.x to see if there are codings in the group.cfg or in each mission's debriefing.cfg; the codings are absent in the PC version yet possibly present in in the PS2 version.

Thus far:

93 keys + 3 keys = 96 keys


Furthermore,
4 ("flooded", "tricycle", "waterway", & "sandbox") of the 8 GB missions are locked; earning medals to unlock each (as coded in file group.cfg in missions > story) will reward the player with 1 key; unlocking all 4 will reward the player with 4 keys:

Thus far:

96 keys + 4 keys = 100 keys

Even more,

All 8 SO missions are locked; earning medals to unlock each (as also coded in file group.cfg in missions > story) will reward the player with 1 key; unlocking all 8 will reward the player with 8 keys:

In the end:

100 keys + 8 keys = 108 keys
ImageImage
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests