Let's pull apart the ghost's code (here's the whole thing, since there are notes in the comments that are useful):
Code:
~we get a ghost ability for every 3 CR we have, minimum 1
~the first ability slot is always spent on Corrupting Touch, so that's a permanent bootstrap
~and not included in this list
field[cfgMax1].value += maximum(round(herofield[tCR].value/3,0,-1),1) - 1
It talks about removing the first ability slot, because Corrupting Touch is added to all Ghosts (so effectively, Corrupting Touch is a permanent power, and ghosts gain their first power at CR 6) - so, that's the -1 at the end - you can just drop that.
The next thing is a maximum(X, 1) - that's because even at CR 1, the ghost gets an ability. It looks like instead of a minimum of 1 ability, you want to add 1/3 levels, +1.
The next thing is the round(X,0,-1) - round X to 0 decimal places, -1 means down. You want to keep this.
The next thing is herofield[tCR].value - that't the CR of the character. Looking through the Reference Information page of the editor manual, the second macro described is #totallevelcount[] - which returns the level of the character.
Since I've had trouble using macros inside other expressions, it's best to make sure it'll be interpreted correctly by calling the macro by itself:
Code:
var bonus as number
bonus = #totallevelcount[]
Then, you'll want to divide that by 3 and round it down to the nearest whole number:
You'll add the ability gained at 1st level:
Assembling it all:
Code:
var bonus as number
bonus = #totallevelcount[]
field[cfgMax1].value += round(bonus/3,0,-1) + 1
Also, remember to check the Phase and Priority you're running this at - the default for a new script is First/100, which is much too early - since you need to know the Level of the character, you'll want to be in the Post-Levels phase.