Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > HL - Pathfinder Roleplaying Game
Register FAQ Community Today's Posts Search

Notices

Reply
 
Thread Tools Display Modes
Lord Magus
Senior Member
 
Join Date: Jan 2011
Location: Quebec, QC, Canada
Posts: 464

Old August 16th, 2023, 05:28 PM
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>
Lord Magus is offline   #11 Reply With Quote
Lord Magus
Senior Member
 
Join Date: Jan 2011
Location: Quebec, QC, Canada
Posts: 464

Old August 16th, 2023, 06:16 PM
And if it can help...
Attached Images
File Type: jpg mMag.jpg (287.7 KB, 2 views)
Lord Magus is offline   #12 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old August 16th, 2023, 08:57 PM
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.
Mathias is offline   #13 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old August 16th, 2023, 09:00 PM
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.
Mathias is offline   #14 Reply With Quote
Lord Magus
Senior Member
 
Join Date: Jan 2011
Location: Quebec, QC, Canada
Posts: 464

Old August 17th, 2023, 05:50 AM
Quote:
Originally Posted by Mathias View Post
...Changing the iPriceCash field can only happen once the item power is a pick...
So wouldn't that be the case on a custom magic armor or weapon, where you pick the type of armor or weapon, pick item powers, and then purchase the item after it has been defined?

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.
Lord Magus is offline   #15 Reply With Quote
Sendric
Senior Member
 
Join Date: Jul 2010
Posts: 3,147

Old August 17th, 2023, 08:11 AM
Quote:
Originally Posted by Lord Magus View Post
Did that with the "doneif" you recommended!
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)
This would be done at the top of the script and would prevent anything from happening if this armor is being selected in the custom armor tab. Note: Not sure at what timing this would need to run, so probably something to worry about later.

Quote:
Originally Posted by Lord Magus View Post
So wouldn't that be the case on a custom magic armor or weapon, where you pick the type of armor or weapon, pick item powers, and then purchase the item after it has been defined?

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)
If I understand correctly, you're adding this item power to the armor during the purchase process, and it correctly changes the armor's price? I think that makes sense. However, it's not the same thing as what you're trying to do with this armor. The process would look something like this:

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
Sendric is offline   #16 Reply With Quote
Lord Magus
Senior Member
 
Join Date: Jan 2011
Location: Quebec, QC, Canada
Posts: 464

Old August 17th, 2023, 10:36 AM
Quote:
Originally Posted by Sendric View Post
If I understand correctly, you're adding this item power to the armor during the purchase process, and it correctly changes the armor's price?
For the item example I just gave (the "Casting" item power), there is a script on the power to set its own price (iPriceCash field) depending on which weapon type it is associated with. It can run no later than First 10000, otherwise iPriceCash is modified but not taken into account for the custom weapon's final price. Thus, while the script gathers information on another pick on the gizmo, it only modifies the thing it is on (the "Casting" power).

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
Lord Magus is offline   #17 Reply With Quote
Lord Magus
Senior Member
 
Join Date: Jan 2011
Location: Quebec, QC, Canada
Posts: 464

Old August 17th, 2023, 03:16 PM
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
For a single power, you can also use
Code:
gizmo.childfound[ipAMSAArFoc].field[iPriceCash].value *= 0.5
Thank you all for your help!
Lord Magus is offline   #18 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 09:12 AM.


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