Move units between campaigns

Discussion and development of scenarios and campaigns for the game.

Moderator: Forum Moderators

User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Move units between campaigns

Post by Dugi »

Because of this topic, I have an impression that some players want to be capable to take veterans from one campaign and start another campaign with them. I think that it's quite a wacky opinion considering the balance problems it would cause, but let's allow the kids to have fun. I've coded it and published it to the add-ons server. It's no masterpiece, I've written it in three hours, but it gets the job done.

If you find any bugs there, please report them here. If it prevents a campaign from working or causes immense balance problems, it's not my fault, it's because this tool was used irresponsibly.
User avatar
Lord-Knightmare
Discord Moderator
Posts: 2337
Joined: May 24th, 2010, 5:26 pm
Location: Somewhere in the depths of Irdya, gathering my army to eventually destroy the known world.
Contact:

Re: Move units between campaigns

Post by Lord-Knightmare »

Nice idea, but it could break done in case of custom units. I wanted to take my recalls from UtBS and use them in LoW. I speculate that I won't be able to do that.
Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Move units between campaigns

Post by Dugi »

It wasn't my idea, I just saw that some people would enjoy having it.

I was careful when about custom units. If some types of units on the list are not known in the campaign played, they are marked as incompatible and can't be imported. This is done for two reasons:
1. The unavailable custom units are not loaded at all. Loading them would insanely increase the download times and would require an extensive list of many many defines that are used by the large number of campaigns. Lua might cause some mess too in this case.
2. Some units contain chunks of code that can change the behaviour of a campaign significantly. One particular unit from LotI would add an item system and hack many units' advancement paths.
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Move units between campaigns

Post by Dugi »

Accidentally, this add-on was requiring the 'Wesnoth Lua Pack' add-on and did not run without it. I've made an update, it should not depend on it anymore.
Jabie
Posts: 107
Joined: December 2nd, 2010, 12:50 pm

Re: Move units between campaigns

Post by Jabie »

There are a couple of places where this would be great. Taking Konrad from the tutorial straight into the first scenario of Heir to the Throne is a pretty obvious one and wouldn't be unbalancing. Likewise putting the UtBS characters into the final scenario of Soujournings of Grog makes sense.
Zergem
Posts: 1
Joined: February 9th, 2015, 6:36 pm

Re: Move units between campaigns

Post by Zergem »

Thanks a lot! I always wanted something like this just to have fun.
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Move units between campaigns

Post by Dugi »

I have made an update. It adds a few new features:
- allows to enable hiding of incompatible units
- allows to make imported units disappear from the list to give it more of the recall feeling
- loyal and hero units are no longer heroes or loyals after being exported and imported
- unit levels are shown
BougieJacques
Posts: 5
Joined: February 27th, 2015, 1:11 am

Re: Move units between campaigns

Post by BougieJacques »

First of all, I want to thank you for this really cool add-on. I feel it covers a niche that rewards players more for going through a campaign (other than the obvious enjoyment of course).

However, as it stands, its a bit limited due to not being able to import/export custom units. The type of units that a player is most likely to want to keep are probably key characters from their respective stories. And those units are more than likely to be custom ones. Additionally I was messing around with it today and realized you cant import regular units from different Eras? From the thread and description, I thought that "custom units" meant just the one of a kind units and not everything that isnt from the Default Era.

You mention the issue would be an insane downloading time? Depending on how "insane" I would be willing to take it, since this really is a cool feature. Even if unique units are ultimately too much of a headache, is it at least possible to get grunt units from an entire era? Even if works in a similar manner to the campaigns, where you need to have the addon installed to work? I'm not a programmer so I'm not sure how difficult (or downright impossible) this request is. Irregardless, thank you for your work on this.
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Move units between campaigns

Post by Dugi »

It is not a hard task to do. But there is that technical problem that the campaign specific units are typically loaded with the campaigns, so if I made it load all kinds of campaigns available, it would spend immense time loading (loading, not downloading) them and eat several gigabytes of RAM, especially if you have a lot of campaigns available.

