Senior Member
Join Date: Aug 2008
Location: Miamisburg, OH
Posts: 1,322
|
I am trying to create a Kensai and at 4th level he get the ability, Ki Projection. This allows him to add 1/2 his level to several skills. This changes to equal his level at level 8. I thought I had the code, but I was wrong. here is what I did:
~ Add our level + 1 / 2 to skills. var X as number X = (field[xTotalLev].value + 1) / 2 X = round(X, 0, -1) hero.child[kBluff].field[Value].value = hero.child(kBluff].field[Value].value + X For some reason the system cant understand the last line. Anyone have any suggestions? Thanks. |
#1 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
you have a ( where a [ should be before the second kBluff.
I also recommend: #skillbonus[kBluff] += X as being a lot faster to write. |
#2 |
Senior Member
Join Date: Aug 2008
Location: Miamisburg, OH
Posts: 1,322
|
I must be doing something wrong, here is the code I have:
var X as number X = (field[xTotalLev].value + 1) / 2 X = round(X, 0, -1) #skillbonus[kBluff] += X but it is not making any changes to the Bluff skill, or any changes to anything that I can see. I know that the level is wrong, I need to determine the level of the pretige class I am using and not the level of the character. I can work on that when I get this done. |
#3 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
if you're running that script from within a class special, then field[xTotalLev].value should be the class level, not the character level. Actually, if you weren't running it from within a class special, you would have gotten a compile error, since that field is only defined for class specials.
What phase are you running it in? Since xTotalLev is set either in the Levels or Post-Levels phase, and skills are in the Post-Attributes, I recommend User Pre-Attributes for a script that needs a class level and uses it to modify a skill. |
#4 |
Senior Member
Join Date: Aug 2008
Location: Miamisburg, OH
Posts: 1,322
|
Am running the script from the Class Special tab, using the Eval Scripts option. The script does compile Ok, just doesnt seem to do anything. lol
|
#5 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
So in the eval script window, it will have a selector at the top for you to select the phase the script runs in, and a field for you to enter the priority the script runs at. What are those values?
|
#6 |
Senior Member
Join Date: Aug 2008
Location: Miamisburg, OH
Posts: 1,322
|
says Phase:first
Priority: 100 Index: 1 |
#7 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
In the first phase, xTotalLev hasn't been set yet, so it's still equal to 0. Try Phase: User Post-Levels, with the same priority (index isn't something you need to worry about - the editor will automatically assign a different index to each eval script on the same thing).
|
#8 |
Senior Member
Join Date: Aug 2008
Location: Miamisburg, OH
Posts: 1,322
|
That seems to have done it. Now I need to add it again at 8th level and give = to the kensai level for it. I'll work on that part, I have a few ideas. thanks.
Nope sorry, it was working for a while then stopped. very odd. Now it can't find the class I am working with either. It seems to want to function at 1st level even though I have selected Level Requirement 4. It also doesnt calculate correct. Using a 5th level paladin (with a buff being at 4) and add 1 level of kensai it receives a +2 Bluff bonus (The skill I am working with). I could understand a +3 shift due to 1/2 the total levels, but I dont get the +2 shift. I am using the same code that is listed above. Last edited by chiefweasel; March 28th, 2009 at 07:59 PM. |
#9 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
Actually, if it equals 1/2 your level from 4th until 8th level, and your level after that, how about:
Code:
var levels as number levels = field[xTotalLev].value if (levels < 4) then levels = 0 elseif (levels < 8) then levels = field[xTotalLev].value / 2 levels = round(levels,0,-1) endif ~If levels is greater or equal to 8, neither of the other conditions will be fulfilled, leaving it still equal to the class level. The statement I have above will make sure that nothing happens below 4th level. In terms of that +2, didn't you say you were adding a second copy to handle level 8+? Is it that both are adding the same bonus? It may also have to do with that +1 you're adding to the level before you halve it. Please elaborate on where your class and ability are missing - missing from the editor, missing fro your test character, missing from the class selection list? |
#10 |
|
|