Senior Member
Join Date: May 2010
Location: Maryland
Posts: 167
|
I'm working on implementing a few Weapon Crystals from the Magic Item Compendium, and I'm not quite sure how to create them such that they're tied to a specific weapon.
Thanks in advance for any advice! Here's my definition so far: Code:
<thing id="ioLfeDrnk1" name="Crystal of Life Drinking, Least" description="This transparent black crystal has a faint, sickly glow.\n\nA crystal of life drinking bestows a small amount of life energy upon you each time you damage a living creature with the weapon to which the crystal is attached. Dealing nonlethal damage with the weapon doesnt activate the crystals effect.\n\nEach time you deal damage to a living creature with the weapon to which this crystal is attached, you heal 1 point of damage. When the crystal has healed a total of 10 points of damage, it becomes inert until the following day." compset="Wondrous" summary="Heal 1hp each time you deal damage to a living, up to 10 hps/day"> <fieldval field="gCost" value="400"/> <fieldval field="trkMax" value="10"/> <tag group="gType" tag="Wonder"/> <tag group="Helper" tag="EquipAvail"/> <tag group="Helper" tag="EquipMag"/> <tag group="Custom" tag="WpnCrystal" name="Weapon Crystal"/> <tag group="Helper" tag="NoPathSoc"/> <tag group="iSchool" tag="Necromancy"/> <tag group="Helper" tag="ShowSpec"/> <eval phase="Final">if (this.field[gIsEquip].value = 1) then perform this.assign[User.Tracker] endif</eval> </thing> |
#1 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
As before - what do these do? What rules are you trying to implement?
And just as a note, I have to read so much code during the day that my eyes just glaze over if I see large blocks of code included in a question. I'd much rather you describe what you're trying to accomplish, and then describe what portions of that you have been able to accomplish and what portions you are not sure about. |
#2 |
Senior Member
Join Date: May 2010
Location: Maryland
Posts: 167
|
A Weapon Crystal attaches to a weapon. Ideally, weapons would be gearholders that could hold one Weapon Crystal, but I think that'd be a lot of work involving recreating every weapon as a gearholder.
I'd like to tie a Weapon Crystal magic item to a specific Weapon. If multiple Weapon Crystals are tied to a single weapon, an error should occur. I have the Weapon Crystal defined as a Wondrous Item right now. I have the first "Select from..." option setup for a user to define an Energy Type. The "Second Selection from..." I've tried "All Weapons" and "All Picks on Hero", but that doesn't seem to work at all (just shows me two options: Ranged Touch and Unarmed). I've also tried "Melee Weapons" and "All Picks on Hero", and that shows me the melee weapons I've picked, but it hides the first "Select from...". edit: I just swapped the order of the First and Second Selections, and that is now working. Now I just need an Eval Rule -- I'm not quite sure how to proceed. I can find all my Weapon Crystal picks and Weapon picks, but I'm having trouble figuring out how to determine what the user selected on the Weapon Crystal to know if multiple Weapon Crystals share the same weapon. And why doesn't "All Weapons" list work? A Weapon Crystal shouldn't be limited to melee weapons -- a hack would be to create two types of weapon crystals for each, one that ties to Ranged and one for Melee. |
#3 |
Member
Join Date: Sep 2009
Posts: 55
|
I would probably do weapon and armor crystals as Item Powers instead of Wondrous Items.
|
#4 |
Senior Member
Join Date: Aug 2008
Location: Miamisburg, OH
Posts: 1,322
|
The 3.5 MIC had these crystals that went into slots for weapons and armor. I always thought they would be a good item but touch to code. i would most likely go with Evilash's idea. make them each a specific wonderour item and pit an activation button on it. then have the ability effect the weapon or armor. that way you would need to mess with each weapon and armor individually.
Web site - Cheese Weasel Logistics - www.cheeseweasel.net Twitter - @CheeseWeaselGMZ For user created content check out www.d20pfsrd.com and www.cheeseweasel.net For video demos of Hero Lab go to http://www.youtube.com/user/TheChiefweasel?blend=9&ob=5 |
#5 |
Senior Member
Join Date: May 2010
Location: Maryland
Posts: 167
|
I have the tracker currently set on the Wondrous Item, but I'd like to tie it to the weapon. Is it possible to set the parent's trkmax if I don't know the parent's thingid?
Code:
perform this.parent.assign[User.Tracker] var parentPick as string parentPick = this.parent.idstring #trkmax[parentPick] = 30 Item Power: Life Drinking, Least Code:
<thing id="ipLfeDrnk1" name="Life Drinking (Least)" description="Each time you deal lethal damage to a living creature with this weapon, you heal 1 point of damage. When the weapon has healed a total of 10 points of damage, this power becomes inactive until the following day." compset="ItemPower" summary="Heal 1hp each time you deal lethal damage to a living creature, up to 10 hps"> <tag group="PowerType" tag="Weapon"/> <tag group="Helper" tag="NoPathSoc"/> <tag group="Custom" tag="WpnCrystal"/> <tag group="Custom" tag="wcLfeDrnk2"/> <tag group="Helper" tag="NotMagicPw"/> <eval phase="Final">perform this.parent.assign[Custom.WpnCrystal] perform this.parent.assign[Custom.wcLfeDrnk1] </eval> <evalrule phase="Validation" index="2" message="Only one weapon crystal may be attached to a weapon">validif (this.parent.tagcount[Custom.WpnCrystal] = 1)</evalrule> <prereq message="Wondrous Item: Crystal of Life Drinking, Least must be equipped"> <validate>validif (hero.childfound[ioLfeDrnk1].field[gIsEquip].value = 1)</validate> </prereq> </thing> Code:
<thing id="ioLfeDrnk1" name="Crystal of Life Drinking, Least" description="This transparent black crystal has a faint, sickly glow.\n\nA crystal of life drinking bestows a small amount of life energy upon you each time you damage a living creature with the weapon to which the crystal is attached. Dealing nonlethal damage with the weapon doesnt activate the crystals effect.\n\nEach time you deal damage to a living creature with the weapon to which this crystal is attached, you heal 1 point of damage. When the crystal has healed a total of 10 points of damage, it becomes inert until the following day." compset="Wondrous" summary="Heal 1hp each time you deal damage to a living, up to 10 hps/day"> <fieldval field="gCost" value="400"/> <fieldval field="trkMax" value="10"/> <fieldval field="iCL" value="5"/> <tag group="Helper" tag="EquipAvail"/> <tag group="Helper" tag="EquipMag"/> <tag group="Helper" tag="NoPathSoc"/> <tag group="iSchool" tag="Necromancy"/> <tag group="gType" tag="Wonder"/> <tag group="Custom" tag="wcLfeDrnk1"/> <eval phase="Final">if (this.field[gIsEquip].value = 1) then perform this.assign[User.Tracker] endif</eval> <evalrule phase="Validation" message="Crystal must be attached to a weapon"><![CDATA[var crystals as number crystals = 0 var attached as number attached = 0 if (this.field[gIsEquip].value = 1) then foreach pick in hero where "Custom.wcLfeDrnk1" if (eachpick.tagis[gType.Wonder] <> 0) then crystals += 1 elseif (eachpick.tagis[IsWeapon.?] <> 0) then attached += 1 endif nexteach endif @valid = 0 if (this.field[gIsEquip].value = 0) then @valid = 1 elseif (crystals = attached) then @valid = 1 endif]]></evalrule> </thing> Last edited by Adam.Ormond; May 10th, 2011 at 07:47 AM. |
#6 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
BTW,
Code:
this. |
#7 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
parent.field[trkMax].value = 30
|
#8 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
You did note that trkMax is already in use for many weapons - the count of a stack of daggers, for example.
|
#9 |
Senior Member
Join Date: May 2010
Location: Maryland
Posts: 167
|
Ah yes, good point; I had already forgotten I'm going to break that if I set the trkmax on the parent, won't I? I suppose I need to keep the tracker on the Wondrous Item.
|
#10 |
|
|