As far as I know, shipso is trying to make a database of units that are useful to be added via this and will be loaded alone, without other clutter. I know neither what units he included there nor if he's going to upload it, but you might want to contact him (careful, he speaks only French). You can get it and/or add your own stuff there, he knows how to do that.
You can hack campaigns quite easily to load also other resources you want:
BougieJacques
Posts: 5
Joined: February 27th, 2015, 1:11 am

Re: Move units between campaigns

Post by BougieJacques »

So that copy/paste method is just for other addon campaigns right? I was trying to see if I could put those units in one of the mainline campaigns but the layout of the -main.cfg file there seems to be different.
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Move units between campaigns

Post by Dugi »

It should work also for mainline campaigns, they just have a slightly different file structure and the _main.cfg file is slightly elsewhere. But once you get there, the workflow should be the same.
BougieJacques
Posts: 5
Joined: February 27th, 2015, 1:11 am

Re: Move units between campaigns

Post by BougieJacques »

So I finally got around to messing around with this. It seems to work better for addon campaigns that already have the extra_defines in them. For example, I added the units from Legend of the Invincibles Part 1 and To Lands Unknown into the campaign, The Legend Begins. The Legend Begins has 3 parts, each with a separate extra_defines. I pasted the same thing into each part.

The part 1 wouldnt work, it kept saying there was an error with the first scenario. Part 2 and 3 worked. The unit imported from Invincibles was also to advance correctly, but didnt keep the items. I tried to do do it for the mainline campaign, A Tale of Two brothers and The South Guard. Didnt seem to work. Additionally, when I deleted the line, AToTB would skip directly to The End screen when selected from the campaign menu. Same thing for The Legend Begins Part 1. Just reinstalled them to get them working again.

I'm guessing it had to do with where I wrote the extra_defines line. I tried writing it both "under" (pressed enter) as well as using the standard amount of space in between the lines in the _main.cfg file. Neither seemed to work.

I did notice the increase in loading time for the campaign that did work, but it wasnt that bad (4-5 more seconds), since it was only 2 campaigns.
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Move units between campaigns

Post by Dugi »

You will not get much of the Legend of the Invincibles stuff working in other campaigns. Most items' properties will stop working, inventory will be inaccessible, AMLA will stop working and many unit abilities will not work neither. You'll need more changes to get these working. If you're into the coding, you may check how it's done in The Beautiful Child campaign, it uses all of those custom units properly.
User avatar
hailweiss
Posts: 1
Joined: June 10th, 2015, 10:18 am

Re: Move units between campaigns

Post by hailweiss »

Many thanks for this.... very useful....
Had a lot fun with this.. :D
Currently, I had a Dread Bat that already survived for at least 8 campaigns......... Level up several times... And picked up some general items (mostly rings and potions )
User avatar
b_sheep
Posts: 2
Joined: September 16th, 2014, 8:37 am

Re: Move units between campaigns

Post by b_sheep »

This is one of my favorite add-ons for having fun. But since I did updated to 1.12.6 (and installed some more add-ons), it no longer works for me. I'm getting the following error:

Code: Select all

20161023 21:11:23 error scripting/lua: ...Units_Between_Campaigns/move_units_between_campaigns.lua:184: bad argument #1 to 'set_dialog_value' (translatable string expected, got nil)
stack traceback:
        [C]: in function 'set_dialog_value'
        ...Units_Between_Campaigns/move_units_between_campaigns.lua:184: in function <...Units_Between_Campaigns/move_units_between_campaigns.lua:163>
        [C]: in function 'show_dialog'
        ...Units_Between_Campaigns/move_units_between_campaigns.lua:209: in function 'cmd'
        ...snoth-1.12.6.install/share/wesnoth/data/lua/wml-tags.lua:320: in function <...snoth-1.12.6.install/share/wesnoth/data/lua/wml-tags.lua:284>
FYI I now get the same error with older versions, too.
Any suggestions?

Thanks!
Sheep
Post Reply