• 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

Adding Custom Magic Item Troubles

Slywolfe

Active member
Okay, I'm thinking this is an easy one for anyone with a clue. Sadly, that's apparently not me, as I have gone at this for four hours now.

Anyhoo ...

I simply need a ring with two dropdowns allowing attributes to be selected.

The ring gives +4 enhancement to the first attribute chosen and a -2 to the second attribute chosen.

Please advise. It will help me a great deal to see a functioning script on this with my future item additions.

I currently have this for my evalscripts, two individual scripts ...

Code:
~ If nothing chosen, get out now
doneif (field[usrChosen1].ischosen = 0)

~ If nothing chosen, get out now
doneif (field[usrChosen2].ischosen = 0)

      if (field[gIsEquip].value <> 0) then
      if (field[usrChosen1].ischosen = 1) then
        #enhancementbonus[hero.child[aSTR], 4]
        endif
      if (field[usrChosen1].ischosen = 2) then
        #enhancementbonus[hero.child[aDEX], 4]
        endif
      if (field[usrChosen1].ischosen = 3) then
        #enhancementbonus[hero.child[aCON], 4]
        endif
      if (field[usrChosen1].ischosen = 4) then
        #enhancementbonus[hero.child[aINT], 4]
        endif
      if (field[usrChosen1].ischosen = 5) then
        #enhancementbonus[hero.child[aWIS], 4]
        endif
      if (field[usrChosen1].ischosen = 6) then
        #enhancementbonus[hero.child[aCHA], 4]
        endif
        endif

Code:
~ If nothing chosen, get out now
doneif (field[usrChosen1].ischosen = 0)

~ If nothing chosen, get out now
doneif (field[usrChosen2].ischosen = 0)

      if (field[gIsEquip].value <> 0) then
      if (field[usrChosen2].ischosen = 1) then
        hero.child[aSTR].field[Penalty].value -= 2
        endif
      if (field[usrChosen2].ischosen = 2) then
        hero.child[aDEX].field[Penalty].value -= 2
        endif
      if (field[usrChosen2].ischosen = 3) then
        hero.child[aCON].field[Penalty].value -= 2
        endif
      if (field[usrChosen2].ischosen = 4) then
        hero.child[aINT].field[Penalty].value -= 2
        endif
      if (field[usrChosen2].ischosen = 5) then
        hero.child[aWIS].field[Penalty].value -= 2
        endif
      if (field[usrChosen2].ischosen = 6) then
        hero.child[aCHA].field[Penalty].value -= 2
        endif
        endif

The only issue I'm having here is that no matter what is selected in the second dropdown, the -2 applies to STR. When I remove the second script and select STR in the first dropdown, I get the expected +4.

Thank you.
 
Last edited:
This is just a guess but change your endif statements to elseif apart from the final endif. It appears that all your code is doing is applying the Strength mod then stopping.
 
It's definitely running the second section of script, but the -2 penalty always only applies to STR for some reason, no matter the selection in the second dropdown.
 
field[usrChosen1].ischosen is probably a Boolean (1 or 0) while field[usrChosen1].value is probably the number of the attribute.
 
Can you think of anything that's already in Hero Lab that grants an enhancement bonus to a selected attribute?

Perhaps for a wizard who's skilled in changing things?

(Physical Enhancement - one of the abilities for the Transmuter school - you'll find it on the Class Specials tab, and you can use "New (Copy)" to take a look at its script).
 
Can you think of anything that's already in Hero Lab that grants an enhancement bonus to a selected attribute?

Perhaps for a wizard who's skilled in changing things?

(Physical Enhancement - one of the abilities for the Transmuter school - you'll find it on the Class Specials tab, and you can use "New (Copy)" to take a look at its script).

Are you implying that I'm not even close with my script?

:eek:

I'll check it out.
 
Alrighty, I gave it my best with absolutely zero success and an exponential frustration rate.

Can anyone help on this? I didn't think this would be tough at all for those with a better grasp on the scripting, and it would really help me better understand what's going on here!

Thank you.
 
Try using this in your second script?

#applypenalty[type, pick, bonus]
[example ] #applypenalty[BonMorale, hero.child[skStealth], -2]
 
Thanks for that. I can get the adjustments made just fine, though.

All I really need to know is what values are returned on the dropdown menu selection and how to fetch them for an IF statement.

:confused:
 
When choosing something from a Dropdown box in HL you are actually picking/pointing to the actual Thing. You don't have to know which ability score or Thing is in what position of the drop down you just use the chosen thing. Hmm let me show you as it will make more sense:

Phase: Pre-Attributes Priority: 10000
Code:
~ if not equipped get out now
doneif (field[gIsEquip].value = 0)

~ If ability score one chosen give bonus
If (field[usrChosen1].ischosen <> 0) Then
   #enhancementbonus[field[usrChosen1].chosen, 4]
Endif

~ If ability score two chosen give penalty
If (field[usrChosen2].ischosen <> 0) Then
   field[usrChosen2].chosen.field[Penalty].value += -2
Endif
 
Okay, that makes a whole lot of sense.

Only one problem ...

Your script isn't working, either. Nothing happens when I equip the item.

Edit: NVM ... I added a whole new custom ring, and it worked just fine!

Thanks so much! Now to figure out how to glue the hair back on my head ...
 
Last edited:
Back
Top