Something Done about Max Level units

Brainstorm ideas of possible additions to the game. Read this before posting!

Moderator: Forum Moderators

Forum rules
Before posting a new idea, you must read the following:
Darth Fool
Retired Developer
Posts: 2633
Joined: March 22nd, 2004, 11:22 pm
Location: An Earl's Roadstead

Something Done about Max Level units

Post by Darth Fool »

A lot of discussion has gone on in http://www.wesnoth.org/forum/viewtopic. ... 3&start=60 about what to do with after max level advancement(AMLA). A while ago in this thread: http://www.wesnoth.org/forum/viewtopic. ... sc&start=0
Dave announced that he had included the necessary mechanism into WML for doing this. Still a lot of people have posted IDEAS, but no one has really done it or playtested it, I would guess largely because it is painful to implement across a lot of units at once. I decided that this needed to change, so I attach below a perl script that will allow the following:
1) people to test their proposed advancement optons with a script that can change a lot of units at once.
2) devs who like advancement options to make the changes en-masse and add them to CVS
3) Miyo (after squashing afore-mentioned devs) to remove the advancement en-masse.
4) players, who really like AMLA options, even if it doesn't get added, but are afraid that they will have to redo the WML changes over and over again everytime the unit changes in CVS, to have a script that allows them to make all their favorite AMLA changes to the upgraded units.

Code: Select all

 ./advance.pl
USAGE:
        ./advance.pl [--options ...] [--parameter value ...] file1 file2 ...
 
[--options]
        --all           change all units, trumps other change filters
        --best          add based on which is largest, hp, short or long (d*n)
        --forcehp       force adding hp advancement
        --forcelong     force adding long advancement
        --forceshort    force adding short advancement
        --help          print this message
        --minlev        allow changes to units with advanceto!=null
        --remove        remove [advancement] tags.  do not add any new ones
 
[--parameters]
        --debug         set debug level. 0=none.1=filtered units 2=all
        --desc          description of advancement (should be in quotes)
        --hpadd         amount of hp to add.  must be integer or %
        --hpweight      weight for hp when comparing strength for best
        --id            wml id for advancement.  should be unique
        --longadd       amount of damage to add to long. must be integer or %
        --max           maximum number of advancements (trumped by maxlevel)
        --maxlevel      if >0 maximum of base level + number of advancements
        --race          filter on race=value
        --shortadd      amount of damage to add to short. must be integer or %
        --usage         filter on usage=value
a typical usage might be

