Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > HL - Pathfinder Roleplaying Game
Register FAQ Community Today's Posts Search

Notices

Reply
 
Thread Tools Display Modes
riatin
Junior Member
 
Join Date: Jul 2012
Posts: 6

Old June 2nd, 2014, 11:15 AM
I'm attempting to create a Lightning gun weapon based on the bomb mechanic and am new to Hero lab scripting, but not entirely new to programming. I've taken the following bit of code:

Code:
      ~ normally, the uses of thrown weapons are shown in the tracker section
      ~ we don't want that to happen for this weapon, since our charges are
      ~ handled by the class special
      perform delete[User.Tracker]

      ~ Generate the wFixDamage text, v_total is the modifier to damage,
      ~ element is the type of damage. damage is the number of dice done and
      ~ uses #value3[cAlcBomb] for the die size.
      var v_total as number
      var damage as number
      var element as string
      var isfire as number
      var useval as number
      
      damage=1
      useval = 6
      ~isfire = 1
      element = "Lightning"
      call BombDam
and copied and pasted it. My question is this, I need to determine what my die value is for damage (level+1 /2). I imagine there's simple method to do that, but am unable to find an example on the boards.

Thanks!
riatin is offline   #1 Reply With Quote
ShadowChemosh
Senior Member
Volunteer Data File Contributor
 
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,729

Old June 2nd, 2014, 01:29 PM
Where is this script running on as it makes a difference in the answer? Is on a class, Class Special, Weapon???

A general script would be as follows:
Code:
var bonus as number
bonus = round(hero.tagcount[Classes.Fighter]/2,0,-1)
Timing is important and you would want to use Post-Levels/10000. Also change the "Fighter" to be the class you want to count. Or change to "Classes.?" to calculate using all classes.

If your running on a class special you can pull the class level from the class your bootstrapped from without caring what class your attached to. Means the code is now reusable.
Post-Levels/10000
Code:
~ If we're not shown, just get out now
doneif (tagis[Helper.ShowSpec] <> 1)
~ If we've been Disabled, get out now
doneif (tagis[Helper.SpcDisable] <> 0)

~ Calculate bonus of half our character level
field[abValue].value += round(field[xTotalLev].value/2,0,-1)
The abValue will contain your bonus and could then be adjusted from other scripts very easily.

Quote:
Originally Posted by riatin View Post
damage (level+1 /2).
Do you really mean Level+1/2? I guess I am so use to 1/2 level in Pathfinder I gave you code for half-level. So at level two the above will give +1. The way you have it written it would be +3 at level 2.

Hero Lab Resources:
Pathfinder - d20pfsrd and Pathfinder Pack Setup
3.5 D&D (d20) - Community Server Setup
5E D&D - Community Server Setup
Hero Lab Help - Hero Lab FAQ, Editor Tutorials and Videos, Editor & Scripting Resources.
Created by the community for the community
- Realm Works kickstarter backer (Alpha Wolf) and Beta tester.
- d20 HL package volunteer editor.

Last edited by ShadowChemosh; June 2nd, 2014 at 01:43 PM.
ShadowChemosh is offline   #2 Reply With Quote
riatin
Junior Member
 
Join Date: Jul 2012
Posts: 6

Old June 3rd, 2014, 04:32 AM
This bit of code is actually on the weapon 'bomb' and outputs the text for damage based on variables that I don't have declared when sending them to the bombdam subroutine.

The bomb damage is based off of level, 1d6 at 1st, 2d6 at 3rd, 3d6 at 5th, etc.

Thank you for your timely reply, you're a great resource for this Hero Lab community.

Last edited by riatin; June 3rd, 2014 at 05:05 AM.
riatin is offline   #3 Reply With Quote
Aaron
Senior Member
 
Join Date: Oct 2011
Posts: 6,793

Old June 3rd, 2014, 10:13 AM
I'm not sure you can use the procedure for your ability, since it refers specifically to an alchemist class ability. You could probably use tho procedure as a base to define your own script, but ince you don't have access to procedures, I have to post it for you. Here you go:

