• 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 do you create a Ring of Shield? Code in editor not working

wiscrhino

Member
Hi all, this is my first post, so please excuse any newbie errors.

I am attempting to create a custom magic item and having a bit of trouble in the editor. I have successfully created other magic items in the editor, but running into a jam trying to create a Ring of Shield.

Now, right off the bat let me answer/address 2 questions/comments that are bound to come up:
1) Yes, I have watched the videos and read the very useful articles written by superuser Mathias on how to use the editor. I am still in a pickle and can't figure out the code needed.
2) Yes, I know a ring of shield is sort of a broken thing, that you shouldn't make it, but I want to anyway :)

Ok, so I have enabled data file debugging, and looked at the selection fields when the spell "Shield" is cast, to get an idea of how to do the coding. I've noticed that when the spell is enabled, the following is noted: "SpellEff.BuffAC".

Additionally, I've noted that the id for the item shield is "pShield" and when it's activated, the id "pAdjust"is activated as well, with a value of "4".

Therefore, I have tried the following code in the editor under "eval scripts":
hero.child[pShield].field[pAdjust].value += 4

However this doesn't seem to work, I get an error message when running the testing, which states:
"Syntax error in 'eval' script for Thing xxxx (Eval Script '#1') on line 1 -> Only derived fields can generally be modified via scripts (field 'pAdjust')

Therefore, I'm a bit stuck. I'd really like to know how to code this in the editor, and can't seem to figure it out. Appreciate any feedback to help me get this corrected!
 
Remember, in the editor, you can use the "New (Copy)" button at the bottom left to copy an existing item, and look at its eval script to see how it works.

So, try copying the ring of protection - that's an item that applies a different type of AC bonus.

Or try copying the shield adjustment itself, to see how a shield bonus is applied.
 
Thanks Mathias. I tried doing exactly that (the New(Copy) function) and looked at both Ring of protection and the shield spell as well. Here's where I ran into problems:

1) Ring of protection has the following eval script:
"hero.child[ArmorClass].field[tACDeflect].value = maximum(hero.child[ArmorClass].field[tACDeflect].value, 1)"

So I wanted to set this up the same way, but don't know what to substitute in for "tACDeflect" - because Shield is not a deflect bonus but is a shield bonus. So didn't know if I should use "pShield" or "pAdjust" somehow. Am a bit stuck here

2) With regards to looking at the shield adjustment - maybe I am doing it incorrectly (very likely) but I tried to find this and failed. In the editor I tried to "New (Copy)" the item the spell Shield - so Magic-> Spell -> New (Copy) -> Shield (spShield1). But when I do so, there is nothing in the Eval Scripts section/button, so I can't see what code is being used there.

Sorry, I know you're trying the "teach a man to fish" approach, but I am just not getting it. Appreciate any guidance or anything else you can offer to steer me on the correct course!
 
Actually isn't a "Ring of Force Shield" 99% of the logic you want? I would copy it and use that as a bases for a Ring of Shield.
 
2) With regards to looking at the shield adjustment - maybe I am doing it incorrectly (very likely) but I tried to find this and failed. In the editor I tried to "New (Copy)" the item the spell Shield - so Magic-> Spell -> New (Copy) -> Shield (spShield1). But when I do so, there is nothing in the Eval Scripts section/button, so I can't see what code is being used there.

That's the shield spell, not the adjustment to apply the effects of that spell. The adjustment is on the General grouping, Adjustment tab.
 
1) Ring of protection has the following eval script:
"hero.child[ArmorClass].field[tACDeflect].value = maximum(hero.child[ArmorClass].field[tACDeflect].value, 1)"

So I wanted to set this up the same way, but don't know what to substitute in for "tACDeflect" - because Shield is not a deflect bonus but is a shield bonus. So didn't know if I should use "pShield" or "pAdjust" somehow. Am a bit stuck here

If "tACDeflect" is a deflection bonus to AC, maybe tACShield is a shield bonus to AC.
 
#applybonus[tACShield, hero.child[ArmorClass], field[pAdjust].value]

or replace field[pAdjust].value with the shield bonus the ring provides.

that way it takes care of factoring in current shield bonuses and other issues.
 
Aha, thank you Mathias and all, success. The tACShield makes sense and works for me. Many thanks again. Went with the following and it's working:

hero.child[ArmorClass].field[tACShield].value = maximum(hero.child[ArmorClass].field[tACShield].value, 4)
 
Back
Top