Lone Wolf Development Forums

Lone Wolf Development Forums (http://forums.wolflair.com/index.php)
-   HL - Pathfinder Roleplaying Game (http://forums.wolflair.com/forumdisplay.php?f=62)
-   -   Advice on my big ongoing project... (http://forums.wolflair.com/showthread.php?t=66634)

Lord Magus December 17th, 2021 06:22 PM

Advice on my big ongoing project...
 
I am working on an alternate magic system, in which characters have some ability in 6 magic affinities (the 4 elements, light and darkness) to a variable degree. Each of the 6 affinities is linked to one of the basic attributes. The character puts ranks in those affinities, and bonuses can also be applied; the total score is no greater than the character total level. I have coded these as Custom Abilities linked to a configurable.

Thus, an 8th character with Air affinity 2 ranks + bonus 2 has a total Air level of 4, and if he has Dark 6 ranks + bonus 3 his Dark level would still be 8.

Of course, I have run into problems...

Lord Magus December 17th, 2021 06:32 PM

One of the other abilities a character can have is a large short-term stat buff from those affinities; when the ability is used, you get a bonus to any stat for which you have at least 2 ranks in the corresponding affinity, the bonus being one-half the total level (rank + bonus) of the affinity (yes, crazy at high levels).

I am trying to code the buff without using a series of if/then statements. A foreach loop iterating through the affinities seems appropriate, but I can’t get it to work so far.

Post-Levels 50100
(...)
Code:

  foreach pick in hero where "abCategory.AMSAffin & Helper.FirstCopy"
    var AffAttr as string
    var AttBon as number
    AffAttr = "hero.child[" & eachpick.field[abText].text &"]"
    AttBon = round(eachpick.field[abValue3].value/2,0,-1)
    #enhancementbonus[AffAttr, AttBon]
 nexteach

The field [abText] holds the corresponding attribute ID for each affinity (ex: aDEX)
the field [abValue3] holds the total level for each affinity (and is calculated at post levels 50000)

The error message:
Hero Lab was forced to stop compilation after the following errors were detected:
Syntax error in 'eval' script for Thing 'cAMSElAug' (Eval Script '#2') on line 15
-> Unspecified error parsing script
Line 15 is the bonus macro

1) Is the problem the use of variables such in the macro? At least for the number, it usually works. Is there a problem with the string variable?
2) Any advice on how to optimize this script? I can't seem to find a way to travel to the attribute linked to the affinity without reconstructing it through the above string. Tags?

Thanks!

Mathias December 18th, 2021 09:49 AM

I don't understand what AffAttr even trying to do? Looking up a text field on a pick to get the Id of something?


Variables are not at all allowed to be used to generate Ids to target something.


If the individual abilities know which ability score they target, why aren't they each running this script, applying just their own bonus?

Lord Magus December 18th, 2021 05:05 PM

Quote:

Originally Posted by Mathias (Post 297770)
I don't understand what AffAttr even trying to do? Looking up a text field on a pick to get the Id of something?

Variables are not at all allowed to be used to generate Ids to target something.

1) That was it, yeah
2) That answers that part , thanks!

Quote:

Originally Posted by Mathias (Post 297770)
If the individual abilities know which ability score they target, why aren't they each running this script, applying just their own bonus?

Because when the ability is activated, it applies to all affinities the character has a minimum number of ranks in. Yes, this means you can get a bonus to all 6 attributes at once, but some characters will have only STR, others CON, others INT. It depends on what affinities they have, and how many ranks. I just don't know how I would activate a script on up to 6 affinities from a single ability.

To illustrate, a character with Fire 6 and Water 4 gets a +3 to CHA and +2 to CON, but not to the other stats; another with Light 10 and Air 3 gets +5 to WIS and +1 to DEX.

EDIT: Maybe having the ability have no script, but scripts on the affinities looks for that ability being activated do the trick?

Lord Magus December 19th, 2021 03:13 PM

Quote:

Originally Posted by Lord Magus (Post 297772)
EDIT: Maybe having the ability have no script, but scripts on the affinities looks for that ability being activated do the trick?

That did it quite nicely, BTW. Thanks!

Lord Magus December 30th, 2021 07:07 PM

Now trying to code for a "generic" item that can improve one of the wearer's affinities. I want to use a dropdown selector to allow the player to choose which item slot the item occupies.

Selection: Magic Item Slots
Restriction: None
First-500
Code:

~  We establish the item slot

~ If we're not equipped, get out now
  doneif (field[gIsEquip].value = 0)
~ If slot not chosen, get out now
  doneif (field[usrChosen2].ischosen = 0)

  perform field[usrChosen2].chosen.pulltags[Hero.?]
  perform pushtags[Hero.?]

This does not work. I think this is because usrChosen2 is not "EqpSLOT" (eg EqpFoot) but is "isEqpSLOT" instead. How can I make the slot chosen be applied to the item?

Lord Magus January 4th, 2022 07:22 AM

Progressing, using the Ornament (gear item) script as guide
Candidate expression for usrChosen2: component.ItemSlot & !Helper.Cyberware & !thingid.isEqpArmor & !thingid.isEqpPFRun & !thingid.isEqpS2Les
(usrChosen1 is for targeting the affinity improved by the item)

Pre-Levels - 9000
Code:

~  We establish the item slot

~ If we're not equipped, get out now
  doneif (field[gIsEquip].value = 0)
~ If slot not chosen, get out now
  doneif (field[usrChosen2].ischosen = 0)

  perform field[usrChosen2].chosen.pulltags[ExtraSlot.?,Hero]
  perform forward[Hero.?]

However, for some reason, this forwards 2 COPIES of the Hero.EqpFoot tag, thus making the item conflict with itself for slot use. I have tried "perform field[usrChosen2].chosen.pulltags[ExtraSlot.?]" and it does nothing... Also tried earlier timing (First 9000), with the same result.

How can I keep the item from competing with itself for slot use???

Mathias January 4th, 2022 09:00 AM

You're pulling an ExtraSlot tag, then forwarding a Hero tag? Shouldn't those be the same tag group?

Lord Magus January 4th, 2022 09:48 AM

I am still at the "copying similar things found elsewhere" stage, not necessarily fully understanding what I'm doing...

I lifted from the Ornament gear thing, which is the only thing I found which allows the user to set the item's equipment slot. This is from LoneWolf!
Code:

(...)
doneif (field[usrChosen1].ischosen = 0)

perform field[usrChosen1].chosen.pulltags[ExtraSlot.?,Hero]
perform forward[Hero.?]

There are 3 tags found on the isEqpXXX things from which EqpXXX can be pulled from, in my (limited) understanding.

EDIT / UPDATE: "Ornament" is from a Lone Wolf file, but may be 3rd party as it is not sourced and I can't even locate it on d20pfsrd... Will try to use one of ShadowChemosh's adjustments that looks more promising.

Lord Magus January 7th, 2022 07:32 AM

Finally got it to work! ShadowChemosh's adjustment used to change an item slot gave me everything I needed!


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

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