Code: Select all

 ./advance.pl --best --forcelong --hpadd 10% --shortadd 2 --longadd 1 --maxlevel 5 --race elf wesnoth/data/units/*.cfg 
Changing file: wesnoth/data/units/Elvish_Avenger.cfg
Changing file: wesnoth/data/units/Elvish_Champion.cfg
Changing file: wesnoth/data/units/Elvish_Lord.cfg
Changing file: wesnoth/data/units/Elvish_Marshal.cfg
Changing file: wesnoth/data/units/Elvish_Outrider.cfg
Changing file: wesnoth/data/units/Elvish_Sharpshooter.cfg
Changing file: wesnoth/data/units/Elvish_Shyde.cfg
I have also attached a tar of a test savefile using a 'Test Lich' made with this script

Some things of note:
1) all changes requested in a single run are put in a single advancement tag.
the code can be run multiple times to create multiple different advancement tags (and hence choices)
2) using '--maxlevel 10 --max 10' will cause all units which have reached the end of their advancement tree to have advancements up to level=10
where level = base level + number of advancements
2.5) using '--minlevel --maxlevel 10 --max 2' will cause all unit to have at most two advancements, level 9 units to have 1 advancement, and level 10 and higher units to have no advancement.
2.75) not using '--minlev' will only advance units that advanceto=null
3) you can use more than one advancement option, so '--forceshort --forcehp' adds to both the short and hp.
3.5) using the '--best' option is equivalent to adding a --forceX advancement where the X is based on the units current stats. A comparison is done between the units HP, short, and long max-damage where maxdamage=damage*number. For most units HP will win, with a few notable exceptions (Elvish Sharpshooter = long). If you wish to adjust the weight of hit points to count half as much, use '--hpweight 0.5'
4) you can filter on a units race and usage in which case only units that match will be changed.
5) the amount of hp, short damage, and long damage added can be either positive or negative, and can be either an absolute integer, or expressed as a percent.
Percentages for hp are evaluated as unit_hitpoints*hpadd/100
percentages for short are evaluated as damage*shortadd/100
percentages for long are evaluated as damage*longadd/100
if the resulting value^2 is less then 1 the value is set to 1(not -1 even if negative, I probably should fix this)
the percentages are based on the base units stats.

bugs/features of AMLA discovered so far:
1) currently the max_times option in the advancement tag seems to be global to the unit, so if one choice can advance X times and another Y times, both will advance the same number of times. I suspect this is a bug either in how I am using this or in the wesnoth code (not sure which).
2) currently, once you choose an advancement path, it rules out any choice in the future. This may be a feature :) It would be nice if their was a tag that could be used to specify that choices would be available when the AMLA'd unit advances again.
3) I am obviously using the id and description tags wrong, since nothing shows up next to the unit when displaying the choices for advancement. If Dave corrects me on the proper usage (or I can dig through the code to figure out on my own) I will fix this in a future release.

Enjoy
Invisible Philosopher
Posts: 873
Joined: July 4th, 2004, 9:14 pm
Location: My imagination
Contact:

Post by Invisible Philosopher »

One thing that would be a possibility that your script does not appear to allow is, each time the unit advances, increase the amount of XP needed to advance again. Do what you want with that comment. :)
Play a Silver Mage in the Wesvoid campaign.
Bandobras
Posts: 51
Joined: August 20th, 2004, 7:49 pm
Location: Poland

Post by Bandobras »

How nice of you Darth Fool!

What a pity this comes after I decided I have no time for Wesnoth for a month or two (I have read your post only because I succumbed the last time :) ). I hope to return to a much nicer game (and with no forks).
Darth Fool
Retired Developer
Posts: 2633
Joined: March 22nd, 2004, 11:22 pm
Location: An Earl's Roadstead

Post by Darth Fool »

Invisible Philosopher wrote:One thing that would be a possibility that your script does not appear to allow is, each time the unit advances, increase the amount of XP needed to advance again. Do what you want with that comment. :)
That sounds like a good idea. I also plan on adding an extra parameter, --bestadd, that will be a quantity added to whichever quantity (hpadd, shortadd, longadd) that --best chooses for a unit. so '--hpadd 3 --shortadd 3 --longadd 3 --best add 5' would give you 8 bonus in the best quantity and 3 bonus in the other two. Not that I expect anyone else to use this (96 viewings and no downloads!)
Pickslide
Art Contributor
Posts: 119
Joined: July 4th, 2004, 2:21 am
Location: Richmond, VA

Post by Pickslide »

Very nice, I've grabbed a copy but I don't do all that much with stats right now. But don't think this script is going unappreciated!

On a side note, since almost everything in Wesnoth is basically a text file, this kinda thing could probably be implemented into a Wesnoth data editor with some sort of portable GUI and stuff? With cool features like this for devs...

Oh oh! I know I'm rambling but maybe a GUI frontend for standardized perl scripts for extendability...time to go think about this I guess...

Anyway thanks!
ebo
Posts: 81
Joined: May 6th, 2004, 3:29 pm

Post by ebo »

Is there any way to set the max_times=-1 so that it can level up forever?
ebo
Posts: 81
Joined: May 6th, 2004, 3:29 pm

Post by ebo »

Sorry to bother you. I found that it works if I just change line 260 to

Code: Select all

if($max<-1){
from

Code: Select all

if($max<0){
Darth Fool
Retired Developer
Posts: 2633
Joined: March 22nd, 2004, 11:22 pm
Location: An Earl's Roadstead

Post by Darth Fool »

Cool, I will make sure to incoporate that change into the next release.
ebo
Posts: 81
Joined: May 6th, 2004, 3:29 pm

Post by ebo »

I wanted to change the experience required to level from 500 to 100 and to give them 5hp every time they level indefinetly. So I created this little shell script. I don't know perl. I just modified a script that someone else gave me that did something else. There is probably a better way than my script. There are also a few units specifically the Elvish Shyde and Halbardier that need 400 xp to level. I also made it so that the Sea Orc does not need just 1 xp to level.

EDIT: I should mention that this needs my change to the advance.pl file to work
Darth Fool
Retired Developer
Posts: 2633
Joined: March 22nd, 2004, 11:22 pm
Location: An Earl's Roadstead

Post by Darth Fool »

good idea. I'll try and add another switch to the next release (hopefully this weekend sometime) that will allow you to set all of the experience tags on units that you are changing.
Darth Fool
Retired Developer
Posts: 2633
Joined: March 22nd, 2004, 11:22 pm
Location: An Earl's Roadstead

Post by Darth Fool »

OK, I have a new version of the advance.pl

new options include:

Code: Select all

        --nopre         do not add advancements to units that already have one
        --bestadd       amount to add to best. must be integer or %
                               if different type then best, assume both are%
        --xp_base       reset experience to xp_base + xp_level*level
        --xp_level      reset experience to xp_base + xp_level*level
        --xpadd         change in experience.  must be integer or %
I have also changed the way % works so that it uses the in game % instead of calculating it in the script.

The script will add advancements into [female] tags if there is one.

The bestadd option allows you to do '--best --bestadd 10%' without having to define hpadd, shortadd, or longadd. I wasn't sure what to do if you defined bestadd to be a % and hpadd to be an int, so I just said that we will take them both as percentages. I suppose this could be improved upon, and I might do it if I come up with any other creeping features for this slowly bloating perl script.

I think that I have now incorporated the possibility to use all the different proposed after-max-level-advancements, so people who want it, have no excuse not to try out their favorite method and provide feedback to dave and the rest of us about how that method makes the game more or less balanced/enjoyable.

One option that I am considering is giving AMLA bonuses on long and best to all elves, hp to all undead, short damage to orcs, and have humans actually have -% on all stats except a minor boost to their 'best' one, since they aren't immortal...

oh well, enjoy....

edit: one additional note.
the --xp_base and xp_level only effect the base unit, not the advancements. I put the combo in, since I figured that if a unit ended its advancement at level 2 you might want a different experience needed to advance than a third level unit.
ebo
Posts: 81
Joined: May 6th, 2004, 3:29 pm

Post by ebo »

Thanks, I really liked the script. Thanks for adding those new options. The script does not work for units that have variations though such as Lord, and Battle Princesess.

I use the following to make all units get 5hp everytime they level past the final level. They need 25 times their level xp to level.

Code: Select all

./advance.pl --forcehp --hpadd 5 --max "-1" --xp_level 25 --xp_base 0 *.cfg
Quisar
Posts: 1
Joined: February 21st, 2005, 9:25 am

Post by Quisar »

Is the perl script still available ? I do not see where to download it.
Darth Fool
Retired Developer
Posts: 2633
Joined: March 22nd, 2004, 11:22 pm
Location: An Earl's Roadstead

Post by Darth Fool »

I will search for my copies of the script and repost them. There was a server failure a few months ago where all uploaded data was lost.
Darth Fool
Retired Developer
Posts: 2633
Joined: March 22nd, 2004, 11:22 pm
Location: An Earl's Roadstead

Post by Darth Fool »

ok, here is the latest version that I could find of the perl script to do modify units for AMLA. I don't know how well it will work for recent builds, but it can easily serve as a base for people who really want this feature.

edit: I have also added a link to this thread in the external utilities wiki
Attachments
advance.pl.gz
(3.07 KiB) Downloaded 624 times
Post Reply