• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

Help movement speeds again

bodrin

Well-known member
I'm trying to code this:-

Speed
: Because a broken soul is in constant agony, each of its speeds is slower by 10 feet than the corresponding speed of the base creature (minimum 5 feet).

This code

Code:
Final Phase 9900

hero.child[Speed].field[tSpeedMod].value -= 10
adjusts the base speed by -10 which is correct.

But this code


Code:
Final Phase 14000

      ~ Set our fly speed
      var speed as number
      speed = hero.child[Speed].field[tSpeed].value 
      hero.child[xFly].field[abValue].value = maximum(hero.child[xFly].field[abValue].value, speed - 10)
the above script compiles but it doesn't alter the fly speed of a test creature, I've tried removing the maximum declaration, replacing minimum declaration using the -= statement to subtract 10 and adjusting the phase and priority.

I've also looked at the Speed other adjustments relentless zombie templates and other things that supposedly adjust movement types

Tried this code to no avail

Code:
hero.child[xFly].field[abValue].value -= 10

What is wrong with the code, why doesn't it adjust the flight speed?
Thanks in advance !
 
Last edited:
Have you taken a look at what the haste adjustment does? It changes all speeds, so it should provide you with a script.
 
Have you taken a look at what the haste adjustment does? It changes all speeds, so it should provide you with a script.


Yes I have, however even copying the whole script produced an "abValue doesn't exist for thing xFly" error hence why I'm asking why the code doesn't work.
After many tries I was frustrated to the point where I couldn't be bothered to continue. Battlefield 3 was beckoning before I went to work!
 
After playing around with it for a few minutes, my theory is that you can't actually lower the current fly speed. You might be able to remove the fly ability then re-add it, however I can't say I've tried it yet. The theory would be to set a variable that equals the current speed, delete the fly ability, then re-add it with a speed equal to "variable" - 10.

Sorry if this isn't helpful. It's the best I can do right now. I may have time tomorrow to delve more deeply into this if you are still having trouble, or maybe someone else far smarter than me can chime in before then.
 
My guess would be your too late to adjust anything with that timing. Have you tried way earlier like Pre-levels 10,000. I do VERY little at Final timing except set "text" and Livename fields.

Also your one script can be shortened as follows:
Code:
#value[xFly] = maximum(#value[xFly], hero.child[Speed].field[tSpeed].value - 10)

When I get home I can look at how the scripts on xFly are setup and give a better answer. It may also have to do with how xFly is bootstrapped with a Value.X tag on it. I had to do special coding for DR when that happens as the Value.X tag can override anything else.

All depends on how the script on xFly is setup. So my advice would be to tear apart the xFly script to see how and *when* it does its calculations.
 
I was using the haste adjustment for ideas when I was attempting the script, which is why the timing is set at 9900 IIRC.

I haven't yet tried altering the priority / phase, still at work no PC access. The test creature I'm using is an astral Deva with a fly speed 100 perfect. I believe that bootstraps the xFly value tag.
If I can get that to alter then it should work with the other modes of movement.

I curse my old memory and years of programming neglect, things that were elementary in the 80's elude me these days.;)

Direct copy and paste code using the xBurrow script substituting xFly

Post Attributes 9000

Code:
field[abValue].value = maximum(field[abValue].value, tagmax[Value.?])

      ~ If we have a fly speed subtract 10
      if (field[abValue].value > 0) then
        #value[xFly] -= 10
        endif
Results in this error message!

Attempt to access field 'abValue' that does not exist for thing 'tmCTBrkSou'
- - -
Attempt to access field 'abValue' that does not exist for thing 'tmCTBrkSou'
- - -
Attempt to access field 'abValue' that does not exist for thing 'tmCTBrkSou'
 
Last edited:
Okay kind of a break through here, this script applied to a creature with a base speed of 100 feet perfect,

Post Attributes 9000

Code:
~start by calculating the fly speed
#value[xFly] = maximum(#value[xFly], hero.childfound[xFly].tagmin[Value.?])
~then subtract 10
[B]#value[xFly] += 10[/B]

