Challenger Times

A plugin by nod32

Challenger Times
Downloads 96
Updated 1 month ago
Released 1 month ago
Created 1 month ago
Numeric ID 600
Min. Openplanet 1.26.0
Signed
Game Trackmania

Adds an additional goal to Trackmania 2020 in form of an extra time to beat. Currently rather bare-bones to accompany the release of Original School club. All campaigns in that club have Challenger times - you can check how the plugin works there.

Implementation

The implementation of times is entirely local and depends on injecting a "challenger" attribute into the Community XML chunk of the Challenge.Gbx file. You can do this in GBX.NET 2 if you want your maps to have a Challenger goal:

var gbx = Gbx.Parse<CGameCtnChallenge>(mapPath);
var map = gbx.Node;

XDocument doc = XDocument.Parse(map.Xml); 
foreach (XElement element in doc.Descendants("times"))
{
  element.Add(new XAttribute("challenger", challengerTime)); // in milliseconds
}
map.Xml = doc.ToString(SaveOptions.DisableFormatting);

Remember to not resave the map in-game after, as Trackmania regenerates the chunk every time the map is saved. Likewise, the times can be read by a plugin or application just by reading that attribute back (the header is not compressed, so you can freely read the XML without decompressing the entire file).