• 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

Syntactic thing

Paragon

Well-known member
I could probably work this out with trial and error, but thought maybe someone would already know.

Setting up my Thin Men, they have an ability that adds to their Toughness, but does so by giving them a bonus equal to half their Agility die. I'm guessing this is an eval script on the ability, but I couldn't quite figure out how it'd be constructed.
 
I'd take a look at the derived trait for Toughness itself (trTough), since it is calculated by taking 1/2 Vigor. That should give you some idea of a way to use half of something to use as a modifier to add to something else. I always like to work from something that already does something similar to what I want to try and figure out how to do it. (oh, and sorry I don't know how to code it off the top of my head, thus the hint on what I where I would start to try and figure out how to code it.)
 
Last edited:
Hey, its more than I had. And I know what you mean; I was all set to ask how you set up Knowledge skills on creatures when I found an example on the lich and didn't need to.
 
Okay, I came up with something for this, but its not working. I suspect the problem is that I'm not correctly identifying what the program is storing the variable as here; I'd assumed it was the word "bonus" in the script, but since this isn't working I'm thinking I'm wrong). Just in case the problem is in the timing or other elements, I'll try to include them all:

Phase: Final
Priority: 4000
Code:
var bonus as number
      bonus = #trait[attrAgi]
      if (bonus >= 6) then
      bonus = 6 + round(hero.child[attrAgi].field[trtRoll].value / 2,0,-1)
        endif
      perform #traitadjust[trTough,+,bonus,"Half Agility"]

Timing: Before Calc trtFinal

So, any ideas here? I could, of course, be completely missing the boat since I kind of kitbashed some of the code from the Toughness calculation itself and the Tough As Nails edge together to get this. The test didn't have any objections, but as it is, it doesn't actually seem to do anything.
 
I could be wrong, but you might play around with the Phase and Priority. If you haven't already.
 
Last edited:
What is this line meant to do?

bonus = 6 + round(hero.child[attrAgi].field[trtRoll].value / 2,0,-1)

It looks like it's only run if Agility is greater than d12. (Keeping in mind that a value of 7 in that instance is equivalent to d12+1, 8 is d12+2, and so on.) I don't know the text of the ability in question is why I'm asking just to see if that is going to do what you want it to.
 
What is this line meant to do?

bonus = 6 + round(hero.child[attrAgi].field[trtRoll].value / 2,0,-1)

Its from the basic Toughness calculation, and from what I understand, its to deal with what is supposed to happen, as you note, for attributes about 12.

It looks like it's only run if Agility is greater than d12. (Keeping in mind that a value of 7 in that instance is equivalent to d12+1, 8 is d12+2, and so on.) I don't know the text of the ability in question is why I'm asking just to see if that is going to do what you want it to.

Yeah, while I don't expect to generate a Thin Man with Agility that high, they do default to d10, so I figured I might as well include it.
 
You don't need anything in the Timing box at all, it's just meant, from what I can tell, as a check on ensuring a more specific timing for the script to run within the set Phase/Priority is all.

What is it trying to do with post d12 values, though? It looks like your trying to take, for example, a d12+1 and make the bonus (6 + ((7/2) - 1)) = 9? Is that right? It would jump from being a +6 bonus at d12 to +9 at d12+1? If it should be 7 then why not just use the straight trtRoll since it's already at the half value? So something like:

Code:
perform #traitadjust[trTough,+,hero.child[attrAgi].field[trtRoll].value,"Half Agility"]

should be all you would need, I would think, without all that figuring a bonus value and stuff.
 
You only have to have something in the timing box if it matters. Most of them that I have seen were in Initialization, Pre-Traits, and Traits. And even then the "before this" or "after that" are not always used.

In the Final stage it is messing with it after the fact. It would not be used to calculate other things (which Toughness isn't anyway), so timing is not an issue.
 
You don't need anything in the Timing box at all, it's just meant, from what I can tell, as a check on ensuring a more specific timing for the script to run within the set Phase/Priority is all.

What is it trying to do with post d12 values, though? It looks like your trying to take, for example, a d12+1 and make the bonus (6 + ((7/2) - 1)) = 9? Is that right? It would jump from being a +6 bonus at d12 to +9 at d12+1? If it should be 7 then why not just use the straight trtRoll since it's already at the half value? So something like:

From my understanding, and this is just from reading the commenting where I took it from, its supposed to cut the + bonus in half for values over 12 and apply them. If that's not done correctly, its not done right in the base Toughness calculation for the game, because its pretty much cut and paste from there, just with Agi substituted for Vig.


Check out the Toughness code if you want to see what I'm talking about.
 
You only have to have something in the timing box if it matters. Most of them that I have seen were in Initialization, Pre-Traits, and Traits. And even then the "before this" or "after that" are not always used.

In the Final stage it is messing with it after the fact. It would not be used to calculate other things (which Toughness isn't anyway), so timing is not an issue.

Yeah, I tried removing it and moving around the others, and nothing seems to have caused any change.
 
How about the eval scipt inside the Thin Men's Agility is Tough ability be something more like this.

Pre-Traits 5000
Code:
var vigor as number
var agile as number
var bonus as number
bonus = 0

~ Re-Establish Base from Vigor
      vigor = #trait[attrVig]
      if (vigor >= 6) then
        vigor = 6 + round(hero.child[attrVig].field[trtRoll].value / 2,0,-1)
        endif

~ Establish Base from Agility
      agile = #trait[attrVig]
      if (agile >= 6) then
         agile = 6 + round(hero.child[attrAgi].field[trtRoll].value / 2,0,-1)
        endif

~ Compare them
      bonus = agile - vigor

~ Apply to Toughness
      perform #traitadjust[trTough,+,bonus,"Thin Man"]

The above makes it so that it will use Agility. You can change the compare equation to an "if" statement to take the highest if that is what you are after instead. Something like "if (agile > vigor" then bonus = agile, else bonus = vigor.
 
It needs to use both, not just one, otherwise they're too brittle; they don't wear any armor so its a substitution for that, and they're supposed to be able to take a single assault rifle round (9+ damage) without folding as extras.
 
Oh ok, then just do the agility part and add it. It might work in either Pre-Traits 5000 or Traits 5000, you could try it without the timing in Traits 5000.
 
I'll give it a try and report back; though I'm still not sure why the current version isn't doing something.
 
Okay, I tried this:

Code:
var agile as a number
bonus = 0

agile = #trait[attrAgi]
      if (agile >= 6) then
         agile = 6 + round(hero.child[attrAgi].field[trtRoll].value / 2,0,-1)
        endif
      
      bonus = agile

perform #traitadjust[trTough,+,bonus,"Thin Man"]

and it gave me "unknown variable type specified" on line one.
 
I'm guessing the problem is it isn't actually doing anything with "bonus" in my original code, so when it gets to that part it doesn't add anything, even though it didn't object to the syntax. I'm just not sure what the problem is.
 
Back
Top