Exp carryover for units of different sides.
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.
-
- Posts: 153
- Joined: September 5th, 2018, 5:21 pm
- Location: Albania
Exp carryover for units of different sides.
So the deal is i want to make it so that the units of side 1 and 2 after scenario 1 ends, to carryover to the next scenario while retaining their exp and being part of side 1 in the next level. But how to do that?
Competitive Wesnoth. For the fans by the fans.
- lhybrideur
- Posts: 369
- Joined: July 9th, 2019, 1:46 pm
Re: Exp carryover for units of different sides.
I would say the easiest way is to add a event at the end of your scenario changing the side of the units of side 2 to side 1
something like
I didn't check if this work though.
something like
Code: Select all
[event]
name=victory #maybe something a bit earlier
[store_unit]
[filter]
side=2
[/filter]
variable=fixing
[/store_unit]
{FOREACH fixing i}
[modify_unit]
[filter]
id=i.id
[/filter]
side=1
[/modify_unit]
[unstore_unit]
variable=fixing[$i]
find_vacant=no
[/unstore_unit]
{NEXT i}
{CLEAR_VARIABLE fixing}
[/event]
Re: Exp carryover for units of different sides.
In general, using [store_unit] to change unit values is mostly not anymore necessary nowadays.
In this particular situation, there's a neat trick with it though.
When units change their side, they change also their team color.
But, as we know that side 2 will not persist past this scenario, we can store a copy of side 2 units on side 1's recall list, and leave the units on the field unchanged. The recall list itself cannot be viewed in linger mode (after winning the scenario), so this trick is invisible to the player.
In this particular situation, there's a neat trick with it though.
When units change their side, they change also their team color.
But, as we know that side 2 will not persist past this scenario, we can store a copy of side 2 units on side 1's recall list, and leave the units on the field unchanged. The recall list itself cannot be viewed in linger mode (after winning the scenario), so this trick is invisible to the player.
Code: Select all
[store_unit]
[filter]
side=2
[/filter]
variable=fixing
[/store_unit]
[foreach]
array=fixing
[do]
[set_variable]
name=this_item.side
value=1
[/set_variable]
[unstore_unit]
variable=this_item
x,y=recall,recall
[/unstore_unit]
[/do]
[/foreach]
Try out the dark board theme.
-
- Posts: 153
- Joined: September 5th, 2018, 5:21 pm
- Location: Albania
Re: Exp carryover for units of different sides.
Yeah, also the units im talking about are going to be spawned right off the start. So i don't want them to be in the recall list.
Competitive Wesnoth. For the fans by the fans.
Re: Exp carryover for units of different sides.
Then just store them, and in next scenario unstore.
Re: Exp carryover for units of different sides.
Check out the code for Wild Frontiers it stores the map, gold, villages and units for all sides and restores them all on the next scenario.
look for STORE_MAP_AND_UNITS and RESTORE_MAP_AND_UNITS
https://github.com/virtualghetto/Wild_F ... macros.cfg
look for STORE_MAP_AND_UNITS and RESTORE_MAP_AND_UNITS
https://github.com/virtualghetto/Wild_F ... macros.cfg