Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > HL - D&D 5th Edition SRD
Register FAQ Community Today's Posts Search

Notices

Reply
 
Thread Tools Display Modes
jflevesque
Member
 
Join Date: Jul 2016
Posts: 55

Old November 26th, 2016, 06:37 AM
Hi Mathias,

In case of using the +1 Weapon from the 5e SRD, the gizmo seem to take the properties of the BaseWep and applying the modifications. What I'm trying to do is on my BaseWep, get the gizmo if it exists to read the Bonus field and based on that value, modify my weapon.

I've tried isgizmo or even container in the eval script, but since my base weapon is not compiled with a gizmo, it gives me a compilation error. How would you fetch the gizmo in that case?

Thanks
jflevesque is offline   #1 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old November 26th, 2016, 12:12 PM
I've moved this post out of the authoring kit forum, because it's specific to 5th edition.

But I can't understand the question you're asking - you haven't explained the game rule you're trying to implement, and you haven't provided any code in progress to let me debug that.
Mathias is offline   #2 Reply With Quote
jflevesque
Member
 
Join Date: Jul 2016
Posts: 55

Old November 26th, 2016, 12:25 PM
Hi Mathias,

As an example, let's say we duplicate the Longsword equipment and let's save it as a Defensive Longsword. In the eval script, I'll add 1 AC bonus to the hero. Now, if I instead use the +1 Weapon and select my Defensive Longsword, I'd like the bonus to now be +2.

Because my eval script is within the Defensive Longsword and I haven't added a Gizmo to it, how do I know if my equipment is a child of a gizmo? When reading your post, you wrote that if you are a pick within a gizmo, you could use the container keyword to access your gizmo. If I try to do so, my file does not compile.

Here is the script for the example from above:

Quote:
<thing id="wTestDefL" name="Defensive Longsword" description="Standard longsword that also provides +1 AC bonus." compset="Weapon" summary="Sword that provides +1 AC.">
<fieldval field="gWeight" value="3"/>
<fieldval field="gSizeCost" value="15"/>
<fieldval field="wDieCount" value="1"/>
<fieldval field="wDieSize" value="8"/>
<fieldval field="wDCntVers" value="1"/>
<fieldval field="wDSizVers" value="10"/>
<tag group="DamageType" tag="dtSlashing" name="Slashing" abbrev="Slashing"/>
<tag group="EquipType" tag="Metal" name="Metal" abbrev="Metal"/>
<tag group="wCategory" tag="Melee" name="Melee Weapon" abbrev="Melee"/>
<tag group="wGroup" tag="Sword" name="Sword" abbrev="Sword"/>
<tag group="wProfReq" tag="Martial" name="Martial" abbrev="Martial"/>
<tag group="wProperty" tag="Versatile" name="Versatile" abbrev="Versatile"/>
<eval phase="PostLevel" priority="10000">doneif (field[gIsEquip].value + field[wIs2nd].value = 0)

hero.childfound[ArmorClass].field[Bonus].value += 1

~ Look into gizmo to find out the current bonus +1 to +3
~ following line does not compile
~ Reference to undeclared variable: container
~ debug container.field[Bonus].value</eval>
</thing>
Thanks,
JF
jflevesque is offline   #3 Reply With Quote
ShadowChemosh
Senior Member
Volunteer Data File Contributor
 
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,729

Old November 26th, 2016, 01:01 PM
So the fun here is that you are trying to get to the containers "parent" actually. You will also need to duplicate the code because I assume you want the weapon to be non-magical sometimes and not toss errors. By duplicate I mean one section will get information from the "parent" container and one section will get the field values from itself (ie not magical).

I can't think of any good example scripts in 5e or community 5e. So here is the script logic you would need:

Code:
      ~ Check to see if the container we are inside is the hero
      if (container.ishero <> 0) then
        ~ If not equipped get out now! &
        doneif (field[gIsEquip].value + field[wIs2nd].value = 0)

      else

        ~ Increase the AC bonus by the magic plus of the weapon 
        field[abValue].value += container.parent.field[Bonus].value

        ~ If not equipped get out now! &
        doneif (container.parent.field[gIsEquip].value + container.parent.field[wIs2nd].value = 0)
      Endif
      
      ~ If we got to here increase the AC of the character
      hero.childfound[ArmorClass].field[Bonus].value += field[abValue].value
