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
Hedrik
Junior Member
 
Join Date: May 2012
Posts: 22

Old August 8th, 2014, 11:57 PM
I cannot tell when gear scripts run...

Specifically, I am trying to understand when the gear script for a bag of holding in Pathfinder game system is run. This is where the weight of the held items is removed from the overall weight of the bag. I presume it must happen before the weight held by the hero is calculated - which I am told is in phase Pre-levels/10000, although I am not certain of that either.

Really what I am needing to do is determine whether a hero pick (foreach pick in hero) is in an extra-dimensional container or not - and then if it is not, change its weight for encumbrance purposes only. I want to still have any hero weight, weight-based cost, etc. calculations use the original item weight. And then, I also want the item descriptions to show the original weight... (which may require resetting the weight after the encumbrance calculations)

I have all that working (I think) but I need to account for extra-dimensional containers. And figure out a way to validate that hero-level calculations are using the original weight...
Hedrik is offline   #1 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old August 9th, 2014, 09:02 AM
This is the authoring kit forum - it's for games you're creating yourself with the authoring kit. So in that case, you have complete control over what scripts you write and when they execute. They're all in equipment.str.

Is this a question about Pathfinder, and if so, should I move this question to that forum?
Mathias is online now   #2 Reply With Quote
Hedrik
Junior Member
 
Join Date: May 2012
Posts: 22

Old August 9th, 2014, 09:18 AM
Well, I suppose it is - although it is Editor/scripting-specific. Still, at least for now, please move it.
Hedrik is offline   #3 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old August 9th, 2014, 09:22 AM
The editor that comes with each game system is not the same thing as the authoring kit.
Mathias is online now   #4 Reply With Quote
Hedrik
Junior Member
 
Join Date: May 2012
Posts: 22

Old August 9th, 2014, 09:23 AM
Ah I see, thank you!
Hedrik is offline   #5 Reply With Quote
Hedrik
Junior Member
 
Join Date: May 2012
Posts: 22

Old August 9th, 2014, 05:26 PM
Quote:
Originally Posted by Hedrik View Post
I cannot tell when gear scripts run...

Specifically, I am trying to understand when the gear script for a bag of holding in Pathfinder game system is run. This is where the weight of the held items is removed from the overall weight of the bag. I presume it must happen before the weight held by the hero is calculated - which I am told is in phase Pre-levels/10000, although I am not certain of that either.

Really what I am needing to do is determine whether a hero pick (foreach pick in hero) is in an extra-dimensional container or not - and then if it is not, change its weight for encumbrance purposes only. I want to still have any hero weight, weight-based cost, etc. calculations use the original item weight. And then, I also want the item descriptions to show the original weight... (which may require resetting the weight after the encumbrance calculations)

I have all that working (I think) but I need to account for extra-dimensional containers. And figure out a way to validate that hero-level calculations are using the original weight...
So, for now I am running my item's eval script at Post-levels/15000, and checking the net weight of containers to determine if they are extra-dimensional since it will differ from the expected. This is not optimal since it is checking a side-effect rather than an actual attribute of the container - but it works! I am also modifying the hero's tEncum field rather than the actual weight of the items since that seems less likely to have unexpected side-effects... Then, I am reversing this process by adding the same amounts back to tEncum at Render/1 so that the actual weight is still displayed even though the encumbrance does not account for all the weight. This all seems to work, but I am still hoping that there is a better way. Here's my script:

Code:
~ reduce the encumbrance weight of metal things that are not
~ in extra-dimensional containers by 90%
var pickIds as string
var oldWt as number
var newWt as number
var heldWt as number
if (field[gIsEquip].value > 0) then
    foreach pick in hero where "EquipType.Metal"
        oldWt = eachpick.field[gWeight].value
        newWt = oldWt
        pickIds &= "id: " & eachpick.idstring & ", Wt: " & oldWt
        if (eachpick.isgearheld = 0) then
            pickIds &= " [not contained]"
            newWt *= 0.1
        else
            pickIds &= " [in container, gearWt " & eachpick.gearholder.field[gearWeight].value & " + heldWt " & eachpick.gearholder.field[gearHeld].value
            heldWt = eachpick.gearholder.field[gearWeight].value + eachpick.gearholder.field[gearHeld].value
            pickIds &= " = " & heldWt & " (actual=" & eachpick.gearholder.field[gearNet].value & ")]"
            if (eachpick.gearholder.field[gearNet].value = heldWt) then
                newWt *= 0.1
            endif
        endif
        if (newWt <> oldWt) then
            ~eachpick.field[gWeight].value = newWt
            herofield[tEncum].value -= (oldWt - newWt)
        endif
        pickIds &= " newWt: " & newWt & "   "
    nexteach
    debug pickIds
