Reviving Royal Roulette

Discuss everything related to Shootmania.

Moderator: English Moderator

User avatar
weerwolf
Posts: 603
Joined: 15 Jun 2010, 21:21
Location: Wijchen, Netherlands
Contact:

Reviving Royal Roulette

Post by weerwolf »

Howdy,

This week i decided to giva a shot to port this mode to mp4.
Soon to learn that a lot has changed and parts of code depricated.
Coding was/is not easy to me and back then i wrote this mode upon the
nadeo script and looking into the standards from https://github.com/maniaplanet/game-modes

However, it seems that these scripts are not updated after some changes where
made so now im kinda stuck.

For example the RoyalPro script from which it looks like i could learn what to change/adapt
to make it work again.

Code: Select all

declare Format = Integer[];
Ik found that syntaxes changed it i should be

Code: Select all

declare Integer[] Format;
(cgbd siad : On the topic of default values, please note that structs do NOT support implicit type to value conversion and that feature is now deprecated. Please use explicit values instead in your future script)

Code: Select all

declare PlayerSpawnsPriorities = [1=>CSmMapLandmark[], 2=>CSmMapLandmark[], 3=>CSmMapLandmark[]];
This is where it get complicated for me. I do not know how to define these 3.
Cause if i use

Code: Select all

declare Integer[] PlayerSpawnsPriorities;
It will trow an out of bounds acces further in the script

Code: Select all

foreach (MapLandmark in MapLandmarks_PlayerSpawn) {
if (MapLandmark.Order <= 1)			PlayerSpawnsPriorities[1].add(MapLandmark);
else if (MapLandmark.Order == 2)	PlayerSpawnsPriorities[2].add(MapLandmark);
else if (MapLandmark.Order >= 3)	PlayerSpawnsPriorities[3].add(MapLandmark);
}
Any help / guidance is appreciated!
(or a working compiled script from which i can learn again) :P

Greetz,
WW

edit: Oh,
And when looking at RoyalFun script, wich seems to have newer code regarding this it stops at
ERR [118, 25] The procedure Hud_Load failed to complete :
Could not load Module: 'Nadeo/ShootMania/Royal/Hud.Module.Gbx'
RoyalFun::Main() [118, 25]
Which i found a topic on, but not a confirmed solution
User avatar
chco
Posts: 290
Joined: 24 Dec 2012, 09:11

Re: Reviving Royal Roulette

Post by chco »

++
Image
cgdb
Nadeo
Nadeo
Posts: 16
Joined: 23 Oct 2018, 12:33

Re: Reviving Royal Roulette

Post by cgdb »

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 :

Code: Select all

declare Type Name = InitialValue
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!
User avatar
weerwolf
Posts: 603
Joined: 15 Jun 2010, 21:21
Location: Wijchen, Netherlands
Contact:

Re: Reviving Royal Roulette

Post by weerwolf »

tnx cgdb.

For now i repacked all'old libs in the titlepack to get it up and running asap.
After spending some on diffrent voicechats, it seems the mode was missed ^^.

So, after that ill revise it to the new code in a dev pack title i guess.

It works up to the point of the custimized weapons, which load but connot be shot.
I looked again at https://doc.maniaplanet.com/actionmaker/create-a-weapon which
does not point to a problem; so it has to be somewhere else.

Maybe im overlooking something or the code has changed, so i hope u have a heads up for me

I set a global variable

Code: Select all

declare Ident[] G_Actions;
Create te action list

Code: Select all

ActionList_Begin(); //Weerwolf
G_Actions.add(ActionList_Add("ArrowHomingv2.Action.Gbx"));
G_Actions.add(ActionList_Add("Nuclearv2.Action.Gbx"));
G_Actions.add(ActionList_Add("Pulsegun.Action.Gbx"));
G_Actions.add(ActionList_Add("BeamMiniNuclearv2.Action.Gbx"));
G_Actions.add(ActionList_Add("Stuiterbal7.Action.Gbx"));
G_Actions.add(ActionList_Add("QM_MeteorShowerv3.Action.Gbx"));
G_Actions.add(ActionList_Add("Move_FireInTheHole_v1.Action.Gbx"));
ActionList_End();
Clear bindings on spawn player

Code: Select all

ActionBind(Player,CSmMode::EActionSlot::Slot_A,CSmMode::EActionInput::None);
Assign and bind the action on spawn

Code: Select all

ActionLoad(Player,CSmMode::EActionSlot::Slot_A,G_Actions[1]);
ActionBind(Player,CSmMode::EActionSlot::Slot_A,CSmMode::EActionInput::Weapon);
R_Weapon = "Nuclear Bomb";
Audio::PlaySound("file://Media/Sounds/AirAlarm.ogg", 0);
(R_Weapon is used for displaying the player which weapon it got)
The sound is playing but weapon cannot be fired
User avatar
weerwolf
Posts: 603
Joined: 15 Jun 2010, 21:21
Location: Wijchen, Netherlands
Contact:

Re: Reviving Royal Roulette

Post by weerwolf »

@cgdb
I have fooled around with the Hud Module, and it kept throwing "could not load". After checking everything on titlepack, dir structures and so on, i loaded in a module in the titlepack tools module designer and saved it. After that i could load that module, but offcourse created errors cause it was not corresponding to royal squad (the script im learning from). Overwriting this module with the module from github produces the excact same error. I did download it again and still the same. Could it be that the file on github is corrupted?
User avatar
Eole
Nadeo
Nadeo
Posts: 1265
Joined: 26 Apr 2011, 21:08

Re: Reviving Royal Roulette

Post by Eole »

Can you try with the royal squad modules from this .zip ?
Contribute to the ManiaPlanet documentation on GitHub
A question about ManiaScript? Ask it here!
User avatar
weerwolf
Posts: 603
Joined: 15 Jun 2010, 21:21
Location: Wijchen, Netherlands
Contact:

Re: Reviving Royal Roulette

Post by weerwolf »

Eole wrote: 05 Mar 2019, 14:53 Can you try with the royal squad modules from this .zip ?
Yep, loaded in without errors.
User avatar
chco
Posts: 290
Joined: 24 Dec 2012, 09:11

Re: Reviving Royal Roulette

Post by chco »

Having so much fun on Royal Roulette! Thnks WeerWolfie!
Image
User avatar
chco
Posts: 290
Joined: 24 Dec 2012, 09:11

Re: Reviving Royal Roulette

Post by chco »

Ok WeerWolf.. If I would start a Glimratten Royal Roulette server .. I guess I would need your script? (and/or a matchsettings script ?)
What else ?
Let me know and we can have fun 2night :p
Image
User avatar
weerwolf
Posts: 603
Joined: 15 Jun 2010, 21:21
Location: Wijchen, Netherlands
Contact:

Re: Reviving Royal Roulette

Post by weerwolf »

chco wrote: 16 Mar 2019, 16:16 Ok WeerWolf.. If I would start a Glimratten Royal Roulette server .. I guess I would need your script? (and/or a matchsettings script ?)
What else ?
Let me know and we can have fun 2night :p
U only need the pack ;)
Post Reply

Return to “Shootmania”

Who is online

Users browsing this forum: No registered users and 2 guests