Code:
    ~ IN: element, damage, isfire, useval
    ~ OUT: nothing
    var v_total as number
    var damage as number
    var element as string
    var isfire as number
    var useval as number

    call TotalBonus

    ~ If we have the Pyromaniac alternate racial trait, check if we are one of
    ~ the bombs that does fire dam, we need to recalculate our damage here. We
    ~ can't just add an extra level to cAlcBomb because that affects all Bombs.
    if (hero.tagis[Helper.PyroGnome] <> 0) then
      if (isfire <> 0) then
        ~ Our damage is (level + 1)/2 rounded up
        var efflevel as number
        efflevel = #levelcount[Alchemist] + 1
        damage += round(efflevel/2, 0, 1)
      else
        damage += #value[cAlcBomb]
        endif
    ~ Otherwise just add the value of cAlcBomb
    else
      damage += #value[cAlcBomb]
      endif

    damage = maximum(damage, 0)

    ~ We need to add our INT mod, stored on the Bomb thing.
    v_total += #value2[cAlcBomb]

    if (hero.tagis[Ability.trFocuBurn] <> 0) then
      if (isfire <> 0) then
        v_total += maximum(round(damage/2,0,-1),1)
        endif
      endif

    ~ generate fixed damage text by looking up our special
    if (v_total = 0) then
      field[wFixRanDam].text = damage & "d" & useval & " " & element
    else
      field[wFixRanDam].text = damage & "d" & useval & signed(v_total) & " " & element
      endif

    ~ we gain a +1 circumstance bonus to hit from the Throw Anything feat (this
    ~ goes after we calculated the TotalBonus for damage above because it is
    ~ only for attack rolls.
    field[ModCirc].value += #hasfeat[fThrowAny]
    field[ModCirc].value += (#hasfeat[fMyThrAnyt] * 2)
Hope that helps!
Aaron is offline   #4 Reply With Quote
riatin
Junior Member
 
Join Date: Jul 2012
Posts: 6

Old June 3rd, 2014, 02:38 PM
Thank you,

V_total outputs a 0 though, I think it's because instead of using [cAlcBomb] I'm using a custom class ability called [cLightning].

How would I output my intelligence modifier after the = in the following?
field[wFixRanDam].text =


Thanks for the patience.
riatin is offline   #5 Reply With Quote
ShadowChemosh
Senior Member
Volunteer Data File Contributor
 
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,729

Old June 3rd, 2014, 03:25 PM
Quote:
Originally Posted by riatin View Post
How would I output my intelligence modifier after the = in the following?
field[wFixRanDam].text =
You need to make sure your running in the Post-Attributes/10000 phase and then you can use the macro "#attrmod[aINT]". Its a macro cause of the # symbol in front and its really just a short cut for saying "hero.child[aINT].field[aModBonus].value". I think aModBonus is the right field but not near HL so can't check.

Code:
field[wFixRanDam].text = #attrmod[aINT]
This is going to list the damage "as" the intelligence modifier. So if you have a 18 int the weapon is going to list its damage as "4".

Hero Lab Resources:
Pathfinder - d20pfsrd and Pathfinder Pack Setup
3.5 D&D (d20) - Community Server Setup
5E D&D - Community Server Setup
Hero Lab Help - Hero Lab FAQ, Editor Tutorials and Videos, Editor & Scripting Resources.
Created by the community for the community
- Realm Works kickstarter backer (Alpha Wolf) and Beta tester.
- d20 HL package volunteer editor.
ShadowChemosh is offline   #6 Reply With Quote
riatin
Junior Member
 
Join Date: Jul 2012
Posts: 6

Old June 3rd, 2014, 04:08 PM
Thank you so much, the timing must have been what was off, I'll have to give that another look.
riatin is offline   #7 Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 02:09 AM.


Powered by vBulletin® - Copyright ©2000 - 2024, vBulletin Solutions, Inc.
wolflair.com copyright ©1998-2016 Lone Wolf Development, Inc. View our Privacy Policy here.