Spy
Join Date: Jan 2011
Location: Van Nuys, California
Posts: 1,220
|
There are pIsOn1 and pIsOn2 that look if checkboxes have been activated, but is there a field I can access for Charges that tells me if I'm using the decrementer or incrementer on the charges? Kind of like a listener? Or anything that returns its value (-1 or +1 in activation mode, 0 when idle)?
|
#1 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,217
|
Please explain what you're trying to accomplish here.
|
#2 |
Spy
Join Date: Jan 2011
Location: Van Nuys, California
Posts: 1,220
|
I was trying to automate a process,I misspoke, I meant hIsOn1 and hIsOn2. I have an ability that relies on the number of turn attempts remaining in a day, and that itself used up turn attempts. I call them Auras. So, when I activate an Aura, available equal to the number of turn attempts remaining in the day, it puts a charge on the turning attempts, and a charge on the Aura. For example:
AuraX 0/2 : requires 2 turn attempts to use. AuraY 0/4 : requires one turn attempt to use. Turn Undead 0/4 Using one of the AuraX charges, you end up with: AuraX 1/2 AuraY 0/3 Turn Undead 2/4 So I'm dynamically updating the charges (yeah, I know the dangers, I've worked past them by doing exception catches in the code). So I'm using trustme to make everything work, and the updating is sound. Now I need to know what updating is taking place (decrementing a charge, or incrementing a charge, for resetting essentially). Crazy idea huh? This is the crazy code, without the listeners present, for a simple effect. ~ Generate our number of uses dependent on turn attempts remaining. var current as number trustme current = hero.child[xTurning].field[hTotal].value - hero.child[xTurning].field[hUsed].value ~ Check for current uses on a selected ability. field[hTotal].value = current + field[hUsed].value ~ Make sure the uses don't exceed totals. if (field[hUsed].value > field[hTotal].value) then field[hTotal].value = field[hUsed].value endif ~ Determine uses of the turning ability. if (<listener inc/dec>) then hero.child[xTurning].field[hUsed].value += 1 ~ or -1, depending on what listener returns. endif ~ Make sure the uses don't exceed totals. if (hero.child[xTurning].field[hUsed].value > hero.child[xTurning].field[hTotal].value) then hero.child[xTurning].field[hUsed].value = hero.child[xTurning].field[hTotal].value endif |
#3 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,217
|
It's hidden, but there's an hChildUsed field, which is used by the charges on a staff to apply however many times each individual spell has been used * the number of charges that spell uses, to the total number of charges spent on the overall staff.
Can you have your alternate thing be a separate special, with a separate tracker, and have it set the hChildUsed field of the main thing equal to its own hUsed * 2? That way, the user will see two different specials, for auras X and Y. As each one of those is used, the total number of aura charges remaining will change with it. |
#4 |
Spy
Join Date: Jan 2011
Location: Van Nuys, California
Posts: 1,220
|
Yes, I have them as separate specials. I've tried something very similar to the hChildUsed, and the results kept putting charges on the Auras that weren't being used. No worries, this was just a wild idea I had, I just can't implement it without knowing whether I am decrementing or incrementing the charges used. With that hidden, well, I can't. It was a fancy idea, but I think I'm not going to work on it anymore when I have alot of other things to finish . Thanks for the help!
|
#5 |
|
|