Senior Member
Volunteer Data File Contributor
Join Date: Mar 2007
Posts: 1,245
|
New question. I am making a class that only gets proficiency with light shields, not heavy ones. The code I am trying to use and which is not working quite right is....
First (Users), 10000 var result as number foreach pick in hero where "ShldClass.Light" result = each.assign[Helper.Proficient] nexteach The only problem here is that the character is not showing as proficient, so when they go to buy a light shield it is grayed out. Any better way to do this? |
#21 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
try this:
foreach thing in Armor where "ShldClass.Light" perform eachthing.assign[Helper.Proficient] nexteach foreach pick in hero where "ShldClass.Light" perform eachpick.assign[Helper.Proficient] nexteach Until an item is added to your hero - while you're seeing it in the purchase form - it's called a "thing". Once added to the hero, it becomes a "pick". So, your loop was searching through all the picks on the hero to find the light shields you own. So, add a second loop to find all the shield things as well. The exact details of a search through things differ slightly from searching picks. One thing to check before doing that is to make sure that once you purchase a light shield, but not a heavy shield, it's properly proficient with your old script. If that doesn't work, then something else is going wrong. |
#22 |
Senior Member
Volunteer Data File Contributor
Join Date: Mar 2007
Posts: 1,245
|
It gives me "Non-existent component "Armor" referenced by script" error
|
#23 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
Oops, BaseArmor, rather than Armor.
|
#24 |
Senior Member
Volunteer Data File Contributor
Join Date: Mar 2007
Posts: 1,245
|
foreach thing in BaseArmor where "ShldClass.Light"
perform eachthing.assign[Helper.Proficient] nexteach foreach pick in hero where "ShldClass.Light" perform eachpick.assign[Helper.Proficient] nexteach Now I get the error "Syntax error in 'eval' script for Thing 'fArmLgShld' (Eval script '#1') on line 2 -> Script reference is invalid under the circumstances" What circumstances? Is it because I am doing it through an Eval Script? Should I do it as an Eval Rule Instead? ... No that didn't work either. Thanks for all your help, by the way, mgehl. |
#25 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
Question - does the original script you wrote make the light shields but no the heavy shields proficient once they're purchased?
Is that good enough? |
#26 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
OK, now I'm remembering - you can't assign tags to a thing, only a pick.
I tested your original script - it does make them proficient once added, and looking at how the prereq is constructed, you'd need access to the structural files to create the tests that would look for a light shield tag. I can't think of another way to do this. |
#27 |
Senior Member
Volunteer Data File Contributor
Join Date: Mar 2007
Posts: 1,245
|
Ah. Thanks anyway. This will be good enough I suppose, I've no desire to go mucking about in the structural files.
|
#28 |
|
|