Lone Wolf Development Forums

Lone Wolf Development Forums (http://forums.wolflair.com/index.php)
-   HL - d20 System (http://forums.wolflair.com/forumdisplay.php?f=46)
-   -   Stopping a Script (http://forums.wolflair.com/showthread.php?t=12572)

Kendall-DM March 5th, 2011 03:57 PM

Stopping a Script
 
Is there a way to stop a script from running once it's actually been run? I've tried deleting the Helper.ShowSpec and testing for it, but that doesn't work in this case (it's a Custom Ability). The script always runs, when all I want it to do is run once and stop. A general search of the board hasn't helped much.

Mathias March 5th, 2011 05:10 PM

Please elaborate on what you're trying to accomplish here.

Kendall-DM March 5th, 2011 05:38 PM

I have given the Rogue a choice in its Special Abilities to choose an Extra Skill Point, but the Extra Skill Point works like Intelligence in that it applies to the current level and every level thereafter. So, for example, a Halfling Rogue with a 10 Int gets 8 skill points per level, but at 10th level he takes this ability and gets 9 skill points per level for each level from 10th to 20th. So I've tried two approaches, one is to just add the extra 1 into herofield[tSkTotals].arrayvalue[index] where the index is for Rogue, but that only adds to the current level, or I can add 1 to hero.child[cHelpRog].field[cSkills].value, but it changes ALL the levels of Rogue. So I've determined that I can just subtract out the previous levels extra points, with the cSkills to the new points per level already set for each level afterwards. Unfortunately, every level wants to run the recalculation of the previous levels, and I want it to no longer run that script. Once the points are subtracted out the first time, and the cSkills set to add an extra point, I no longer need the script to run.

~ If we're not shown, just get out now
doneif (tagis[Helper.ShowSpec] = 0)

~ Add an additional skill point per rogue level hereafter.
hero.child[cHelpRog].field[cSkills].value += 1

~ Remove skill points from previous levels in Rogue.
var index as number
var prev as number
index = hero.child[cHelpRog].field[cClsIndex].value
prev = #levelcount[Rogue] + 2
herofield[tSkTotals].arrayvalue[index] -= prev

So, obviously, once this script runs the first time, it continues to run each level to subtract out the previous levels, and I would like it to no longer run the script. I've tried some control statements to ignore the critical section here, but since I don't have a static variable I can set to make sure it paths correctly, it continues to run the script.

Mathias March 6th, 2011 12:40 AM

You'll need a selector - the activation amount is the normal one to use for this - to let the user specify what level they took the ability at. Then have the ability figure out what it should actually grant based on that level.

Lawful_g March 6th, 2011 05:24 AM

Once you have that level, you can do a foreach that looks at the Class levels (not the Class Helper) and compares the value of their Index field to the level it was taken at. If it is equal or above, add one to a variable "BonusSkill". Then, outside the foreach add "BonusSkill" number of skills to the rogue class skill total.

I did a similar thing with the "Vow of Poverty" feat from Book of Exalted Deeds if you want an example.

Kendall-DM March 6th, 2011 07:49 AM

Sorry Mathias, what do you mean by selector? Nevermind, figured it out.

Lawful_g, I was trying to avoid user tags if I could, but I'll keep that in mind if I end up needing to use it. The foreach is another way to achieve the same thing I'm doing here, and is probably more elegant if I don't really need to change cSkills.

Kendall-DM March 10th, 2011 07:19 PM

Ok, I've been plugging at this for about an hour or so. How exactly do I make a selector with hit dice? I just can't seem to figure it out. I created a Hit Dice special that I could set its Value to herofield[tHitDice].value, but it never took. Even though I could get the value from tHitDice, assigning it to a Value field in xHitDice simply resulted in '0' in that field. I changed phases, timing, anything that I could think of, still stayed '0'. Of course in this case, it would only give a selector with the current level, but I was just trying to get it to work at this point. Plus I couldn't figure out how to make a list in the selector that is 1 through 20. So, I tried a few other methods, including just trying to make the selector "1|2|3|4|...|20", which it doesn't recognize. I'm at a complete loss (outside of making 20 user tags for each level, but I'd like to avoid that).

Kendall-DM March 11th, 2011 09:59 AM

bump... still need help trying to code level in a selector (either as a list of levels, or the current level, either will do).

Kendall-DM March 15th, 2011 08:04 AM

Bump again... still not sure how to accomplish this, if at all.

Mathias March 15th, 2011 09:11 AM

Sorry, I was remembering an "activation amount" field that's somewhere else, rather than available where you need it.

You can use the tracker - give it a min of 1 and a max of 20, and let the user enter the level they took the thing at.


All times are GMT -8. The time now is 06:56 AM.

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