View Single Post
Lawful_g
Senior Member
Volunteer Data File Contributor
 
Join Date: Mar 2007
Posts: 1,245

Old February 13th, 2011, 05:15 PM
I do agree that the wiki and other docs are very hard to grasp, I learned how to use the editor by copying existing things and asking for help on the forums.

Calling values starts at the hero and works its way down, each . is like an arrow to the next thing.

Dex mod is:
hero.child[aDEX].field[aModBonus].value
Start at hero -> go to hero's child Dexterity -> Go to Dexterity's field named aModBonus -> get the numeric value of that field

A - Is this for a class ability for your Mage Blade class, or a general adjustment?

B - You'll need to make 2 different adjustments. Looking at the already existing "Spells Cast Per Day" adjustment is where we will start. Open the editor and make a copy of that on the adjustment tab. It has an eval scrip, click on the button that says "Eval Script" on the upper right.

Script looks like this:

~ If we're not enabled, get out now
doneif (field[pIsOn].value = 0)

~ If nothing chosen, get out now
doneif (field[pChosen].ischosen = 0)

~ Add "the value of our pAdjust field" extra slots to our chosen class' memorize/casting max field at "spelllevel" level, where spelllevel is the value of another field
var spelllevel as number
spelllevel = field[pSpellLvl].value
field[pChosen].chosen.field[cMemMax].arrayvalue[spelllevel] += field[pAdjust].value
field[pChosen].chosen.field[cCastMax].arrayvalue[spelllevel] += field[pAdjust].value

Something you'll notice is that these do not start with hero.child[Whatever], they start directly using the values on their fields. When there is no "hero.child" the script starts looking on the thing that contains it.

So anyway, the above adds, and we can change it to subtract merely by switching the "+=" to "-=" but we need to set up some new variables as well. We need to define a value 1 below spelllevel, and we need 3 times the "pAdjust" value. The below might work:

~ create a variable named spellminus that is a number
var spellminus as number
~ spellminus is 1 less than spelllevel
spellminus = spelllevel - 1

~ ditto
var minusslot as number
~ minusslot is 3x the value of our pAdjust field
minusslot = field[pAdjust].value * 3

Now I told you it was easy to make the switch to subtraction, and now we have our variables to plug in as below:

field[pChosen].chosen.field[cMemMax].arrayvalue[spellminus] -= minusslot
field[pChosen].chosen.field[cCastMax].arrayvalue[spellminus] -= minusslot

So combining the whole script together looks like:
Lawful_g is offline   #181 Reply With Quote