Senior Member
Join Date: Aug 2011
Posts: 131
|
Hi CC,
Thanks for the code, I went ahead and used the editor to create a mechanic and broke it down into two eval scripts like so. Index 1 Code:
if (hero.tagis[Race.rac89LizMa] <> 0) then foreach pick in hero from Advance where "Skill.skKnow" eachpick.field[advCost].value *= 2 nexteach endif Code:
if (hero.tagis[Race.rac89LizMa] <> 0) then foreach pick in hero where "Skill.skKnow" perform #resspent[resSkill,+,eachpick.field[trtUser].value - 1,"Hindrance Name"] var modifier as number modifier = maximum(eachpick.field[trtUser].value - eachpick.linkage[attribute].field[trtFinal].value,0) perform #resspent[resSkill,+,modifier,"Hindrance Name"] nexteach endif This seems to work, but now I am noticing something else. This is probably best explained with an example. I created a Lizard Man with a Smarts of 8 and an Agility of 10, then I added some skills This is how the skill point progression went: Boating d4 1 of 15 (14 left) Boating d6 2 of 15 (13 left) Boating d8 3 of 15 (12 left) Boating d10 4 of 15 (11 left) Boating d12 6 of 15 (9 left) this is where Boating went over the Agility die. Knowledge d4 8 of 15 (8 left) 2 skill points were taken from the 15, but only 1 was taken from the total left Knowledge d6 10 of 15 (7 left) 2 skill points were taken from the 15, but only 1 was taken from the total left Knowledge d8 12 of 15 (6 left) 2 skill points were taken from the 15, but only 1 was taken from the total Knowledge d10 16 of 15 (4 left) 4 skill points were taken from the 15, but only 2 were taken from the total Knowledge d12 20 of 15 (2 left) 4 skill points were taken from the 15, but only 2 were taken from the total Fighting d4 21 of 15 (1 left) Fighting d6 22 of 15 So it looks like the points are being subtracted from the 15 points correctly, but the total left is getting messed up somehow. While I'm thinking about it, when I tested raising a knowledge skill through the advance tab the knowledge skills ARE taking 2 minor (1 major) advance to raise, but I'm getting these error messages: Attempt to access field 'trtUser' that does not exist for thing 'advBoost1' Location: 'eval' script for Thing 'mech89Prim' (Eval Script '#2') near line 4. Attempt to access field 'trtUser' that does not exist for thing 'advBoost1' Location: 'eval' script for Thing 'mech89Prim' (Eval Script '#2') near line 6. Linkage pick 'attribute' not located for current context Location:'eval script for Thing 'mech89Prim' (Eval Script '#2") near line 6 Any ideas? -Erich p.s. Thanks very much for the help, I'm still trying to get the fancy scripting down. And I think this particular bit is pretty deep into the weeds. |
#21 |
Senior Member
Volunteer Data File Contributor
Join Date: Aug 2009
Posts: 1,549
|
OK, I'll check that and see what I missed. Thanks for the great example!
|
#22 |
Senior Member
Volunteer Data File Contributor
Join Date: Aug 2009
Posts: 1,549
|
What are your timings set for? Your code is working for me here. Effects/1000 for the first one and Traits/5000 for the second.
Oh, and for that error message, change the foreach in the second script to: foreach pick in hero where "Skill.skKnow & !Advance.?" |
#23 |
Senior Member
Join Date: Aug 2011
Posts: 131
|
Hmmmm,
This is weird. My timings were set to what you specified already, so I decided to just give things another go. Good news. For some reason the code is working as it should during character creation. After modifying that second script I no longer get errors. Bad news Now the advance isn't working correctly, advancing a knowledge skill is charging the same for lizard men as for everyone else. i.e advancing a lesser knowledge skill is taking 1/2 an advance instead of a full advance and advancing a greater knowledge skill or starting a new one is taking 1 advance instead of 2. I'm wondering, was the code you helped me with (OK, wrote for me) intended to modify advancing or adding knowledge skills after the character is locked for advancing or was it intended only for initial creation? Thanks -Erich |
#24 |
Senior Member
Volunteer Data File Contributor
Join Date: Aug 2009
Posts: 1,549
|
It gets even weirder. It works for me here.
|
#25 |
Senior Member
Volunteer Data File Contributor
Join Date: Aug 2009
Posts: 1,549
|
Sample code attached
|
#26 |
Senior Member
Join Date: Aug 2011
Posts: 131
|
I really don't get this, the code I was using was exactly the same as what you sent.
Heck it was your code . Anyway, I went ahead and completely deleted the code from the .user file and reentered it using the editor and now it works. I'm not sure what is different, unless the mechanic just had to be totally removed before it could be modified, but since it works I'm going to leave it alone. Thanks for all the help. -Erich |
#27 |
Thread Tools | |
Display Modes | |
|
|