• 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

Procedure Coding

TobyFox2002

Well-known member
I am looking for a little bit of help creating several procedures, I was wondering if anyone out there might be able to give me a bit of help.

The first will be used for a racial special called, "Death Throes."

I want to have it so that the user can set the dice size (Xd) and weight (dX) for a primary and secondary effect. I also want to have an offset for damage, so if its 1d6 damage plus 1d6 every level after 3rd. I want to set the damage type using wType. And I want to have tags to set the DC style such as fixed DC, 10+HD, or half HD and set the attribute based on the StandardDC tag.

I want to have a text override for both primary and secondary effect. I have been using the Dragon Breath (setDraBr). But that doesn't allow for calculated damage based on HD.


What I have so far is:




Code:
    ~ set the statblock and livename display of death throes

    ~ first set what kind of damage we do. This is usually assigned with the
    ~ BloodEner tags. However, there are cases where we want to customize this
    ~ in that case we check the abText2 field for what type of damage we do

    ~ we assume if abText2 is empty we are using the BloodEner tags
    if (field[abText2].isempty <> 0) then
      field[abText2].text = lowercase(tagnames[wType.?," or "])
      endif

    ~ we assume that, unless the death throes specifies otherwise by
    ~ bootstrapping us with another abSave tag, then we are "reflex half"
    if (tagis[abSave.?] = 0) then
      perform assign[abSave.RefHalf]
      endif

    ~ we assume that, unless the death throes specifies otherwise by
    ~ bootstrapping us with another abRange tag, then we are "foot radius"
    if (tagis[abRange.?] = 0) then
      perform assign[abRange.FtRadius]
      endif

    ~ Set the name, range (based on size) and damage of our breath weapon.

    var section3 as string
    var section4 as string
    ~ Section 3 starts with just the tagnames of our abSave,
    ~ but then insert the DC in the middle of that
    if (field[abDC].value <> 0) then
      perform assign[User.NoDCName]
      section3 = tagnames[abSave.?, " or "]
      section3 = replace(section3,"Fortitude ","Fortitude DC " & field[abDC].value,0)
      section3 = replace(section3,"Reflex ","Reflex DC " & field[abDC].value,0)
      section3 = replace(section3,"Will ","Will DC " & field[abDC].value,0)
      section3 = replace(section3,"Half"," for half",0)
      section3 = replace(section3,"Negates"," negates",0)
      endif

    ~ Section 4
    if (tagis[Usage.?] <> 0) then
      perform assign[User.NoUseName]
      if (tagis[Usage.OneDFourRd] <> 0) then
        section4 = "usable every 1d4 rounds"
      else
        section4 = splice(section4, field[trkMax].value & lowercase(tagnames[Usage.?]), "")
        endif
      endif

    ~ livename
    ~ We don't want to overwrite any existing livename that has been set, so
    ~ stop if there is something already in the livename.
~~ ~~ ~~ ~~ ~~ ~~
   var diesize as number
   var DamInc as number
   var offset as number
~ abValue5 is for an offset such as 1d6 plus 1d6 every level after 3rd
   DamInc = field[abValue3].value - field[abValue5].value
   debug "dice size2 (before) " & field[abValue3].value

   DamInc = DamInc + herofield[tHitDice].value + 1 / field[abValue].value
   DamInc = round(DamInc, 0, -1)

   field[abValue3].value = DamInc
   debug "dice size2 (after) " & field[abValue3].value

~~ ~~ ~~ ~~ ~~ ~~

    if (field[livename].isempty <> 0) then
      field[livename].text = "Death Throes (" & field[abRange].value & "-ft "

      if (tagexpr[fieldval:abValue4 <> 0 | abArea.Line] <> 0) then
        field[livename].text &= "line, "
      elseif (tagexpr[fieldval:abValue4 <> 0 | abArea.Cone] <> 0) then
        field[livename].text &= "cone, "
      else
        field[livename].text &= "burst, "
        endif

      field[livename].text &= field[abValue3].value & "d" & field[abValue2].value & " " & field[abText2].text

      ~ use abText3 for extra damage
      if (field[abText3].isempty = 0) then
        field[livename].text = splice(field[livename].text, field[abText3].text, " ")
        endif

      if (field[abText].isempty = 0) then
        field[livename].text = splice(field[livename].text, field[abText].text, ", ")
        endif

      if (empty(section3) = 0) then
        field[livename].text = splice(field[livename].text,section3,", ")
        endif
      if (empty(section4) = 0) then
        field[livename].text = splice(field[livename].text,section4,", ")
        endif

      field[livename].text &= ")"

      ~ make sure if we have set the livename, we do not set the sbName yet
      done
      endif

    ~ statblock name
    ~ We don't want to overwrite any existing sbName that has been set, so
    ~ stop if there is something already in the sbName.
    if (field[sbName].isempty <> 0) then
      field[sbName].text = "death throes (" & field[abRange].value & "-ft "

      if (tagexpr[fieldval:abValue4 <> 0 | abArea.Line] <> 0) then
        field[sbName].text &= "line, "
      else
        field[sbName].text &= "cone, "
        endif

      field[sbName].text &= "DC " & field[abDC].value & ", "

      field[sbName].text &= field[abValue3].value & "d" & field[abValue2].value & " " & field[abText2].text

      ~ use abText3 for extra damage
      if (field[abText3].isempty = 0) then
        field[sbName].text = splice(field[sbName].text, field[abText3].text, " ")
        endif

      if (field[abText].isempty = 0) then
        field[sbName].text = splice(field[sbName].text, field[abText].text, ", ")
        endif

      field[sbName].text &= ")"
      endif

I had several other procedure questions, but I realize that this one is probably big enough for one post.
 
Back
Top