Referencing custom modules in a gamemode

You can talk about ManiaScript for ManiaPlanet here

Moderator: English Moderator

Post Reply
User avatar
Voyager006
Posts: 93
Joined: 16 Jun 2010, 13:39
Contact:

Referencing custom modules in a gamemode

Post by Voyager006 » 22 Jun 2017, 22:49

Hey folks,

Does anyone know if it's possible to reference a user made module in a gamemode script? The method in mind is Hud_Load(Text ModuleName). Since the current official gamemodes use modules, I'd figure to use them as well. The current workaround is to set up the scoretable manually in the script like it was done before.

An example of how the constant is used in TimeAttack.Script.txt:

Code: Select all

#Const C_HudModulePath "Nadeo/TrackMania/TimeAttack/Hud.Module.Gbx" ///< Path to the hud module
which references a zipped module in ProgramData. I've created a scoretable module called ScoreTable.Module.Gbx and referenced it in another module called Hud.Module.Gbx. The modules are stored in Documents\ManiaPlanet\Modules\MyGameMode, but the game can't find them (or I don't know how to properly reference them...).

I've tried the following paths without any success:

Code: Select all

"MyGameMode/Hud.Module.Gbx"
"Modules/MyGameMode/Hud.Module.Gbx"
"D:/Documents/ManiaPlanet/Modules/MyGameMode/Hud.Module.Gbx"
I also tried following this page and used the following paths without any success either:

Code: Select all

"file://MyGameMode/Hud.Module.Gbx"
"file://Modules/MyGameMode/Hud.Module.Gbx"
"file://D:/Documents/ManiaPlanet4/Modules/MyGameMode/Hud.Module.Gbx"
Any suggestions? :)
In-game voyager006
Discord Voyager006#8530
Mania Exchange Voyager006

Windows 10 | i7-920 | GTX 1060 6GB | 1920x1080 @ 60Hz | 1TB HDD | 8GB DDR3 | DirectX 12

User avatar
Eole
Nadeo
Nadeo
Posts: 1265
Joined: 26 Apr 2011, 21:08

Re: Referencing custom modules in a gamemode

Post by Eole » 26 Jun 2017, 13:37

Hi!

You should be able to use modules in your own game modes scripts. Your module must be placed in the Modules directory of your Documents folder.

Code: Select all

D:/Documents/ManiaPlanet/Modules/MyGameMode/Hud.Module.Gbx
Then you can load the module.

Code: Select all

***Match_Settings***
***
// Disable the loading of the default hud 
// and let you load your own
MB_Settings_UseDefaultHud = False;
***

***Match_LoadHud***
***
// Load you own module
Hud_Load("MyGameMode/Hud.Module.Gbx");
***
When you did this, what was the error? The script said that it could not find the module file?
Contribute to the ManiaPlanet documentation on GitHub
A question about ManiaScript? Ask it here!

User avatar
Voyager006
Posts: 93
Joined: 16 Jun 2010, 13:39
Contact:

Re: Referencing custom modules in a gamemode

Post by Voyager006 » 26 Jun 2017, 16:34

Thank you for replying! :thx:

This is the error I get when attempting to use the module:

Image

The same error message (could not load module) is displayed if the path is clearly wrong (e.g. "erronob/Hud.Module.Gbx"). Default hud is off as shown in the picture.

The module is placed in the following folder:

Image

I tried changing my personal data path to the default value (through the Launcher) but it had no effect.

In case other factors lead to this error, here is the script I'm working on. Note that it's in a very experimental phase. :P
In-game voyager006
Discord Voyager006#8530
Mania Exchange Voyager006

Windows 10 | i7-920 | GTX 1060 6GB | 1920x1080 @ 60Hz | 1TB HDD | 8GB DDR3 | DirectX 12

tcq
Posts: 2717
Joined: 15 Jun 2010, 11:02

Re: Referencing custom modules in a gamemode

Post by tcq » 26 Jun 2017, 18:54

Just a dumb question. If you see the successfully loaded scripts, they all show up like this.

Code: Select all

Libs/Nadeo/TrackMania/TM2.Script.txt
You load your module with

Code: Select all

Rally/Hud.Module.Gbx
But the error shown has the "/" inverted.

Code: Select all

Could not load Module: 'Rally\Hud.Module.Gbx’
Maybe it's just a problem with the loading of representation of the error, or maybe I would try it once with a different path where I would replace / with \.
Might be worth a try, but I doubt it will change anything.

User avatar
Voyager006
Posts: 93
Joined: 16 Jun 2010, 13:39
Contact:

Re: Referencing custom modules in a gamemode

Post by Voyager006 » 26 Jun 2017, 21:21

Tried it now, with one backslash:

Image

With two backslashes:

Image

:P
In-game voyager006
Discord Voyager006#8530
Mania Exchange Voyager006

Windows 10 | i7-920 | GTX 1060 6GB | 1920x1080 @ 60Hz | 1TB HDD | 8GB DDR3 | DirectX 12

User avatar
Guerro323
Posts: 610
Joined: 14 Jun 2014, 15:51

Re: Referencing custom modules in a gamemode

Post by Guerro323 » 26 Jun 2017, 22:21

As far as I know, you need to use a custom titlepack by you and put your modules in the worktitles/title folder (the script too)
C'est Grandiose!
Image

User avatar
Eole
Nadeo
Nadeo
Posts: 1265
Joined: 26 Apr 2011, 21:08

Re: Referencing custom modules in a gamemode

Post by Eole » 28 Jun 2017, 13:06

Guerro323 wrote:
26 Jun 2017, 22:21
As far as I know, you need to use a custom titlepack by you and put your modules in the worktitles/title folder (the script too)
Indeed, I forgot about that, sorry. Modules need to be bundled into a title in the end. So you might need to be in a title environment during development to access the modules. You can try to create an empty title pack and put your files into WorkTitles\TitleName@YourLogin\ with the same architecture that the Documents folder.
Contribute to the ManiaPlanet documentation on GitHub
A question about ManiaScript? Ask it here!

User avatar
Voyager006
Posts: 93
Joined: 16 Jun 2010, 13:39
Contact:

Re: Referencing custom modules in a gamemode

Post by Voyager006 » 28 Jun 2017, 20:26

Allright, that is not really clear but I guess it's how it works :P Hopefully the gamemode can be used in the standard Trackmania2 titles at a later point ;)
In-game voyager006
Discord Voyager006#8530
Mania Exchange Voyager006

Windows 10 | i7-920 | GTX 1060 6GB | 1920x1080 @ 60Hz | 1TB HDD | 8GB DDR3 | DirectX 12

User avatar
Eole
Nadeo
Nadeo
Posts: 1265
Joined: 26 Apr 2011, 21:08

Re: Referencing custom modules in a gamemode

Post by Eole » 29 Jun 2017, 12:55

If the gamemode includes custom resources like sounds, pictures or modules, they must be distributed to the players. So a title pack will almost be mandatory.
Contribute to the ManiaPlanet documentation on GitHub
A question about ManiaScript? Ask it here!

Post Reply

Return to “ManiaScript”

Who is online

Users browsing this forum: No registered users and 1 guest