![]() |
Junior Member
Join Date: Jul 2012
Posts: 6
|
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 Thanks! |
![]() |
![]() |
Senior Member
Volunteer Data File Contributor
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,729
|
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) 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) 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. |
![]() |
![]() |
Junior Member
Join Date: Jul 2012
Posts: 6
|
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. |
![]() |
![]() |
Senior Member
Join Date: Oct 2011
Posts: 6,793
|
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) |
![]() |
![]() |
Junior Member
Join Date: Jul 2012
Posts: 6
|
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. |
![]() |
![]() |
Senior Member
Volunteer Data File Contributor
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,729
|
Quote:
Code:
field[wFixRanDam].text = #attrmod[aINT] 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. |
|
![]() |
![]() |
Junior Member
Join Date: Jul 2012
Posts: 6
|
Thank you so much, the timing must have been what was off, I'll have to give that another look.
|
![]() |
![]() |
![]() |
|
|