• 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

How to make an Adjustment that can choose from Current Armor?

draco963

Well-known member
Hi everyone. I'm trying to make an Adjustment that can select from the hero's current armour. The Adjustments already include an Armor of Legacy option, and when examing it as a copy, it's already set up to use the Show Menu called "Current Armor." But, that list always shows "-No Selection-" on the hero.

I figure something is wrong with that "Show Menu" option, but I cannot figure out what, nor where those Show Menu options are programmed. So, I'm kinda stuck.

Can anyone point me in the right direction?
 
Ya, when checking the Field Hoistories for the Armor and Weapon of Legacy adjustments, the field "pCandExpr" for WoL shows "component.BaseWep & !Helper.Static". But the same filed on the AoL adjustments shows "FALSE".

I think something's wrong with the ShowMenu choice "Current Armor", but I don't know how ot fix that...
 
Ya, when checking the Field Hoistories for the Armor and Weapon of Legacy adjustments, the field "pCandExpr" for WoL shows "component.BaseWep & !Helper.Static". But the same filed on the AoL adjustments shows "FALSE".

I think something's wrong with the ShowMenu choice "Current Armor", but I don't know how ot fix that...

Hmm....looks like a core bug issue. Try adding this script to the adjustment:

Pre-Levels/10001
Code:
field[pCandExpr].text = "component.BaseArmor & !Helper.Static"
 
Thanks Sendric. I actually figured something out at around 4am:

The existing adjustments for Legacy checks use the bootstrapped feats to run the expression "component.BaseWep & User.Legacy". So, if I make duplicates of the Legacy adjustment, one for Armour and one for Wondrous items, and then duplicates of the associated feats, one set running "component.BaseArmor & User.Legacy" and one set running "component.BaseWonder & User.Legacy", everything seems to work correctly.

New problem I've run into: the count is now all messed up. Each bootstrapped feat in the adjustment has the following condition attached:
Code:
fieldval:pIsOn<>0 & fieldval:pAdjust>=1
(and >=2 and >=3 for the succesive feats). Now, in the original adjustment, that works properly, adding on the appropriate feats to the hero when the adjustment count is 1, 2, or 3 respectively.

However, in mine, things have gone wonky; the Least feat only shows when the count is zero, and then disappears. Lesser kicks in a 3 instead of 2, and Greater isn't showing at all.

Just sat down to keep hammering at this. Ideas and pointers more than welcome. Thanks Sendric! You always save my ass when I get stuck in this stuff...
 
More info: from mucking about, I've discovered that the bootstrapped feats pop up if I force a different armour/weapon/item selection. It seems that just increasing the increment of the adjustement doesn't trigger adding the new feat. I don't know if there's a way to "fix" that, or if it's a limitation of the software.
 
More info: from mucking about, I've discovered that the bootstrapped feats pop up if I force a different armour/weapon/item selection. It seems that just increasing the increment of the adjustement doesn't trigger adding the new feat. I don't know if there's a way to "fix" that, or if it's a limitation of the software.

Could be a timing issue. At what time are you running the bootstrap condition? I would compare that to when the pAdjust value is being set.

I can't say I've ever tried to bootstrap things to an adjustment like this. Out of curiosity, may I ask what it is you're trying to do?
 
A couple of years ago, I started trying to make Weapons of Legacy in HeroLab. Chemosh, I think, helped me get started, and I've been using the way he did things ever since. The d20 package includes what very basic work got sorted at that point, and that's where the adjustment came from.

My programming skills are very limited (like, I have to experiment today to see if =+1 is a valid argument), so I just rolled with how he progrmmed it. I still don't really understand what bootstrapping is, I just kind of... use it.

So, WoL are items whose bonuses grow as the hero levels up. The way it's structurally set up, the item gains abilities based on both the hero's level and whether they've attained a certain feat (the feat is gained through storyline actions). So, you've got a magic dagger, it does fancy stuff. If the hero (for lack of a better description) "bonds" with it, the dagger does even fancier stuff, and gets cooler as the hero levels up. Up to a point (level 11); after that, the dagger stops getting fancier, unless the hero "improves" their bond to the item. Once that second-level bond is achieved, the weapon starts getting fancier again, as the hero levels up. This process repeats at level 17.

So, I'm programming in custom Weapons (and Armours and Items) of Legacy (I know, I know, OP af, it's the campaign), and trying now to get the Items to structurally function the same as the Weapons. That is, get the adjustment working, get the Items/Armours relying on the feat attainment instead of simply progressing up by hero level. And so I'm encountering this minor timing bug.

I think it might be better (simpler/effecient) to have the various abilities and bonuses attached to the weapons/items check if the relevant feat has been attained, but I also suspect that Chemosh set up this adjustment system because directly checking feats is unwieldy, or immpossible?

Anyways, that's what I'm at.
 
A couple of years ago, I started trying to make Weapons of Legacy in HeroLab. Chemosh, I think, helped me get started, and I've been using the way he did things ever since. The d20 package includes what very basic work got sorted at that point, and that's where the adjustment came from.

My programming skills are very limited (like, I have to experiment today to see if =+1 is a valid argument), so I just rolled with how he progrmmed it. I still don't really understand what bootstrapping is, I just kind of... use it.

So, WoL are items whose bonuses grow as the hero levels up. The way it's structurally set up, the item gains abilities based on both the hero's level and whether they've attained a certain feat (the feat is gained through storyline actions). So, you've got a magic dagger, it does fancy stuff. If the hero (for lack of a better description) "bonds" with it, the dagger does even fancier stuff, and gets cooler as the hero levels up. Up to a point (level 11); after that, the dagger stops getting fancier, unless the hero "improves" their bond to the item. Once that second-level bond is achieved, the weapon starts getting fancier again, as the hero levels up. This process repeats at level 17.

