Member
Join Date: Jul 2015
Location: Ottawa
Posts: 58
|
Ok I'll try to be clearer about the field[value] thing.
The way the Legacy items work, they reference the increment count of the Legacy adjustment. So, each Legacy item uses the code: Code:
foreach pick in hero from BaseInPlay where "thingid.pRM_LgcyRitsWndr" if (eachpick.field[pChosen].chosen.tagis[thingid.ioRMAssHnd]<>0) then field[Value].value = eachpick.field[pAdjust].value endif nexteach Code:
Rit = field[Value].value Code:
hero.child[xSneakAtt].field[Value].value Code:
hero.child[xSneakAtt].field[Value].value = hero.child[xSneakAtt].field[Value].value + 1 Code:
var HD as number HD = hero.tagcount[Hero.HitDice] var Rit as number Rit = field[Value].value if (HD >= 18) then if (Rit >= 3) then hero.child[xSneakAtt].field[Value].value = hero.child[xSneakAtt].field[Value].value + 4 elseif (Rit >= 2) then hero.child[xSneakAtt].field[Value].value = hero.child[xSneakAtt].field[Value].value + 3 elseif (Rit >= 1) then hero.child[xSneakAtt].field[Value].value = hero.child[xSneakAtt].field[Value].value + 1 endif elseif (HD >= 14) then if (Rit >= 2) then hero.child[xSneakAtt].field[Value].value = hero.child[xSneakAtt].field[Value].value + 3 elseif (Rit >= 1) then hero.child[xSneakAtt].field[Value].value = hero.child[xSneakAtt].field[Value].value + 1 endif elseif (HD >= 11) then if (Rit >= 2) then hero.child[xSneakAtt].field[Value].value = hero.child[xSneakAtt].field[Value].value + 2 elseif (Rit >= 1) then hero.child[xSneakAtt].field[Value].value = hero.child[xSneakAtt].field[Value].value + 1 endif elseif (HD >= 9) then if (Rit >= 1) then hero.child[xSneakAtt].field[Value].value = hero.child[xSneakAtt].field[Value].value + 1 endif endif So, I finally tested it just now , and it does appear to work. But I truly do not understand why... As for the ShowMenu drop-down list for Legacy Wondrous items: I'm confused how/why this script is working also. In the Editor, the actual ShowMenu selection for the Wondrous Items Legacy Adjustment is currently set to "Current Armor". When I use the script you sent me, it nevertheless shows only the Magic Items on the Hero. I changed it to check BaseWonder instead, and now it shows only Assassin's Hands. This is great! Fantastic, wunderbar! But, is there any way to add a different entry to the ShowMenu list itself? I think I understand what the script is doing (replacing the selected drop-down list with the scripted one), but if I add a new tag to the ShowMenu drop-down in the Editor, the script breaks, and shows me every wondrous item, instead of those only on my hero. How can I build a new ShowMenu slection? Thank you Sendric! I really appreciate the help and your explanations! |
#11 |
Senior Member
Join Date: Jul 2010
Posts: 3,147
|
Quote:
Code:
Rit = field[Value].value while Code:
hero.child[xSneakAtt].field[Value].value = hero.child[xSneakAtt].field[Value].value + 1 In each case you are referencing the Value field, but of two different things. If you don't include "hero.child[xxx]." before "field[Value].value" it defaults to the thing the script is written on. Two coding tips to be aware of: 1) It's often better to use "hero.childfound" instead of "hero.child". Adding found reduces the potential for error messages because it will only function if the the thing you're trying to manipulate is found on the hero. "hero.child" should only be used in cases where you know for sure the thing will always be on the hero in all situations. 2) The following two lines of code mean exactly the same thing: Code:
hero.child[xSneakAtt].field[Value].value = hero.child[xSneakAtt].field[Value].value + 1 Code:
hero.child[xSneakAtt].field[Value].value += 1 Quote:
As to why adding a new tag breaks it, I'm not sure, but I'd recommend sticking with using a script to set it. You still need to use a tag to make sure the show selection drop down appears in the adjustment, but you should use one of the pre-set ones and not a new one. You originally asked for a script that showed all magic items, which is what I provided. Are you looking for something narrower? |
||
#12 |
Member
Join Date: Jul 2015
Location: Ottawa
Posts: 58
|
Thank you Sendric! I get it now! I really appreciate the coding examples and explanations, and I'll switch my scripts to hero.childfound, because absolutely yes, these things could be used in circumstances where the scripts they're aimed at aren't available on the hero.
I had been using Magic Items, then I realised that that pulls ALL magic items, not just items, as opposed to weapons or armours. Hmm... Actually, typing this out, having a custom drop-down that snags all magic items might be better, becuase then I could use one adjustment that catches all three types, as oppsed to sepearte ones for weapons, armours, and items. Right? |
#13 |
Senior Member
Join Date: Feb 2013
Posts: 357
|
Ah, the two moods for coders everywhere:
Yes! It works! Why doesn't this work?! |
#14 |
Member
Join Date: Jul 2015
Location: Ottawa
Posts: 58
|
lol
|
#15 |
|
|