Hi, I don't know much about theses specific scripts so I'm not 100% sure what I'm writing is correct (and I can't verify right now because I'm not at the office today, of course), but here are some quick thoughts on the subject :
- I think the correct declaration for PlayerSpawnPriorities is :
Code: Select all
declare CSmMapLandmark[][Integer] PlayerSpawnsPriorities = [1=>[], 2=>[], 3=>[]];
- Nadeo/ShootMania/Royal/Hud.Module.Gbx can be found here :
https://github.com/maniaplanet/game-mod ... Module.Gbx but you may want to try to load an other HUD instead (more on that below).
So that was the short version, but let's go a bit further for the sake of completeness :
- The basic variable declaration in ManiaScript is :
There's two ways to make it even simpler. If you don't specify an initial value then the script will use a default value (0 for an Integer, "" for a Text, you get the idea). If you don't specify a type, then the script compilation will try to deduce it from the given initial value.
So let's work on correctly declaring PlayerSpawnPriorities. When it's used as a value, CSmMapLandmark[] roughly means "this an array meant to store CSmMapLandmark objects but right now it's empty", so we can write :
Code: Select all
declare PlayerSpawnsPriorities = [1=>[], 2=>[], 3=>[]];
But is it enough? When compiling this line the script engine will try to deduce the type from the value [1=>[], 2=>[], 3=>[]] but it can't guess that the inner arrays [] will contains CSmMapLandmark objects so we will have to help it by writing the type. We can see it's an associative array with 3 key-value pairs. The keys are Integers (1, 2, 3) and the values are of type CSmMapLandmark[]. The type of an associative array is ValueType[KeyType], so in the case of PlayerSpawnPriorities it's CSmMapLandmark[][Integer]. Note that the default value of a CSmMapLandmark[][Integer] is [] so we must keep the initial value [1=>[], 2=>[], 3=>[]].
On a side note, if you want to try to optimize a bit this code, if no key-value pairs is removed or added to the outer array in this script (again i can't check the script thoroughly right now so I can't say it never happens), then it may be possible to rewrite this variable as :
Code: Select all
declare CSmMapLandmark[][] PlayerSpawnsPriorities = [[], [], []];
In this case the keys (or indices) of this array are 0, 1 and 2 instead of 1, 2 and 3 so there're other parts of the code to rewrite. Nothing critical, only do this if you want to practice ManiaScript a bit further.
- I would guess the Hud.Module.Gbx file is included in the
Royal titlepack, so if you execute the script outside of this titlepack the Hud_Load procedure will indeed fail. You can download the HUD I linked above, but Hud_Load won't look into your Maniaplanet user directory (this is to avoid cheaters using their own tweaked HUD), so you may have to test the script inside the Royal titlepack (where the HUD module will be found) or create your own similar titlepack.
An alternative solution would be to try using an other HUD module instead. You can check which modules exist in the base ShootMania game by launching ShootMania and going in Tools > Titles tools > Module studio and trying to open a file. Once you have found a suitable module, search "Nadeo/ShootMania/Royal/Hud.Module.Gbx" in the script (usually you have to search for a #Const C_HudModulePath near the begininng of the file) and replace it by the path of the module you have (for example "Nadeo/ShootMania/Melee/Hud.Module.Gbx"). I'm not saying it will always work, and it may not be exactly the same HUD, but I think it's worth trying.
Good luck, I hope I could answer a few questions!