Custom campaigns in your title pack

Discuss everything related to custom data creation.

Moderator: NADEO

Post Reply
User avatar
Alinoa
Nadeo
Nadeo
Posts: 4161
Joined: 14 Jun 2010, 11:55
Location: France, Paris
Contact:

Custom campaigns in your title pack

Post by Alinoa » 19 May 2014, 08:48

xbx wrote:Hello!

Just a quick note to hint at ways to make some kind of custom solo campaign in TM and SM.

When you create a title, instead of providing a folder with maps, and get the standard campaign menu and unlock pattern, you can provide a playlist and a script.
When the user goes into the solo campaign, the menu will be skipped and the script started with the maps provided in the playlist.

And the script can then decide which map to lead next, or display a manialink and interact with the user - before even loading the first map.
This allows for doing stuff like story mode or displaying a world map, or whatever.


Here is a very simple script with no actual gameplay that displays a list and asks which map to lead next.

Code: Select all

// *********************** ** ** *   *
// *    Test solo campagain with map list
// ******************* ** ** *   *

// (works for TM and SM)
#RequireContext CSmMode
//#RequireContext CTmMode

/*  in the title pack, set the solo maps as a playlist (instead of a campaign folder)
	<solo>
		<medals>12</medals>
		<mode name="Modes\ShootMania\TestSolo.Script.txt"/>
		<campaign folder=""/>
		<playlist name="SoloTest.txt"/>
	</solo>
*/

#Include "TextLib" as TextLib
#Include "Libs/Nadeo/Mode.Script.txt"

#Const Version 			  "2014-04-07"

// === Main ===
main() 
{
	UIManager.ResetAll();

	declare LayerMapList = UIManager.UILayerCreate();
	UIManager.UIAll.UILayers.add(LayerMapList);

	declare CurUpdateNum  = 0;

	wait(Users.count > 0);		// wait for the game to be ready
	declare LocalPlayerUI <=> UIManager.GetUI(Users[0]);
	assert(LocalPlayerUI != Null);

	while( !ServerShutdownRequested ) {

		// Manialink displayed when no map is loaded 
		//  for example: simple pick the map from list			
		CurUpdateNum += 1;
		LayerMapList.ManialinkPage = """
<frame>
<quad sizen="160 100" halign="center" valign="center" style="Bgs1InRace"  substyle="BgWindow3"/>
<label posn="-75 45 1" scale="1" halign="left" valign="center" text="Now playing: {{{MapName}}}" />
<label posn="-75 32 1" scale="2" halign="left" valign="center" text="Choose next map:" />
		""";
		declare MapIndex = 0;
		foreach (CandidateMap in MapList) {
			declare PostFix = "";
			if (MapIndex == NextMapIndex) 
				PostFix = "$z <--- next";
			LayerMapList.ManialinkPage ^= """
<label posn="-75 {{{25-5*MapIndex}}} 1" scale="1" halign="left" valign="center" text="{{{CandidateMap.Name^PostFix}}}" id="map_{{{MapIndex}}}" scriptevents="1" />
			""";
			MapIndex += 1;
		}
		LayerMapList.ManialinkPage ^= """
</frame>
<script><!--

#Include "TextLib" as TextLib

main() {
	declare netwrite SelectedMapIndex for UI = -1;
	declare netwrite UpdateNum for UI = 0;
	SelectedMapIndex = -1;
	UpdateNum = {{{CurUpdateNum}}};

	while (True) {
		yield;
		foreach (Event in PendingEvents) {
			if (Event.Type == CMlEvent::Type::MouseClick) {
				declare Parts = TextLib::Split("_", Event.ControlId);
				if (Parts.count == 2 && Parts[0] =="map") {
					SelectedMapIndex = TextLib::ToInteger(Parts[1]);
				}
			}
		}
	}
}

--></script>""";

		Synchro_DoBarrier();

		declare netread UpdateNum for LocalPlayerUI = 0 ;
		declare netread SelectedMapIndex for LocalPlayerUI = -1;
		wait(UpdateNum == CurUpdateNum && SelectedMapIndex != -1); 

		NextMapIndex = SelectedMapIndex;		// note: it's a good idea to set this as early as possible (in network games), 
												// as it allows the game to pre-download the maps & stuff on the clients.
		LoadMap();


		// === play the map
		UIManager.UIAll.UISequence = CUIConfig::EUISequence::RollingBackgroundIntro;
		sleep(10000);
		UIManager.UIAll.UISequence = CUIConfig::EUISequence::None;
		// ====


		UnloadMap();
	}

	UIManager.UILayerDestroy(LayerMapList);
}
Ubisoft Support
Your Player Page

