• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

Limit based on points

k9monkey

Member
I am trying to make it so I have two groups, heroes and troops. In the game you can only have 1 hero per 100 points of troops. Anyone able to help me with setting this up?

Noob,
CmB
 
You could either set up a script on the profile in the minmax or final sections or alternatively you could try stat calcs then use a tag to mark troops and hero (assuming you are using something along the lines of a "group" or "type" tag group to filter them in the display?) and then use the statval to count the number of heroes and the total points for troops then use a rule to compare and flag up errors
 
Thank you for the suggestions. I am tagging them as heroes and fighters. do you have a sample script I could put on the profiles. Sorry I am not well versed in scripting, still learning all the things I can do.

Thanks,
CmB
 
Using stat calcs and a rule would be something like:

stat calc for heroes (this will count how many heroes there are):
Unique ID: scTotHero
Scope: unit
Test expression: tagGroup.hero
Tally expression: @value = @value + 1

stat calc for fighters (this works out how many points spent on fighters):
Unique ID: scTotFight
Scope: unit
Test expression: tagGroup.fighters
Tally expression: @value = @value + this.cost[total]

Rule:
Message: You can only take one Hero for every 100 points spent on Fighters
Summary: 1 Hero per 100 points
Script:
~ define variables
var totHero as number
var totFighter as number
var upperLim as number

~ get values
totHero = statcalc[scTotHero]
totFighter = statcalc[scTotFight]
upperLim = round(totFighter/100, 0, 1)

~ check values
if (totHero <= upperLim) then

@valid = 1
endif


I've tested this and it does work, it does assume that you need Fighters to take a Hero so no Fighters = no Hero and also it works on the basis of:

0 - 100 points = 1 Hero
101 - 199 points = 2 Heroes

etc, if this assumption is wrong you can adjust the round statement so it rounds down instead

I'll put the minmax script for a profile up later on, off out now for family time :)
 
Using statcalcs and profile:

This assumes you have a profile for Heroes!

stat calc for heroes (this will count how many heroes there are):
Unique ID: scTotHero
Scope: unit
Test expression: tagGroup.hero
Tally expression: @value = @value + 1

stat calc for fighters (this works out how many points spent on fighters):
Unique ID: scTotFight
Scope: unit
Test expression: tagGroup.fighters
Tally expression: @value = @value + this.cost[total]

Profile:
Min Value: 0
Max Value: 1
Dynamic: ticked
Minmax script:
~ define variables
var totHero as number
var totFighter as number
var upperLim as number

~ get totals
totHero = statcalc[scTotHero]
totFighter = statcalc[scTotFight]
upperLim = round(totFighter/100, 0, 1)

~ set min/max, deal with no Fighters chosen first then use calculated totals
if (totFighter < 1) then

@maxvalue = 1
@maxtext = "1"
else

@maxvalue = upperLim
@maxtext = upperLim
endif

This works on the same assumption above, i.e. 0 - 100 points of Fighters = 1 Hero etc

The advantage this one has is that the user gets immediate feedback in that the profile bar will change to red immediately if they choose too many

Enjoy!
 
Back
Top