endif
Hedrik is offline   #6 Reply With Quote
Hedrik
Junior Member
 
Join Date: May 2012
Posts: 22

Old August 11th, 2014, 07:05 PM
Any thoughts on any of this yet? I would still like to know when the Gear script is run - and also any better way to detect that a container is extra-dimensional...

My attempt now includes handling (excluding) items dropped to the ground or inside containers that are inside of weight-reducing containers. Also tries to be a little more efficient about it all, and to provide more readable debug output - although I cannot seem to find a way to output the 'real' item names. I presume that the field for that just isn't set yet at this point in the phases:
Code:
~ reduce the encumbrance weight of metal things that are not
~ in extra-dimensional containers by 90%
var pickIds as string
var oldWt as number
var newWt as number
var contName as string
var contSbName as string
var contId as string
var gearWt as number
var gearHeldWt as number
var netWt as number
var heldWt as number
var ckspass as number
var notAtHero as number
debug today() & " @ " & state.timing
if (field[gIsEquip].value > 0) then
    foreach pick in hero where "EquipType.Metal"
        oldWt = eachpick.field[gWeight].value
        newWt = oldWt
        pickIds &= eachpick.livename & " - "
        pickIds &= "id: " & eachpick.idstring & ", Wt: " & oldWt
        if (eachpick.isgearheld = 0) then
            pickIds &= " [not contained]"
            newWt *= 0.1
        else
            perform eachpick.gearholder.setfocus
            contName = focus.livename
            contSbName = focus.field[sbName].text
            contId = focus.idstring
            gearWt = focus.field[gearWeight].value
            gearHeldWt = focus.field[gearHeld].value
            netWt = focus.field[gearNet].value
            pickIds &= " [in container " & contName & " (" & contId & "="  & contSbName & "), gearWt " & gearWt & " + heldWt " & gearHeldWt
            heldWt = gearWt + gearHeldWt
            pickIds &= " = " & heldWt & " (actual=" & netWt & ")]"
            ckspass = 1
            if (compare(contId,"gGround") = 0) then
                ckspass = 0
            elseif (netWt <> heldWt) then
                ckspass = 0
            endif
            if (ckspass <> 0) then
                notAtHero = 1
                while (notAtHero <> 0)
                    if (focus.isgearheld = 0) then
                        notAtHero = 0
                        debug contName & " not contained" 
                    else
                        perform focus.gearholder.setfocus
                        debug contName & " held by " & focus.livename
                        contName = focus.livename
                        contId = focus.idstring
                        gearWt = focus.field[gearWeight].value
                        gearHeldWt = focus.field[gearHeld].value
                        netWt = focus.field[gearNet].value
                        heldWt = gearWt + gearHeldWt
                        if (compare(contId, "gGround") = 0) then
                            ckspass = 0
                            notAtHero = 0
                        elseif (netWt <> heldWt) then
                            ckspass = 0
                            notAtHero = 0
                        endif
                    endif
                loop
            endif
            if (ckspass <> 0) then
                newWt *= 0.1
            endif
        endif
        if (newWt <> oldWt) then
            ~eachpick.field[gWeight].value = newWt
            herofield[tEncum].value -= (oldWt - newWt)
        endif
        pickIds &= " newWt: " & newWt
        debug pickIds
        pickIds = ""
    nexteach
endif
Hedrik is offline   #7 Reply With Quote
Fuzzy
Senior Member
 
Join Date: Jul 2012
Posts: 416

Old August 13th, 2014, 11:22 PM
Quote:
Originally Posted by Hedrik View Post
Any thoughts on any of this yet? I would still like to know when the Gear script is run - and also any better way to detect that a container is extra-dimensional...
As far as I can tell (by putting debug statements into a Gear script), they seem to be run at Post-Levels/10000. As for a better way to detect extradimensional spaces, I'm not sure there is one. There just isn't a tag that defines them, as all the 'special' properties of the space (weight indifference) is handled by script, not my field or tag.
Fuzzy is offline   #8 Reply With Quote
Hedrik
Junior Member
 
Join Date: May 2012
Posts: 22

Old August 14th, 2014, 12:51 AM
Thanks Fuzzy! I was thinking the script should show up in the debug window listing tasks, but I could not identify it there. I wonder if they are somehow hard-coded to run by HL rather than in the data files?
Hedrik is offline   #9 Reply With Quote
Fuzzy
Senior Member
 
Join Date: Jul 2012
Posts: 416

Old August 14th, 2014, 02:30 AM
No idea where they are coded in, I just added the debug statement that wrote out the current phase/timing, and looked in the debug output. They don't show up on the task list for the individual item, for some reason, but they do show up on the Hero's task list, as '[Gear Processing] Gear Script'
Fuzzy is offline   #10 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 08:58 AM.


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