looking to even things up but need help doing it

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

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
leonstrider
Posts: 2
Joined: October 29th, 2009, 9:55 am

looking to even things up but need help doing it

Post by leonstrider »

was wondering if someone could help me with this i am trying to edit the experience gain to where it gives more experience to weaker units killing stronger ones and less exp to stronger units killing weaker ones

example of what im talking about in mathmatical senses
(base experience multiplied by defeated units level) divided by killing units level equals experience gained rounded down to the nearest whole number

further example
(10*1)/3=3.33=3 experience gained same as in (10*1)/2=5=5 experience gained
or (10*3)/1=30=30 experience gained

hope that clearifies things up a bit but i was wondering first if this is possible in wml or not and second how would i write that for it to work correctly im trying to even things up a bit for campaings where a lvl 10 cant just masacre a field of lvl 1s and keep on going and to where a lvl 1 can advance faster for killing a stronger unit *more or less trying to balance things out*

User avatar
zookeeper
WML Wizard
Posts: 9741
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: looking to even things up but need help doing it

Post by zookeeper »

Well, it's gonna be really complicated to make that work due to all sorts of corner cases you have to deal with, such as if the unit normally would get enough XP from a kill to level up but now won't.

You should start with last breath, die and/or attack end events and first figure out at what point in the sequence the unit's XP is actually incremented and whether you can simply decrement the XP of a unit which would be about to level to cancel the levelup or not.

leonstrider
Posts: 2
Joined: October 29th, 2009, 9:55 am

Re: looking to even things up but need help doing it

Post by leonstrider »

i would like the syntax to calculate the information its given first then apply it to the "experience meter"

User avatar
Gambit
Loose Screw
Posts: 3266
Joined: August 13th, 2008, 3:00 pm
Location: Dynamica
Contact:

Re: looking to even things up but need help doing it

Post by Gambit »

http://wiki.wesnoth.org/ReferenceWML
Column on the right: lookup the following tags.

[event]
[store_unit]
[if]
[variable]
[then]
[else]
[unstore_unit]
Also search the wiki for FormulaAI

And as zookeeper said it will take some trial and error for figuring out when to modify things.
You want to store them before they get exp. Then modify the exp on that unit and unstore it AFTER the exp gain in the game.

If the game won't let you store before and unstore after then you'll have to calculate how much exp they got and subtract before you add in your values. This will be a massive pain though...

User avatar
Rhishisikk
Posts: 214
Joined: August 12th, 2008, 4:58 pm
Location: As Contract Demands
Contact:

Re: looking to even things up but need help doing it

Post by Rhishisikk »

Well, couldn't he just add negative XP before the unit levels, if he wants less XP that would prevent it from leveling? Or am I just over-simplifying again?
Typhon Rhishisikk

If a man has a talent and cannot use it, he has failed. - Thomas Wolfe
Wesluck (TM): Guaranteed unlike any other luck, anywhere else. - Typhon

Main Projects: ANL: Universal (era), Gambit's Empire Builder

User avatar
solsword
Code Contributor
Posts: 291
Joined: January 12th, 2009, 10:21 pm
Location: Santa Cruz, CA
Contact:

Re: looking to even things up but need help doing it

Post by solsword »

Subtract-beforehand might be problematic because it would sometimes result in (temporary) negative experience numbers. I'm not sure how the game handles these.
The Knights of the Silver Spire campaign.

http://www.cs.hmc.edu/~pmawhorter - my website.

Teamcolors for everyone! PM me for a teamcolored version of your sprite, or you can do it yourself. If you just happen to like magenta, no hard feelings?

Post Reply