Create a new Era just to add a few old units?
Moderator: Forum Moderators
Forum rules
- Please use [code] BBCode tags in your posts for embedding WML snippets.
- To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Create a new Era just to add a few old units?
Hi everyone,
I'd like to design a co-op multiplayer scenario called "Gauntlet" where up to 4 players support each other as they march through a long, narrow map with a series of different climates -- a mountain zone, a water zone, a forest zone, and so on, each of which is infested with seasonally appropriate AI-controlled enemies. You win the scenario if at least one player makes it through all of the different regions and lives to touch the eastern edge of the map.
Part of the name comes from the idea that you're "running the gauntlet." The other part comes from the classic arcade game, where the available player characters were a Fighter, Cleric, Ranger, and Mage. Part of my vision for the scenario is that each player will start with one of these Level 2 leaders (Lieutenant, White Mage, Outlaw, Red Mage) and then each recruit a single unique type of Level 0 unit (Peasant, Acolyte, Ruffian, Apprentice Mage).
My immediate problem is that Acolyte and Apprentice Mage are from different Eras, and they don't seem to be pre-packaged with the default units that I'd want to make use of. (Acolyte is also statted out for Level 1 at the moment, but I know how to edit that.)
So, what do you all think is the most efficient way to get the unit graphics I want into this scenario I'm designing? It feels like overkill to create a whole Era just to hold these two extra units, and I worry that needing to download a separate Era will make people less likely to want to play my scenario, but there are so few Level 0 units in default Wesnoth that I can't think of any better ideas.
Thanks for any help you can provide!
I'd like to design a co-op multiplayer scenario called "Gauntlet" where up to 4 players support each other as they march through a long, narrow map with a series of different climates -- a mountain zone, a water zone, a forest zone, and so on, each of which is infested with seasonally appropriate AI-controlled enemies. You win the scenario if at least one player makes it through all of the different regions and lives to touch the eastern edge of the map.
Part of the name comes from the idea that you're "running the gauntlet." The other part comes from the classic arcade game, where the available player characters were a Fighter, Cleric, Ranger, and Mage. Part of my vision for the scenario is that each player will start with one of these Level 2 leaders (Lieutenant, White Mage, Outlaw, Red Mage) and then each recruit a single unique type of Level 0 unit (Peasant, Acolyte, Ruffian, Apprentice Mage).
My immediate problem is that Acolyte and Apprentice Mage are from different Eras, and they don't seem to be pre-packaged with the default units that I'd want to make use of. (Acolyte is also statted out for Level 1 at the moment, but I know how to edit that.)
So, what do you all think is the most efficient way to get the unit graphics I want into this scenario I'm designing? It feels like overkill to create a whole Era just to hold these two extra units, and I worry that needing to download a separate Era will make people less likely to want to play my scenario, but there are so few Level 0 units in default Wesnoth that I can't think of any better ideas.
Thanks for any help you can provide!
- lhybrideur
- Posts: 369
- Joined: July 9th, 2019, 1:46 pm
Re: Create a new Era just to add a few old units?
You can manually add any unit you want to your scenario. Just copy-paste the .cfg file of the units you want from the various eras in a "units" folder in your add-on folder then link it with
in the main.cfg
Code: Select all
[+units]
{~add-ons/name_of_your_scenario/units}
[/units]
Re: Create a new Era just to add a few old units?
Thank you very much; that sounds much more reasonable!
What do I do about images, sounds, etc. for units that I'm borrowing from another Era? Do they just go in userdata/data/add-ons/Gauntlet/images, and do I need to put anything in _main.cfg to tell the scenario about them?
What do I do about images, sounds, etc. for units that I'm borrowing from another Era? Do they just go in userdata/data/add-ons/Gauntlet/images, and do I need to put anything in _main.cfg to tell the scenario about them?
Re: Create a new Era just to add a few old units?
Yes to both. In your _main.cfg, you need
Futhermore, 2 important things:
- If you add units or custom races in your add-on, they should have a unique ID among all add-ons. This is to avoid conflicts. Abilities and traits on the other hand are better off without an unique id. While you place units by reffering to them by id, that's not the case for them, there an id just fills up the list in the help.
- To have the units, all players need your add-on installed. To ensure that, add require_scenario=yes inside [multiplayer].
Lastly, the same way you can ofc also add units directly from other add-ons.
Code: Select all
#ifdef MULTIPLAYER
[binary_path]
path=data/add-ons/Gauntlet/
[/binary_path]
# so that the game looks in that path for certain subdirectories containing binary files, such as images or sounds.
#endif
- If you add units or custom races in your add-on, they should have a unique ID among all add-ons. This is to avoid conflicts. Abilities and traits on the other hand are better off without an unique id. While you place units by reffering to them by id, that's not the case for them, there an id just fills up the list in the help.
- To have the units, all players need your add-on installed. To ensure that, add require_scenario=yes inside [multiplayer].
Lastly, the same way you can ofc also add units directly from other add-ons.
Try out the dark board theme.
Re: Create a new Era just to add a few old units?
Perfect, thank you! I had forgotten about the unique ID requirement, so I'm glad you reminded me.
What does it mean to add a unit "directly" from another add-on? Is that different from copying its .cfg file and art into my add-on's subdirectory?
What does it mean to add a unit "directly" from another add-on? Is that different from copying its .cfg file and art into my add-on's subdirectory?
- Pentarctagon
- Project Manager
- Posts: 5564
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: Create a new Era just to add a few old units?
Moved to WML Workshop, since this involves WML.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
take one down, patch it around
-2,147,483,648 little bugs in the code
Re: Create a new Era just to add a few old units?
When I wrote that, I was thinking along the lines of the 2nd post of this thread. Instead of copying the .cfgs, reading the files of the other add-on. One also must read the macros and movetypes used in the units before.
However, for MP it's easier: Unlike with campaigns, all MP content is behind the common
#ifdef MULTIPLAYER
, all units from all eras are accessible (thus the need for unique IDs). So, if all players have the eras you use units from installed, you don't need any code to load them, you can just use them.
The downside however: the game does not check whether all players have the add-ons and which version they have. (It does so for the scenario's add-on, the one of the era and of the add-ons containing used modifications)
So — one can add his own add-on check here, where one needs a bit the help of the other era maintainer, or copy-paste the units.
How could that look?
Code: Select all
#ifdef MULTIPLAYER
#ifhave ~add-ons/Archaic_Era/_main.cfg
# other stuff of your add-on
# if using require_scenario=yes, then your add-on needs to load for all players,
# which it does only if the other add-on is installed too
#endif
#endif
The downside of copying the WML instead is, when switching to version 1.15/1.16, the code needs to be updated at both places. And 1.15 has changes for units, just like 1.13 and 1.11 had. (Currently: removal of deprecated macros, and new stuff like [special_note] or [modify_unit_type])
Try out the dark board theme.