Senior Member
Join Date: Jan 2011
Location: Quebec, QC, Canada
Posts: 464
|
Here goes...
(ipAMSAArFoc and ipAMSAArFo2 are Air Focus 1 and Air Focus 2, which are magic armor powers) Code:
<thing id="mAMSAWvSc" name="Air wyvern scale armor" description="This grey scale armor is made from an air wyvern scales sewn over high quality light leather. It is light and comfortable.\n\nThe cost of adding Electricity Resistance or an*Air Focus to this armor is reduced by 50%.\n\nCost to make: 500 £ of scales, 50 £ other materials; Leather working*DC 24, 5 days, 50 £ retry." compset="Armor" summary="Made from an air wyvern scales sewn over high quality light leather."> <comment>Cost reduction for Elec Resistance not coded yet</comment> <fieldval field="gWeight" value="15"/> <fieldval field="gSizeCost" value="1100"/> <usesource source="SOUL"/> <usesource source="sSOULAMS"/> <tag group="ArmorMaxDx" tag="3"/> <tag group="EquipType" tag="Leather"/> <tag group="ArmorCheck" tag="3"/> <tag group="ArmorArcFl" tag="20"/> <tag group="ArmorClass" tag="Medium"/> <tag group="Ability" tag="eSOULMat"/> <tag group="HasAbility" tag="eSOULMat"/> <tag group="ArmorAC" tag="6"/> <tag group="Helper" tag="AlwaysMast"/> <eval phase="First" priority="2550"><![CDATA[~ Script try no.1: This script compiles perform gizmo.findchild[BaseItemPw,"thingid.ipAMSAArFo?"].setfocus doneif (state.isfocus = 0) focus.field[iPriceCash].value *= 0.5 ~ Script try no.2: This script compiles foreach pick in gizmo from BaseItemPw where "thingid.ipAMSAArFo?" eachpick.field[iPriceCash].value *= 0.5 nexteach ~ Script try no.3: This script does not compile ~ perform container.parent.setfocus ~ doneif (state.isfocus = 0) ~ perform focus.findchild[BaseItemPw,"thingid.ipAMSAArFo?"].setfocus ~ focus.field[iPriceCash].value *= 0.5 ~ Script try no.4: This script does not compile ~ perform container.parent.setfocus ~ doneif (state.isfocus = 0) ~ focus.findchild[BaseItemPw,"thingid.ipAMSAArFo?"].field[iPriceCash].value *= 0.5]]></eval> <prereq message="This armor is already made out of a special material and a second type can not be added."> <validate>var X2HaveMate as number Call X2HaveMate @valid = X2HaveMate</validate> </prereq> </thing> |
#11 |
Senior Member
Join Date: Jan 2011
Location: Quebec, QC, Canada
Posts: 464
|
And if it can help...
|
#12 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
Oh, right - I've been mixing up PF2 and PF1, since we got to re-do the dumb way we set up custom magic items for PF2.
Ok, so when constructing a custom armor, the armor is inside the gizmo of the "custom/magic armor" gizmo. The armor itself does not have a gizmo. (the exception to that is if you construct your item as a special/magic armor to begin with - Elven chain is an example of a non-magical armor, created on the special/magic armor tab, that can then be customized with item powers and a bonus once the user buys it). So, you either need to move the item from one tab to another, if it's an item similar to elven chain, or if it is a standard type of armor, that's normally bought as a mundane item but could be enchanted, then your scripts need to change their context - the armor is inside the gizmo of the custom/magic item, so "container" is the transition to that gizmo from inside the container. But make sure to add doneif (container.ishero <> 0) for every script that's going to be manipulating the other picks inside this container, because that's how you prevent them from operating if the user is building a mundane version of this armor. |
#13 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
And I wanted to re-iterate something Sendric pointed out early on - changing the iPriceCash field can only happen once the item power is a pick - that's after the user has paid for it. So changing iPriceCash using an eval script will make the total value of the armor come out correctly, but users will need to make sure to pay the correct amount when making the initial purchase.
Off the top of my head, I don't remember a way to apply that sort of discount to purchases within a specific context. |
#14 |
Senior Member
Join Date: Jan 2011
Location: Quebec, QC, Canada
Posts: 464
|
Quote:
The following item (weapon) power has a variable iPriceCash field value, that is set according to which type of weapon the power is added to. Granted, the script is on the power itself, not on another thing, but it is working. (EDIT: I set the price adjustment script to run at First-2550, but it seems to work if set up to First-10000) Code:
</thing> <thing id="ipAMSCstImp" name="Casting" description="A {i}casting{/i} weapon is a casting implement and can thus be used as a conduit to cast spells, much like a wand or staff.\n\nIf the weapon is dedicated to one or more spells, only those spells can be cast through it; otherwise, only spells of the affinity(ies) the weapon has a focus for can be cast through it. A wielder with the spellstrike ability ignores these requirements and can in fact use any weapon as a casting implement. Ranged weapons can be casting implements, for the same cost.\n\nBy their nature, wands, as well as masterwork rods and staves, are automatically {i}casting{/i} implements at no extra cost. The limitations above still apply to them, particularly to dedicated wands.\n\nOnly masterwork weapons can be made into {i}casting implements{/i}.\n\n{b}Construction{/b}\n{b}Requirements{/b} Craft Magic Arms and Armor; {b}Cost{/b} 250 gp for light weapons, 1*000 gp for one-handed weapons, 2*250 gp for two-handed weapons, 4*000 gp for firearms, 6*250 gp for siege weapons." compset="ItemPower" summary="Weapon usable as a conduit for spells" uniqueness="useronce"> <fieldval field="iCL" value="3"/> <usesource source="sSOULAMS"/> <usesource source="sSOULCamp"/> <tag group="iSchool" tag="Universal"/> <tag group="iSchool" tag="Transmutat"/> <tag group="PowerType" tag="Weapon"/> <eval phase="PreLevel" priority="5150"><![CDATA[ perform container.parent.setfocus doneif (state.isfocus = 0) if (focus.tagis[component.BaseWep] <> 0) then perform focus.assign[AMSItem.CastImp] endif]]></eval> <eval phase="First" priority="2550" index="2"><![CDATA[ perform container.parent.setfocus doneif (state.isfocus = 0) if (focus.tagis[wCategory.Firearm] <> 0) then field[iPriceCash].value = 4000 elseif (focus.tagis[wClass.OneHanded] <> 0) then field[iPriceCash].value = 1000 elseif (focus.tagis[wClass.TwoHanded] <> 0) then field[iPriceCash].value = 2250 elseif (focus.tagis[wClass.Siege] <> 0) then field[iPriceCash].value = 6250 else field[iPriceCash].value = 250 endif]]></eval> <evalrule phase="Validation" priority="5000" message="A casting implement must be a masterwork item."><![CDATA[ perform container.parent.setfocus validif (focus.tagis[EquipType.Masterwork] <> 0)]]></evalrule> <evalrule phase="PreLevel" priority="5125" index="2" message="Item is already a casting implement.">perform container.parent.setfocus validif (focus.tagis[AMSItem.CastImp] = 0)</evalrule> </thing> Last edited by Lord Magus; August 17th, 2023 at 06:52 AM. |
|
#15 |
Senior Member
Join Date: Jul 2010
Posts: 3,147
|
Fair, but not quite what I meant. I was thinking of something even before you do a foreach loop (which the doneif I showed you wouldn't help with) or before the setfocus. Something like:
Code:
doneif (tagis[IsArmor.iMagArmor] = 0) Quote:
Example 1 (Item Power) 1) Select Armor 2) Purchase Item Power 3) Armor Price Adjusted 4) Purchase Armor Example 2 (Armor) 1) Select Armor 2) Purchase Item Power 3) Item Power Price Adjusted 4) Purchase Armor |
|
#16 |
Senior Member
Join Date: Jan 2011
Location: Quebec, QC, Canada
Posts: 464
|
Quote:
For the armor, the price-modifying script on the armor aims to affect the prices of the powers, not the armor's. I add the armor, then the script reduces some item power prices, if the relevant powers are added, during the purchase process. So it does not modify the thing it is on (the armor), but the prices of other picks in the gizmo (armor powers). The process in the case of the armor would look something like this: 1) Select - Custom/Magic Armor - from the "Magic, Custom & Masterwork" section of the Armor tab 2) A window pops up, enabling customization (iMagArmor pick) 3) Pick base Armor 4) Pick armor Powers 5) Armor power prices adjusted by script on previously chosen armor 6) Final price of armor calculated in the pop-up window, according to the picks added, including armor type, masterwork, ac enhancement bonuses and armor powers (including those with modified price) 7) Purchase Armor at final price Last edited by Lord Magus; August 17th, 2023 at 10:41 AM. Reason: Trying to make my goals clearer, sorry if it muddles things up |
|
#17 |
Senior Member
Join Date: Jan 2011
Location: Quebec, QC, Canada
Posts: 464
|
Well, I finally got somewhere! Here's a brief recap for future reference.
The key seems to be to set up the armor not as a regular mundane armor (on the Armor tab of the editor), but rather as a magic armor (on the Armor, magic tab) even though it is not "magic"; it facilitates the transitions required. I had to start from a copy of the iElvenChn thing: for some reason, if I started from scratch, even adding exactly the same things (except for the armor type), the price of the base armor would not be counted in the calculations. The following script runs flawlessly so far, at First - 10000 (if later, iPriceCash is not accounted in final price) Code:
perform gizmo.findchild[BaseItemPw,"thingid.ipAMSAArFo?"].setfocus doneif (state.isfocus = 0) focus.field[iPriceCash].value *= 0.5 Code:
gizmo.childfound[ipAMSAArFoc].field[iPriceCash].value *= 0.5 |
#18 |
|
|