Member
Join Date: Jan 2010
Posts: 47
|
First of all, I've already checked the Common Code Examples. There's something sort of like this, but the writeup was confusing. And not what I needed.
What I want to do: Let a player select 1 more Major Hindrance. Grant the player 1 additional Edge. I put this in an Eval Script: Code:
~This will offset the cost: #resmax[resHinder] += 2 Can someone please help! |
#1 |
Senior Member
Join Date: Nov 2009
Posts: 891
|
It is because there is another resource being tracked. You need to change the total number of Major Hindrances as well as the total number of Hindrances.
There is a Simple for Hindrances. I made mine replace ThingID valHinders, but you might be able to have the timing be 8005 or something and effectively override it. You can make a copy of valHinders and modify what you want. I will show my code, which has two effects: 1) It grants a total of 4 Hindrance points, but does not care if you select 4 Minors, 2 Majors, 3 Minors, 1 Major or 2 Minors, or whatever. 2) It allows me to change the total number of possible Hindrance points based on an option as chosen in the Configure Hero, where I created a radio button between a range, 3, 4, 5, or 6. 3) It allows an exception that grants a higher amount, in this case a Racial Property called Variable Mutation (It is technically a Hindrance but has no cost as the Hindrances chosen because of it create the points themselves). It sounds like you want to do something like this. How are you making it grant the free Edge for the Major Hindrance? Your chosen method will determine the "hows". My personal preference is to let the player spend the points, but maybe you do not want them to possibly get an attribute point. So if you want to go by your initial plan, my recommendation for this is to have a mechanic that watches for it. It would look for the total Hindrance points and then reduce the total rewards points by 2 while granting an edge point. Then inside the simple have it allow for a higher value of total hindrance points (my limitation value) and increase the major by 1. You would not need to play the balancing game that I am doing as it would not affect the total for Minor. Again, just use a copy of the original to steer your correctly. Validation 8000 Code:
var major as number var minor as number var limitation as number limitation = 4 ~ Take into account the options in Configure Hero if (hero.tagis[source.Hinder3] = 1) then limitation -= 1 endif if (hero.tagis[source.Hinder5] = 1) then limitation += 1 endif if (hero.tagis[source.Hinder6] = 1) then limitation += 2 endif if (hero.tagis[source.Hinder8] = 1) then limitation += 4 endif ~ Variable Mutation if (hero.tagis[RacialProp.rpVarMutnt] = 1) then limitation += 4 endif ~iterate through all hindrances and tally up the number of majors and minors ~Note: We must only tally hindrances that are user added and not an advance. foreach pick in hero from Hindrance if (eachpick.isuser + !eachpick.tagis[Advance.?] >= 2) then if (eachpick.field[hinMajor].value = 0) then minor += 1 else major += 2 endif endif nexteach ~determine our maximum number of major and minor hindrances var max_major as number var max_minor as number ~RDS SWD Max Major and Max Minor are now dynamic values max_major = minimum(major, limitation) max_minor = minimum(minor, limitation - max_major) ~if we have no more than our maximum major and minor hindrances, we're good if (major <= max_major) then validif (minor <= max_minor) endif ~synthesize our validation message appropriately @message="Maximum of " & max_major & " points worth of major and " & max_minor & " points worth of minor hindrances allowed" ~mark associated tabs as invalid container.panelvalid[edges] = 0 ~assign a tag to the hero to indicate the invalid state ~Note: This is used to color highlight the title above hindrances on the tab. perform hero.assign[Hero.BadHinders] Evil wins because good rolls poorly .... or the players are not paying enough attention to the game. |
#2 |
Member
Join Date: Jan 2010
Posts: 47
|
Okay, I tried your suggestion, but I keep getting this error:
Syntax error in 'evalrule' script for Thing 'valGenHind' (Eval Rule '#1') on line 7 -> Tag 'source.Hinder3' not defined. What did I do wrong? What I want to do: Make it so a character can take 2 major and 2 minor hindrances. That's it. That's all I need. But I've opened up the script valHinders and I can't really tell what I need to change. |
#3 |
Senior Member
Join Date: Nov 2009
Posts: 891
|
That uses a source from my 1st file. I had left it in as an example of how to mod some things. If you want to do the same, place this into a text file and change it from .txt to .1st and place it in your savage folder. C:\ProgramData\Hero Lab\data\savage
Code:
<?xml version="1.0" encoding="ISO-8859-1"?> <!-- This file contains all the user source for Civilized Savagery. --> <document signature="Hero Lab Structure"> <source id="HinCat" name="Hindrance Points at Creation" selectable="no" parent="UserParent" maxchoices="1" minchoices="1" description="Choose how many Hindrance Points that a character may select."> </source> <source id="Hinder3" name="3 Points in Hindrances (default)" parent="HinCat" sortorder="0" reportable="yes" description="Characters may have up to 3 points in Hindrances."> </source> <source id="Hinder4" name="4 Points in Hindrances" parent="HinCat" sortorder="1" reportable="yes" description="Characters may have up to 4 points in Hindrances."> </source> <source id="Hinder5" name="5 Points in Hindrances" parent="HinCat" sortorder="2" reportable="yes" description="Characters may have up to 5 points in Hindrances."> </source> <source id="Hinder6" name="6 Points in Hindrances" parent="HinCat" sortorder="3" reportable="yes" description="Characters may have up to 6 points in Hindrances."> </source> <source id="Hinder8" name="8 Points in Hindrances" parent="HinCat" sortorder="4" reportable="yes" description="Characters may have up to 8 points in Hindrances."> </source> </document> Evil wins because good rolls poorly .... or the players are not paying enough attention to the game. |
#4 |
Senior Member
Join Date: Nov 2009
Posts: 891
|
To do just the 2 minor and 2 major you will want to replace the first eval script that shows up with this one. It should work, but I did not test it so I might be wrong.
Code:
var major as number var minor as number major += 1 ~iterate through all hindrances and tally up the number of majors and minors ~Note: We must only tally hindrances that are user added and not an advance. foreach pick in hero from Hindrance if (eachpick.isuser + !eachpick.tagis[Advance.?] >= 2) then if (eachpick.field[hinMajor].value = 0) then minor += 1 else major += 2 endif endif nexteach ~determine our maximum number of major and minor hindrances var max_major as number var max_minor as number ~RDS SWD Max Major and Max Minor are now dynamic values max_major = herofield[acMaxMajor].value + (hero.tagcount[Hero.HindMajor]*2) max_minor = herofield[acMaxMinor].value + hero.tagcount[Hero.HindMinor] ~if we have no more than our maximum major and minor hindrances, we're good if (major <= max_major) then validif (minor <= max_minor) endif ~synthesize our validation message appropriately @message="Maximum of " & max_major & " points worth of major and " & max_minor & " points worth of minor hindrances allowed" ~mark associated tabs as invalid container.panelvalid[edges] = 0 ~assign a tag to the hero to indicate the invalid state ~Note: This is used to color highlight the title above hindrances on the tab. perform hero.assign[Hero.BadHinders] Evil wins because good rolls poorly .... or the players are not paying enough attention to the game. |
#5 |
Senior Member
Join Date: May 2013
Posts: 1,458
|
If you want to do this the quick-and-easy way, you don't need a script. Go to the "Personal" tab, and at the bottom, add whatever permanent adjustments you want for the selected character.
|
#6 |
|
|