HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

2 questions

03-24-2007, 08:08 AM#1
Drain Pipe
I have 2 problems that i cannot seem to solve so here are my questions:

There are certain abilities like sentinal or flare which units carry and can only used a limited amount of. My question is how could, or if it would be possible, to trigger that small number that denotews charges, onto another completely different ability, namely a passive, so the active icons won't do. I was wondering if there was a JASS way to access this interphase.

My second question is if there was a way to find all the variables attached to a particular unit at one time; ie if it was registered as a specific unit. My reasons are for making a swapping spell that would swap in a dummy unit to take the effect and damage from said spell, disabling the effect on the said hero. I was also wondering if you could find local attached variables as well.
03-24-2007, 09:09 AM#2
st33m
I don't know about your second one, you my need custom tooltips. As for your second one you should be able to call a boolean X = X. Where X is a specific unit (Unit 003 or whatever) and the second X is a variable.
03-24-2007, 07:49 PM#3
TaintedReality
To your first: You would have to make custom tooltips and multiple abilities, then trigger switching out the abilities. Probably not worth it.

To your second: I'm not exactly sure what you're asking here, but I'm going to go with no =D. What do you mean by variables attached? Local handle variables (or whatever they're being called these days)? You can find all of those but, of course, you need to know the string key for each individual variable.
03-24-2007, 08:13 PM#4
grim001
Or you could use structs to store everything, and it would become extremely easy to swap the data related to one unit onto another unit.
03-24-2007, 09:30 PM#5
st33m
Quote:
Originally Posted by st33m
I don't know about your second one, you my need custom tooltips. As for your second one you should be able to call a boolean X = X. Where X is a specific unit (Unit 003 or whatever) and the second X is a variable.
Wait I just reread this, and my response doesn't really make sense I don't think. Sorry I wrote this at 2 AM.
03-28-2007, 11:29 PM#6
Drain Pipe
Ok i have another question. I know what unit i'm dealing with; is there a way to find all the variables that represent that unit? Ie the main unit is HERO_...blah blah and his main variable that identifies him is Hero_variable. Now he's also set as "affectedtargetX_varaible" for another trigger that deals dps to that unit so how would i go about finding which one's he's connected to and which one's he isn't?

another question is if i can find a way to transfer buffs from one unit to another? Preferably ALL buffs, or at least, copy them.
03-29-2007, 04:24 AM#7
Pyrogasm
I would say to loop through the variables that he COULD be, and if he is, then set a local handle variable to him for each one that he is. Example:
Collapse JASS:
function SetUnitVariableBooleans takes unit unit returns nothing
    local unit array possibilities
    local integer i = 0

    set possibilities[1] = udg_Some_Variable
    set possibilities[2] = udg_Some_Other_Variable
    //Etc.

    loop
        set i = i+1
        exitwhen i > 2 //2 being the total number of array indexes declared above
        call SetHandleBoolean(unit, "Variable Possiblities " + I2S(i), (possibilites[i] == hero)
        set possibilities[i] = null
    endloop
endfunction

And then determine if a unit is stored to a specific variable with something like this:
Collapse JASS:
function CheckUnitVariableBoolean takes unit hero, integer index returns boolean
    return GetHandleBoolean(unit, "Variable Possibilites "+I2S(index))
endfunction

That is, of course, assuming that you're using the Local Handle Variables system by KaTTaNa, or CSCache by Vexorian.