• 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

Ghost Powers

Frodie

Well-known member
Ok, what I am trying to do is give xyz Template a choice of a Special Ability 1 at first level and then again every 3 levels starting at 3rd level, (i.e. Special Ability gained at level 1,3,6,9,12,15,18)

Here is the script I copied from the Ghost, but it doesn't seem to work:


~we get a Aware Power for every 3 CR we have, minimum 1
field[cfgMax1].value += maximum(round(herofield[tCR].value/3,0,-1),1) - 1
 
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:

Code:
round(bonus/3,0,-1)
You'll add the ability gained at 1st level:

Code:
round(bonus/3,0,-1) + 1

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.
 
Back
Top