More information about maniaplanet, support, contents, community activities: useful links

ManiaPlanet technical documentation portal (Dedicated server, Mediatracker, ManiaLink, ManiaScript, Titles...)

mvv0105
Posts: 238
Joined: 11 Jul 2013, 11:07
Location: Russia, Novosibirsk

Re: custom campaigns

Post by mvv0105 » 01 Jun 2014, 17:09

I can create SkillPoints ranking for my title? Or it's only for offical games?

User avatar
steeffeen
Translator
Translator
Posts: 2472
Joined: 14 Oct 2012, 16:22
Location: Germany

Re: custom campaigns

Post by steeffeen » 01 Jun 2014, 21:14

mvv0105 wrote:I can create SkillPoints ranking for my title? Or it's only for offical games?
it's only working for the official base games and not in title packs
an example for a custom point system can be found on http://obstacle-records.com which is tracking records and points for the obstacle title pack
    Game Mode and Title Pack Creator, Developer, ShootMania-Player & more

    ManiaControl, FancyManiaLinks

    mvv0105
    Posts: 238
    Joined: 11 Jul 2013, 11:07
    Location: Russia, Novosibirsk

    Re: custom campaigns

    Post by mvv0105 » 02 Jun 2014, 05:31

    steeffeen wrote:an example for a custom point system
    cool, but how i can create it? :)

    User avatar
    steeffeen
    Translator
    Translator
    Posts: 2472
    Joined: 14 Oct 2012, 16:22
    Location: Germany

    Re: custom campaigns

    Post by steeffeen » 02 Jun 2014, 08:04

    mvv0105 wrote:how i can create it? :)
    it's all custom code and nothing of it is offered by nadeo
    the game mode script sends the times to the central server which is calculating the points for each record to build the global ranking
    it certainly needs some work and some own creativity, but you can do whatever you want
      Game Mode and Title Pack Creator, Developer, ShootMania-Player & more

      ManiaControl, FancyManiaLinks

      User avatar
      maxi031
      Posts: 332
      Joined: 17 Jul 2011, 00:55

      Re: Custom campaigns in your title pack

      Post by maxi031 » 13 Aug 2014, 06:49

      I am creating custom campaign for tm and i have question related to this topic.
      Is there any way to display manialink while loading screen is shown(when map is loaded)?
      For me black screen is shown, even if i have CUILayer with my manialink added to UIManager.UIAll.UILayers.

      I would like to put some gameplay tips and jokes in there if possible.
      My specs:
      MOBO: MB AM3+ 970 Gigabyte GA-970A-DS3P
      CPU: AM3+ AMD FX-8320E
      GPU: Nvidia GeForce GTX750-Ti ASUS 2GB DDR5
      RAM: DDR3 8GB 1866MHz Kingston HyperX
      SSD: SATA3 120gb SanDisk
      OS: Windows 7 Profesional SP1 64-bit OS
      TY MICMO

      User avatar
      adamkooo2
      Posts: 1288
      Joined: 13 Jun 2014, 08:43
      Location: Slovakia // Slovensko
      Contact:

      Re: Custom campaigns in your title pack

      Post by adamkooo2 » 28 Dec 2014, 16:35

      maxi031 wrote:I am creating custom campaign for tm and i have question related to this topic.
      Is there any way to display manialink while loading screen is shown(when map is loaded)?
      For me black screen is shown, even if i have CUILayer with my manialink added to UIManager.UIAll.UILayers.

      I would like to put some gameplay tips and jokes in there if possible.
      It would be useful, we will be able to do custom loadscreens.
      Last edited by adamkooo2 on 06 Jul 2017, 08:31, edited 3 times in total.
      /\rkady
      Image

      User avatar
      Blueplayer
      Posts: 170
      Joined: 05 Apr 2011, 17:34

      Re: Custom campaigns in your title pack

      Post by Blueplayer » 01 Sep 2015, 17:04

      Hi, I´d like to create a custom campaign, but I already fail with the given example. The relevant part:
      xbx wrote:

      Code: Select all

      	wait(Users.count > 0);		// wait for the game to be ready
      	declare LocalPlayerUI <=> UIManager.GetUI(Users[0]);
      	assert(LocalPlayerUI != Null);
      
      Users[0] is successfully declared, but LocalPlayerUI is always Null. Is this an outdated example?


      Edit: I´ve found someone else with the same issue:
      viewtopic.php?f=515&t=27120&p=216370&hi ... UI#p216197
      Does it just not work in TM? (I don´t have SM. I can´t check it.)

      Post Reply

      Return to “Title Pack & Custom Data Creation”

      Who is online

      Users browsing this forum: No registered users and 1 guest