adds 10 to the base fly speed however this script

Code:
~start by calculating the fly speed
#value[xFly] = maximum(#value[xFly], hero.childfound[xFly].tagmin[Value.?])
~then subtract 10
#value[xFly] [B]+= -10[/B]

doesn't alter the base speed at all. I presume it's something to do with the #value macro???

I've also managed to double and add 10 to the base speed with another iteration of the above scripts for a grand total of 210 feet perfect flight but never actually managed to reduce the 100 feet flight by the requisite amount.

1.36am GMT time for sleep methinks!:o
 
Ok like I thought the Value.? tag is the issue. It needs to be removed so you can get control. Below is a script I did and tested when xFly was set by a Value.? tag and when set by a script. It works correctly in both cases.

Final Phase 14999
Code:
~ create a new temp variable
var FlyValue as number
~ Get the Value tag of Fly
FlyValue = hero.child[xFly].tagmax[Value.?]
~ Remove all tags so we have control
perform hero.child[xFly].delete[Value.?]
~ Set fly speed as ten less than the Tag Value
#value[xFly] += -10 +FlyValue
 
Ok like I thought the Value.? tag is the issue. It needs to be removed so you can get control. Below is a script I did and tested when xFly was set by a Value.? tag and when set by a script. It works correctly in both cases.

Final Phase 14999
Code:
~ create a new temp variable
var FlyValue as number
~ Get the Value tag of Fly
FlyValue = hero.child[xFly].tagmax[Value.?]
~ Remove all tags so we have control
perform hero.child[xFly].delete[Value.?]
~ Set fly speed as ten less than the Tag Value
#value[xFly] += -10 +FlyValue

Thank you, I'm a few hair strands less because of this one!
It would be a nice feature if there was an override code for the movement values similar to the skillover code.

Now onto the other modes of movement!:eek:
 
Okay this is ridiculous the flight script works superbly, however the other speeds Climb, Swim and Burrow are altering by either: Remaining static
Doubling + 10 or adding 10.

For example a Purple Worms normal movement rates are
Overland 20 feet
Burrowing 20 feet
Swimming 10 feet

If I add my template to the worm the speeds listed become
Overland 10 feet Correct
Burrowing 30 feet InCorrect
Swimming 10 feet InCorrect

A Green Dragon Adult becomes
Overland from 40 to 30
Swimming from 40 to 70
Flight from 200 to 190 however removing and then re-adding the template sometimes adds the modified number to the existing fly variable resulting in a flight of 290 feet, Quirky bug?

anyway here's the completed script for perusal. Thanks for the help shadow

Code:
[B]Final Phase 14999[/B]
~ adjust all movement rates by subtracting 10

~ create a new temp variable
var FlyValue as number
~ Get the Value tag of Fly
FlyValue = hero.child[xFly].tagmax[Value.?]
~ Remove all tags so we have control
perform hero.child[xFly].delete[Value.?]
~ Set fly speed as ten less than the Tag Value
#value[xFly] += -10 + FlyValue

~ create a new temp variable
var SwimValue as number
~ Get the Value tag of Swim
SwimValue = hero.child[xSwim].tagmax[Value.?]
~ Remove all tags so we have control
perform hero.child[xSwim].delete[Value.?]
~ Set Swim speed as ten less than the Tag Value
#value[xSwim] += -10 + SwimValue

~ create a new temp variable
var ClimbValue as number
~ Get the Value tag of Climb
ClimbValue = hero.child[xClimb].tagmax[Value.?]
~ Remove all tags so we have control
perform hero.child[xClimb].delete[Value.?]
~ Set Climb speed as ten less than the Tag Value
#value[xClimb] += -10 + ClimbValue

~ create a new temp variable
var BurrValue as number
~ Get the Value tag of Burrow
BurrValue = hero.child[xBurrow].tagmax[Value.?]
~ Remove all tags so we have control
perform hero.child[xBurrow].delete[Value.?]
~ Set Burrow speed as ten less than the Tag Value
#value[xBurrow] += -10 + BurrValue
Code:
[B]Final Phase 9900[/B]
~subtract 10 from our overland movement
hero.child[Speed].field[tSpeedMod].value -= 10
 
