Member
Join Date: Jul 2016
Posts: 55
|
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 |
#1 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
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. |
#2 |
Member
Join Date: Jul 2016
Posts: 55
|
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:
JF |
|
#3 |
Senior Member
Volunteer Data File Contributor
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,729
|
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 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. |
#4 |
Member
Join Date: Jul 2016
Posts: 55
|
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. |
#5 |
Member
Join Date: Jul 2016
Posts: 55
|
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 |
#6 |
Senior Member
Volunteer Data File Contributor
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,729
|
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. |
#7 |
|
|