1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Scripts

Discussion in 'User Created Content' started by Krilion_GD, Dec 18, 2018.

  1. Krilion_GD

    Krilion_GD Community Manager
    Staff Member

    Joined:
    Aug 1, 2011
    Messages:
    2,044
    Likes Received:
    136
    quick script just slammed out for doing a combined d20 + Dex mod + Prof/Bab line attack, so as not to have to write out dice(1d20 + func(getDexMod() + getCasterProfBonus())) everytime...

    Code:
    function getDexAttackRoll() {
        var Num = caster.rollDice("1d20");
        return Num.total() + getDexMod() + getCasterProfBonus();
    }
     

    Attached Files:

    #1 Krilion_GD, Dec 18, 2018
    Last edited: Dec 19, 2018
  2. Krilion_GD

    Krilion_GD Community Manager
    Staff Member

    Joined:
    Aug 1, 2011
    Messages:
    2,044
    Likes Received:
    136
    This is untested

    num = number of units.

    Code:
    function enlargeTarget(num)
    {
        if (null !== targets)
        {
            if(Number.isInteger(num))
            {
                if(num > 50) { num = 50; }
                var xnum = target.getSize() + num;
                if(xnum > 50) { num = 50; }
                target.setSize( target.getSize() + num );
                target.setFace( target.getWidth() + num, target.getHeight() + num );
                target.setReach( target.getReach() + num );
            }
        }
    
        return 0;
    }
    
    Code:
    function reduceTarget(num)
    {
        if (null !== targets)
        {
            if(Number.isInteger(num))
            {
                if(num > 50) { num = 50; }
                var xnum = target.getSize() - num;
                if(xnum < 0) { num = 0; }
                target.setSize( target.getSize() - num );
                target.setFace( target.getWidth() - num, target.getHeight() - num );
                target.setReach( target.getReach() - num );
            }
        }
    
        return 0;
    }
    
    
     
    #2 Krilion_GD, Dec 19, 2018
    Last edited: Dec 19, 2018
  3. Tay-Dor

    Tay-Dor Active Member

    Joined:
    May 15, 2016
    Messages:
    311
    Likes Received:
    47
    Here's an example of the getDexAttackRoll() in a spell flow.
    disrupt undead.png
     

Share This Page