So, I'm programming in custom Weapons (and Armours and Items) of Legacy (I know, I know, OP af, it's the campaign), and trying now to get the Items to structurally function the same as the Weapons. That is, get the adjustment working, get the Items/Armours relying on the feat attainment instead of simply progressing up by hero level. And so I'm encountering this minor timing bug.

I think it might be better (simpler/effecient) to have the various abilities and bonuses attached to the weapons/items check if the relevant feat has been attained, but I also suspect that Chemosh set up this adjustment system because directly checking feats is unwieldy, or immpossible?

Anyways, that's what I'm at.

Fair enough. To put it simply, bootstrapping is a tool used to add things to a character when something else is added. Like, say I want to add thing A, but in order to make thing A work, I need to also add things B and C so I bootstrap B and C to A so that when A is added, B and C come along for the ride. In this case, you're adding the additional element of "conditional" bootstrapping such that things B and C will only get added if certain qualifiers are met.

Anyway, if you need additional help, let me know. Might be easier for me to see the file with the work you've done in some cases.
 
OK, so, "bootstrapping" is just a fancy word for "including." :D

So, I could use some more help still please Sendric. I've included my .user file. In it you'll find an adjustment called "pRM_LgcyRitsWndr". How could I get the ShowMenu to be a list of the Magic Items the hero is wearing?

Also, evaluation scripts #'s 1 & 8 on the Wondrous item Assassin's Hands, the script I have in #8 refers to field[Value].value twice, meaning two different numbers. I doubt that script will work, but I can't figure out how to get the Rit value, set up in script #1, to use a different variable name than field[Value].value.

Thank you Sendric!
 

Attachments

OK, so, "bootstrapping" is just a fancy word for "including." :D

So, I could use some more help still please Sendric. I've included my .user file. In it you'll find an adjustment called "pRM_LgcyRitsWndr". How could I get the ShowMenu to be a list of the Magic Items the hero is wearing?

Pre-Levels: 10001
Code:
field[pCandExpr].text = "component.BaseMagicI & !Helper.Static"

Also, evaluation scripts #'s 1 & 8 on the Wondrous item Assassin's Hands, the script I have in #8 refers to field[Value].value twice, meaning two different numbers. I doubt that script will work, but I can't figure out how to get the Rit value, set up in script #1, to use a different variable name than field[Value].value.

Thank you Sendric!

I don't understand this question. First of all, that's a lot of scripts. I suspect you could combine many of them.

Second, what do you mean by "different variable name than field[Value].value"? field[Value].value isn't a variable, it's a number. The variable is Rit. Variables are only used within the script they are created within. For example, script #8 knows nothing about the variable Rit in script #2.

Looking at script #8, I don't see where Rit is used to refer to two different numbers. Perhaps your confusion is using "Rit" in multiple scripts? It's ok to do that, but you can also change the name of the variable from script to script and get the same outcome.

If you need to have field[Value].value set to two different numbers at different times, I'd recommend using field[Value2].value as the second number, but I'm not sure that's what you're looking for.

Also, there seems to be some kind of timing issue. Never seen a pop up message like that before. I'll have to examine it some time.
 
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
The thingid's change for each Legacy item, based on if it's armour, weapon, or wondrous item, but the functionality is the same. to count the increment of the Adjustment for the individual Legacy item. That count is then "found", or maybe "assigned" is the better term, in each subsequent script for the Legacy item (most have over a dozen scripts by level 20), using this:
Code:
Rit = field[Value].value

So, for one item in particular, the Assassin's Hands, the plan is for them to increase the Sneak Attack dice. So, to do that, I searched how Sneak Attack works, and found this script:
Code:
hero.child[xSneakAtt].field[Value].value

So, I figure this following code should work to increase the Sneak Attack dice count:
Code:
hero.child[xSneakAtt].field[Value].value = hero.child[xSneakAtt].field[Value].value + 1

But, my concern was that the command to increase the SneakAttack value is nested under an If statement, which checks that Rit value assigned above. So, the whole thing looks like this:
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

As you can see, in that long chunk above, there are two entirely separate things, The Ritual count and the Sneak Attack dice count, both referenced as "field[Value].value", which in my brain, breaks.

So, I finally tested it just now :rolleyes:, 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! :D 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!
 
Ok I'll try to be clearer about the field[value] thing.

But, my concern was that the command to increase the SneakAttack value is nested under an If statement, which checks that Rit value assigned above.

As you can see, in that long chunk above, there are two entirely separate things, The Ritual count and the Sneak Attack dice count, both referenced as "field[Value].value", which in my brain, breaks.

So, I finally tested it just now :rolleyes:, and it does appear to work. But I truly do not understand why...

So as you have already learned, this is totally fine. Why? Because:

Code:
Rit = field[Value].value

means "set the variable Rit equal to the value of the Value field on the thing this script is written in"

while

Code:
hero.child[xSneakAtt].field[Value].value = hero.child[xSneakAtt].field[Value].value + 1

means "add 1 to the value of the Value field of the thing xSneakAtt".

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

For obvious reasons, I generally prefer the one with less characters.

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! :D 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!

The script works because of the timing. The ShowMenu selection sets the field at Pre-Levels/10000. Unfortunately, this seems to not be working properly. I can't do much about that, so instead we create a script to replace the field with what we want immediately after that time. This is perfectly fine and easier than trying to deal with creating a new tag.

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