• 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

Feats that modify combat states

scibat

Well-known member
I have scripted one or two feats that modify combat states and haven't had any real difficulties so far. However, I have found a situation I am having problems trying to code.

The feat is written as increasing the base speed of the character by 10 feet when taking the Charge, Run, or Withdraw actions. After taking a look at the combat states and such, I tried out this bit of code:

Code:
Post-levels/20000

if (#hascondition[pstChargin] = 1) then
   if (field[abilActive].value = 1) then
      hero.child[Speed].field[tSpeedMod].value += 10
   endif
endif
if (#hascondition[pstWithdr] = 1) then
   if (field[abilActive].value = 1) then
      hero.child[Speed].field[tSpeedMod].value += 10
   endif
endif
if (#hascondition[pstRunning] = 1) then
   if (field[abilActive].value = 1) then
      hero.child[Speed].field[tSpeedMod].value += 10
   endif
endif

This had no visible effect when the state was toggled on and off. I'm not sure if it's a coding issue or a timing issue. Any suggestions or insights?
 
i didn't test all of your code, but i tested the
hero.child[Speed].field[tSpeedMod].value += 10
with one of my scripts (i have one that changes a merfolk's speed from 5 to 30), and it shows the result as "Speed 30/40"
my script runs at PostLevels 10000
 
okay, just put your whole script in (don't know why i didn't just do that the first time) and it add 10 with any of the conditions checked (including putting my speed up to 30/60 when i checked all three)
so try ur script at postlevels 10000?
 
If you activate both abilities and no speed change than most likely its a timing issue.

One way to double check is to add "debug" statements.
Code:
[B]debug "start speed " & hero.child[Speed].field[tSpeedMod].value[/B]
if (#hascondition[pstChargin] = 1) then
   if (field[abilActive].value = 1) then
      hero.child[Speed].field[tSpeedMod].value += 10
   endif
endif
if (#hascondition[pstWithdr] = 1) then
   if (field[abilActive].value = 1) then
      hero.child[Speed].field[tSpeedMod].value += 10
   endif
endif
if (#hascondition[pstRunning] = 1) then
   if (field[abilActive].value = 1) then
      hero.child[Speed].field[tSpeedMod].value += 10
   endif
endif
[B]debug "end speed " & hero.child[Speed].field[tSpeedMod].value[/B]
Then to to "Develop->Floating Info Windows->Show Debug Output". Compile and run your script again. Now you can see if the value is actually getting changed.

If the speed value is changing in the debug window but not on the character sheet. Then your issue is timing. I think you may need Pre-levels/10000.

Just an FYI here is your code re-done a little easier. As you don't want to do anything unless the ability is active you can do this:
Code:
[B][COLOR="Green"]~ If we are not active get out now![/COLOR][/B]
doneif (field[abilActive].value <> 1)

if (#hascondition[pstChargin] = 1) then
   hero.child[Speed].field[tSpeedMod].value += 10
endif
if (#hascondition[pstWithdr] = 1) then
   hero.child[Speed].field[tSpeedMod].value += 10
endif
if (#hascondition[pstRunning] = 1) then
   hero.child[Speed].field[tSpeedMod].value += 10
endif
 
Thanks for the replies! That should clear everything up and the debug tips will be very helpful in the future.
 
Back
Top