How many persistent side I can use in a single campaign?

The place to post your WML questions and answers.

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.
Post Reply
Argesilao

How many persistent side I can use in a single campaign?

Post by Argesilao »

Hi!

I need to know if there is a limit of the number of persistent side I can use in a campaign; I'm building a campaign where I actually use 20 persistent side (it's a bit complicated story ^_^ ) and testing one of the last scenarios I have discovered that I 'lost' the data of the first and the second sides created (the older ones).

I'm using the version 1.14.5 of the game with windows 7.

Thank for every help you can give me!
User avatar
Ravana
Forum Moderator
Posts: 3000
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: How many persistent side I can use in a single campaign?

Post by Ravana »

If you happen to run into limits, you can save their info to variables.
User avatar
josteph
Inactive Developer
Posts: 741
Joined: August 19th, 2017, 6:58 pm

Re: How many persistent side I can use in a single campaign?

Post by josteph »

He shouldn't have lost data for older sides, though, should he? We can't know if the bug is in wesnoth or in his WML code of course.
Argesilao

Re: How many persistent side I can use in a single campaign?

Post by Argesilao »

josteph wrote: October 23rd, 2018, 5:46 pm He shouldn't have lost data for older sides, though, should he? We can't know if the bug is in wesnoth or in his WML code of course.
Well, I have no idea :(

what happened was: I used a side until a certain scenario A, I did not use it in the scenarios B e C, and I used it again in the scenario D; but it turned out to be an empty side; I have not used the side in any way in scenarios B and C, but I had created some new persistent side, that's why I supposed a problem with the number of the persistent side, also because I have never used so many persistent side in the past.

Fortunately, not all the persistent sides used in the campaign are absolutely necessary, so I can reduce their number; I'll do it and I'll see what happen (all those scenarios to re-tested :annoyed: )

However, it would have been useful to know if there was a limit of the persistent side, even for future work.
User avatar
Celtic_Minstrel
Developer
Posts: 2207
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: How many persistent side I can use in a single campaign?

Post by Celtic_Minstrel »

I'm pretty sure there's no hard limit on how many persistent sides you can have, and it's definitely possible for a persistent side to go unused for a few scenarios and then come back. For starters, I'd suggest making sure all your [side] tags have a save_id that specifies which persistent side they should use (non-persistent sides won't need it of course). If that doesn't work, maybe you have some code somewhere that actually unintentionally deletes the side's info?

Without seeing actual code there's not much more I can say.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
gfgtdf
Developer
Posts: 1432
Joined: February 10th, 2013, 2:25 pm

Re: How many persistent side I can use in a single campaign?

Post by gfgtdf »

there was once a bug that made persistent sides disappear but it only effected online multiplayer and was i think fixed during 1.13
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
Argesilao

Re: How many persistent side I can use in a single campaign?

Post by Argesilao »

Celtic_Minstrel wrote: October 28th, 2018, 11:54 pm If that doesn't work, maybe you have some code somewhere that actually unintentionally deletes the side's info?
I found something very suspicious in a scenario :hmm:
I wanted to recall all the units of a side used in a previous scenario (not one of the emptied sides) and put them in the map, so I used this code:

Code: Select all

		[store_unit]
			[filter]
				side=5
				x,y=recall,recall
			[/filter]
			variable=stored_units
			kill=yes
		[/store_unit]
		{FOREACH stored_units i}
			[unstore_unit]
				variable=stored_units[$i]
				find_vacant=yes
				x,y=6,3
			[/unstore_unit]
		{NEXT i}
I had not noticed the thing before because it did exactly what I intended to achieve, but checking the code I saw that I filtered a side 5 instead of the side 1; I use only 4 sides in that scenario. I'll fixed it and I'll see what happens.
User avatar
Celtic_Minstrel
Developer
Posts: 2207
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: How many persistent side I can use in a single campaign?

Post by Celtic_Minstrel »

Logically I'd expect the use of a nonexistent side to match nothing... so if that code is deleting a side's saved data, I would classify it as a bug.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
Argesilao

Re: How many persistent side I can use in a single campaign?

Post by Argesilao »

The problem wasn't in the code in my previous post.

To find out exactly where the persistent side lost its data, I inserted a check in the code of the last scenario where the data of the side appear; this check displayed a message, at the start of the side turn, where it said the number of the unit in the recall list of the side (the side is used only in the start event of the scenario and only to recall a single unit and to pass the unit to another side). In this scenario (A) the check always return the correct value.

Then I inserted the same check in the following scenario (A+1), but in the prestart event the side it's already empty (In the scenario (A+1) I redefine the side only to can to do the check, but I didn't use it in the gameplay), so I presumed the data are lost just after the beginning of the last played turn of the scenario (A).

So I insert the check just before the endlevel event, and I'll tried to play again the scenario (A); the check returned the corrected value; the side data are lost in the endlevel event :shock:

I attached the file of the scenario (A), the 05_02 where the side's data are present, and of the scenario (A+1), the 05_03 where the data are lost.

Probably it's something of very stupid, but I don't find it :augh:
Attachments
checking.cfg
(241 Bytes) Downloaded 234 times
05_02_In_the_Heat_of_the_Night.cfg
(18.74 KiB) Downloaded 244 times
05_03_Walking_in_the_Underground.cfg
(11.37 KiB) Downloaded 243 times
Argesilao

Re: How many persistent side I can use in a single campaign?

Post by Argesilao »

I did some little experiments:

In the scenario 05_02, in the persistent side 1, I changed the controller=human with controller=ai;

Code: Select all

        # former definition of the side
	side=1
	controller=human
	no_leader=yes
	save_id=Lamis
	side_name= _ "Lamis' Gang"
	color=teal
	{FLAG_VARIANT ragged}
	team_name=Heroes
	user_team_name= _ "Lamis' gang"

        # new definition of the side
	side=1
	controller=ai
	no_leader=yes
	save_id=Lamis
	side_name= _ "Lamis' Gang"
	color=teal
	{FLAG_VARIANT ragged}
	team_name=Heroes
	user_team_name= _ "Lamis' gang"
the result was that in the next scenario, the 05_03, the persistent side 3, which was previously emptied, is now intact.

Then, always in the scenario 05_02, I restored the old definition of the side, with controller=human, but I deleted the save_id:

Code: Select all

        # new definition of the side
	side=1
	controller=ai
	no_leader=yes
#	save_id=Lamis <----- deleted
	side_name= _ "Lamis' Gang"
	color=teal
	{FLAG_VARIANT ragged}
	team_name=Heroes
	user_team_name= _ "Lamis' gang"
I got the same result as the previous attempt, the other persistent side that was emptied is no longer emptied.

Now, I always used persistent side with different save_id, so I have no idea how they can be this problem's origin.
User avatar
Celtic_Minstrel
Developer
Posts: 2207
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: How many persistent side I can use in a single campaign?

Post by Celtic_Minstrel »

I'm not entirely sure what you're getting at with that, but the save_id is supposed to uniquely represent a persistent side (if there's no save_id it defaults to the value of id). If you use a different save_id in the two scenarios it shouldn't restore the side. Or do you mean you used persistent sides with different controllers? I know of no reason why it wouldn't work to switch a persistent side from human to ai or vice versa, though. Or maybe I just misunderstood you entirely?
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
gfgtdf
Developer
Posts: 1432
Joined: February 10th, 2013, 2:25 pm

Re: How many persistent side I can use in a single campaign?

Post by gfgtdf »

also note that for ai sides re bydefault nopersistent for them to be persitent you need explcitily need write persistent=yes in that [side]
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
Argesilao

Re: How many persistent side I can use in a single campaign?

Post by Argesilao »

Celtic_Minstrel wrote: November 2nd, 2018, 12:08 am I'm not entirely sure what you're getting at with that, but the save_id is supposed to uniquely represent a persistent side (if there's no save_id it defaults to the value of id). If you use a different save_id in the two scenarios it shouldn't restore the side. Or do you mean you used persistent sides with different controllers? I know of no reason why it wouldn't work to switch a persistent side from human to ai or vice versa, though. Or maybe I just misunderstood you entirely?
During the whole campaign every side has always the same save_id and the same controller; I'm sure because I use a predefined macros to define the persistent sides.
I changed the controller of the lamis side only temporarily to do an experiment; I wanted to see what happened when I have a persistent side less.
also note that for ai sides re bydefault nopersistent for them to be persitent you need explcitily need write persistent=yes in that [side]
Ouch! :doh: A little lapse.
Post Reply