1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. While the majority of active discourse on D20PRO has moved to our Discord Channels, this forum is still active and checked-in on regularly by our staff. However, for the very latest information, conversation and/or immediate support, please join us on Discord here: http://discord.gg/Ph38ckM
    Dismiss Notice

Rules Library - Split Acid HELP

Discussion in 'User Created Content' started by Darkfenrir92, Dec 21, 2018.

  1. Darkfenrir92

    Darkfenrir92 New Member

    Joined:
    Nov 24, 2018
    Messages:
    5
    Likes Received:
    0
    I'm trying to recreate the following ability but I can not correctly calculate the CD.

    "Once every 6 hours, an ankheg can spit a 30-foot line of acid. Creatures struck by this acid take 4d4 points of acid damage (Reflex DC 14 halves). The save DC is Constitution-based."

    I would like to get the creature's HD, divide them by two and add 10 plus constitution modifier.
    I used the following scripts: (getCasterHD()/2)+getConMod()+10. Cattura.PNG But the CD gives me 0 as a result.
     
  2. Wesley Gorby

    Wesley Gorby Production/Community Manager
    Staff Member

    Joined:
    Aug 1, 2011
    Messages:
    2,443
    Likes Received:
    140
    you'd want to do that via Script, and since you're using division, account for non-whole numbers.

    Code:
    function mycreaturefunc() {
    var mNum = 10;
    var hd = getCasterHD() / 2;
    hd = Math.floor(hd);
    if(hd < 1) { hd= 1; }
    hd = hd + getConMod();
    mNum = mNum + hd;
    
    return mNum;
    }
     
  3. Wesley Gorby

    Wesley Gorby Production/Community Manager
    Staff Member

    Joined:
    Aug 1, 2011
    Messages:
    2,443
    Likes Received:
    140
    Likewise, the above is incorrect as for syntax.

    func(10 + (getCasterHD() / 2) + getConMod())

    might work, @owlbear would know better than I, on that one.. honestly, you'd be better off writing an actual script for that as I've noted above.. It's just cleaner.. :)
     

Share This Page