I can't speak to what Pathfinder does, but when I've worked with the d20 files, I've learned that setting the Value field in the bootstrap is almost always unalterable, whereas setting the Value via script allows the changes (assuming the change timing comes after the timing of the Value being set). I always assign the value of fly, burrow, swim, etc. through scripting and never through the bootstrap, since that always causes the bootstrap Value to be applied regardless of what you script. Don't know if that helps, but I thought I'd point this out.
 
In pathfinder the max of field value and tagvalue of any attached tags is taken at PostAttr 9000, but the actual name is generated at Final 15000. Unfortunately, it looks like it is maximuming to the tag value both times so any changes between them get overwritten.

I would recommend deleting any value tags between those times and then just modifying the flat value.

Final 14900
perform hero.child[xFly].delete[Value.?]
hero.child[xFly].field[abValue].value -= 10

I'll remove the maximuming at the later phase so this won't be a problem in the future, but I think the example script will work now and after the fix, so it should be fine.
 
In pathfinder the max of field value and tagvalue of any attached tags is taken at PostAttr 9000, but the actual name is generated at Final 15000. Unfortunately, it looks like it is maximuming to the tag value both times so any changes between them get overwritten.

I would recommend deleting any value tags between those times and then just modifying the flat value.

Final 14900
perform hero.child[xFly].delete[Value.?]
hero.child[xFly].field[abValue].value -= 10

I'll remove the maximuming at the later phase so this won't be a problem in the future, but I think the example script will work now and after the fix, so it should be fine.

Okay this code does the trick and adjusts all other forms of movement

Code:
~ adjust all movement rates by subtracting 10 but ensuring we have a minimum of 5 feet of movement if we are lower than 5.

~ Set fly speed as ten less than the Tag Value
perform hero.child[xFly].delete[Value.?]
hero.child[xFly].field[abValue].value -= 10    
   
~ Set Swim speed as ten less than the Tag Value
perform hero.child[xSwim].delete[Value.?]
hero.child[xSwim].field[abValue].value -= 10
    
~ Set Climb speed as ten less than the Tag Value
perform hero.child[xClimb].delete[Value.?]
hero.child[xClimb].field[abValue].value -= 10
     
~ Set Burrow speed as ten less than the Tag Value
perform hero.child[xBurrow].delete[Value.?]
hero.child[xBurrow].field[abValue].value -= 10
however when I try to ensure that a minimum speed of 5 feet is left using this code

Code:
if (hero.child[xFly].field[abValue].value >= 5) then
       hero.child[xFly].field[abValue].value = 5
endif
I end up with an extra 5 being added to the speed which is again incorrect. I get the feeling this is going to be a long night!:cool:
 
Scrap the long night this works!!!!

Code:
~ adjust all movement rates by subtracting 10 but ensuring we have a minimum of 5 feet of movement if we are lower than 5.

~ Set fly speed as ten less than the Tag Value
perform hero.child[xFly].delete[Value.?]
hero.child[xFly].field[abValue].value -= 10
if (hero.child[xFly].field[abValue].value >= 0) then
       #applyvalue[xFly, 5]
endif  
   
~ Set Swim speed as ten less than the Tag Value
perform hero.child[xSwim].delete[Value.?]
hero.child[xSwim].field[abValue].value -= 10
if (hero.child[xSwim].field[abValue].value >= 0) then
       #applyvalue[xSwim, 5]
endif
    
~ Set Climb speed as ten less than the Tag Value
perform hero.child[xClimb].delete[Value.?]
hero.child[xClimb].field[abValue].value -= 10
if (hero.child[xClimb].field[abValue].value >= 0) then
       #applyvalue[xClimb, 5]
endif  
~ Set Burrow speed as ten less than the Tag Value
perform hero.child[xBurrow].delete[Value.?]
hero.child[xBurrow].field[abValue].value -= 10
if (hero.child[xBurrow].field[abValue].value >= 0) then
       #applyvalue[xBurrow, 5]
endif
 
Back
Top