abValue in this case is a generic field on pretty much everything in 5e. So I am using it to store the value. So the initial value of 1 is what I set abValue too. So either we get +1 AC or 1 plus the magic bonus of the weapon.

Here is the FULL XML if that helps:
Code:
  <thing id="wTestDefL" name="Defensive Longsword" description="Standard longsword that also provides +1 AC bonus." compset="Weapon" summary="Sword that provides +1 AC.">
    <fieldval field="gWeight" value="3"/>
    <fieldval field="gSizeCost" value="15"/>
    <fieldval field="wDieCount" value="1"/>
    <fieldval field="wDieSize" value="8"/>
    <fieldval field="wDCntVers" value="1"/>
    <fieldval field="wDSizVers" value="10"/>
    <fieldval field="abValue" value="1"/>
    <tag group="EquipType" tag="Metal" name="Metal" abbrev="Metal"/>
    <tag group="wCategory" tag="Melee" name="Melee Weapon" abbrev="Melee"/>
    <tag group="wGroup" tag="Sword" name="Sword" abbrev="Sword"/>
    <tag group="wProfReq" tag="Martial" name="Martial" abbrev="Martial"/>
    <tag group="wProperty" tag="Versatile" name="Versatile" abbrev="Versatile"/>
    <tag group="DamageType" tag="dtSlashing" name="Slashing" abbrev="Slashing"/>
    <eval phase="PostLevel" priority="10000"><![CDATA[
      ~ Check to see if the container we are inside is the hero
      if (container.ishero <> 0) then
        ~ If not equipped get out now! &
        doneif (field[gIsEquip].value + field[wIs2nd].value = 0)

      else

        ~ Increase the AC bonus by the magic plus of the weapon 
        field[abValue].value += container.parent.field[Bonus].value

        ~ If not equipped get out now! &
        doneif (container.parent.field[gIsEquip].value + container.parent.field[wIs2nd].value = 0)
      Endif
      
      ~ If we got to here increase the AC of the character
      hero.childfound[ArmorClass].field[Bonus].value += field[abValue].value]]></eval>
    </thing>

Hero Lab Resources:
Pathfinder - d20pfsrd and Pathfinder Pack Setup
3.5 D&D (d20) - Community Server Setup
5E D&D - Community Server Setup
Hero Lab Help - Hero Lab FAQ, Editor Tutorials and Videos, Editor & Scripting Resources.
Created by the community for the community
- Realm Works kickstarter backer (Alpha Wolf) and Beta tester.
- d20 HL package volunteer editor.
ShadowChemosh is offline   #4 Reply With Quote
jflevesque
Member
 
Join Date: Jul 2016
Posts: 55

Old November 26th, 2016, 01:08 PM
Hi Chemosh,

Thank you for the quick response. Sadly I won't be able to test this in HL today, but I'll look into it tomorrow.
jflevesque is offline   #5 Reply With Quote
jflevesque
Member
 
Join Date: Jul 2016
Posts: 55

Old November 27th, 2016, 06:04 AM
Hi Chemosh,

Your code works great! Do you know why the compilation error I was getting was undeclared variable instead of a syntax error similar to if I would have forgotten to specify value or text on a field?

Thanks,
JF
jflevesque is offline   #6 Reply With Quote
ShadowChemosh
Senior Member
Volunteer Data File Contributor
 
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,729

Old November 27th, 2016, 10:10 AM
Quote:
Originally Posted by jflevesque View Post
Do you know why the compilation error I was getting was undeclared variable instead of a syntax error similar to if I would have forgotten to specify value or text on a field?
Its just the way HL works. Sometimes it can figure out what your "trying" to do sometimes it can't even guess and gives a generic message of "undeclared variable". Its sort of like the old days of IBM where you got a Syntax Error 123!

Hero Lab Resources:
Pathfinder - d20pfsrd and Pathfinder Pack Setup
3.5 D&D (d20) - Community Server Setup
5E D&D - Community Server Setup
Hero Lab Help - Hero Lab FAQ, Editor Tutorials and Videos, Editor & Scripting Resources.
Created by the community for the community
- Realm Works kickstarter backer (Alpha Wolf) and Beta tester.
- d20 HL package volunteer editor.
ShadowChemosh is offline   #7 Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 03:20 AM.


Powered by vBulletin® - Copyright ©2000 - 2024, vBulletin Solutions, Inc.
wolflair.com copyright ©1998-2016 Lone Wolf Development, Inc. View our Privacy Policy here.