• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] Blur: Handle Vars?

Status
Not open for further replies.
Level 6
Joined
Jun 30, 2006
Messages
230
Edit: I have made some progress by pulling more out of the .j file, but some of it still doesn't make sense. Obviously the first function is just the H2I, but the others... None of the handle vars functions take three parameters. Any help?
I don't know if any of you remember that I made my own version of Blur from DotA, but it doesn't work correctly if your unit dies/casts a spell such as wind walk/etc. So I decided to take a look at the DotA spell. I've had to rename a lot of things so they are readable, but I am struggling to find out what a few of the custom functions are. I believe they are part of the Handle Vars system.
JASS:
globals
    gamecache MyCache = null
endglobals
function I01IIO takes handle h returns integer
    return h
    return 0
endfunction
function IIO1OO takes string I011IO,string IIOO1O returns unit
    return GetStoredInteger(MyCache,I011IO,IIOO1O)
    return null
endfunction
function I011OO takes handle h returns string
    return I2S(I01IIO(h))
endfunction
function IIOOIO takes string I011IO,string IIOO1O,handle IIO0OO returns nothing
    call StoreInteger(MyCache,I011IO,IIOO1O,I01IIO(IIO0OO))
endfunction
function Refresh takes nothing returns nothing
    local unit u=IIO1OO(I011OO(GetTriggeringTrigger()),"PhantomAssassin")
    local integer i=GetUnitAbilityLevel(u,'A001')
    if(GetUnitState(u,UNIT_STATE_LIFE)>1)then
        if(i==1.0)then
            call SetUnitVertexColor(u,255,255,255,60)
        endif
        if(i==2.0)then
            call SetUnitVertexColor(u,255,255,255,40)
        endif
        if(i==3.0)then
            call SetUnitVertexColor(u,255,255,255,20)
        endif
        if(i==4.0)then
            call SetUnitVertexColor(u,255,255,255,2)
        endif
    endif
endfunction
function Conditions takes nothing returns boolean 
    return GetLearnedSkill()==Blur[0] and IsUnitIllusion(GetTriggerUnit())==false
endfunction
function Actions takes nothing returns nothing
    local integer i=GetUnitAbilityLevel(GetTriggerUnit(),'A001')
    local trigger t
    local unit u=GetTriggerUnit()
    if(i==1.0)then
        call SetUnitVertexColor(u,255,255,255,60)
        set t=CreateTrigger()
        call TriggerAddAction(t,function Refresh)
        call TriggerRegisterTimerEventPeriodic(t,2)
        call IIOOIO(I011OO(t),"PhantomAssassin",u)
    endif
    if(i==2.0)then
        call SetUnitVertexColor(u,255,255,255,40)
    endif
    if(i==3.0)then
        call SetUnitVertexColor(u,255,255,255,20)
    endif
    if(i==4.0)then
        call SetUnitVertexColor(u,255,255,255,2)
    endif
endfunction
function InitTrig_Blur takes nothing returns nothing
    set gg_trg_Blur=CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(gg_trg_Blur,EVENT_PLAYER_HERO_SKILL)
    call TriggerAddCondition(gg_trg_Blur,Condition(function Conditions))
    call TriggerAddAction(gg_trg_Blur,function Actions)
endfunction
Oh, this isn't just renamed, btw, it also has a few useless BJ's replaced. Icefrog never does replace them. I also am going to assign global variables for the % for the alpha per level and get rid of some if then statements. I can do that myself, though. I really just need to know what those custom functions are.
Any ideas?
 
Last edited:
Level 6
Joined
Jun 30, 2006
Messages
230
Mr. Bomber... I am not sure that you understood what I meant. The spell itself I have already created, search for "Spell Help::Blur" and you will see this is the case. I was curious to know how DotA did theirs, so I pulled this out. I am not asking for "Deprotection" and it it certainly isn't hacking. What I was trying to understand is what they were doing, and there were four functions that I did not understand. I provided the functions, and I did not know what they mean. That is what I asked for. I think you misunderstood. I do not wish to sound disrespectful, Mr. Bomber, but perhaps if you had read better you would have seen what I was actually asking. Please read more carefully before posting a reply such as yours.

I came back to say that I no longer need help, that after staring at it for long enough, it clicked. My completed code looks like this, and Mr. Bomber, you will notice that it is substantially different...

JASS:
globals
    integer array Blur
    gamecache MyCache = null
endglobals
function H2I takes handle h returns integer
    return h
    return 0
endfunction
function H2S takes handle h returns string
    return I2S(H2I(h))
endfunction
function i2U takes string I011IO,string IIOO1O returns unit
    return GetStoredInteger(MyCache,I011IO,IIOO1O)
    return null
endfunction
function IIOOIO takes string I011IO,string IIOO1O,handle IIO0OO returns nothing
    call StoreInteger(MyCache,I011IO,IIOO1O,H2I(IIO0OO))
endfunction
function BlurRefresh takes nothing returns nothing
    local unit u=i2U(H2S(GetTriggeringTrigger()),"PhantomAssassin")
    local integer i=GetUnitAbilityLevel(u,Blur[0])
    if(GetUnitState(u,UNIT_STATE_LIFE)>1)then
        call SetUnitVertexColor(u,255,255,255,Blur[i])
        call DisplayTextToPlayer(GetTriggerPlayer(), 0, 0, "I fire!")
    endif
endfunction
function BlurConditions takes nothing returns boolean 
    set Blur[0] = 'A000'
    set Blur[1] = 60
    set Blur[2] = 40
    set Blur[3] = 20
    set Blur[4] = 2
    return GetLearnedSkill()==Blur[0] and IsUnitIllusion(GetTriggerUnit())==false
endfunction
function BlurActions takes nothing returns nothing
    local integer i=GetUnitAbilityLevel(GetTriggerUnit(),Blur[0])
    local trigger t
    local unit u=GetTriggerUnit()
    if(i==1.0)then
        call SetUnitVertexColor(u,255,255,255,Blur[i])
        set t=CreateTrigger()
        call TriggerRegisterTimerEvent(t,2, true)
        call TriggerAddAction(t,function BlurRefresh)
        call StoreInteger(MyCache,H2S(t),"PhantomAssassin",H2I(u))
    else
        call SetUnitVertexColor(u,255,255,255,Blur[i])
    endif
endfunction
function InitTrig_Blur takes nothing returns nothing
    set gg_trg_Blur=CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(gg_trg_Blur,EVENT_PLAYER_HERO_SKILL)
    call TriggerAddCondition(gg_trg_Blur,Condition(function BlurConditions))
    call TriggerAddAction(gg_trg_Blur,function BlurActions)
endfunction

The strange functions were basically custom-made "BJ" functions, meaning they basically called other functions to do their dirty-work. I don't know why it didn't click the first time. It's simple, actually.

My only problem now is that the refresh doesn't seem to work. I know it fires every two seconds as I had it display text, but it isn't setting the vertex coloring... I'm not sure I'm still storing my variable correctly since my rewrite, because it's the detecting life it fails on, but I'll work it out.
 
Last edited:
Level 19
Joined
Aug 24, 2007
Messages
2,888
this is just idiot

periodic timer
group every unit on map
if they have blur ability
set unit color 100-100-100 - 22*abilitylevel
 
Level 11
Joined
Aug 25, 2006
Messages
971
Sorry, the function names in your above post almost look obfuscated, which led me to believe you had pulled them straight out of dota's mpq. I reread your post, and it still sounds that way to me. Next time try to clarify a bit more (like tell us where the code originated), sorry for the misunderstanding.
 
Level 6
Joined
Jun 30, 2006
Messages
230
SuperFrog... when a map has a lot of units, you don't want to go adding them to a group, checking to see if they have the ability, setting it if they do, then destroying the group EVERY 2 SECONDS! If this was the only spell, sure, but in a map like DotA when tons of triggers are going off all the time, or for the map I'm creating (Footmen VS Grunts) where there are TONS of units, this just doesn't cut it.

No hard feelings, Mr. Bomber. Even I misunderstand things on occasion.

My functions are a bit different now. I won't post them here. I'll just submit it as part of my spell-pack when I am done.
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
You are idiot then
Just create a global group
add units to group when they gain that skill
and set their vertex color everysecond (without checking for ability because they have already)

Or better way if you dont want to use GetUnitAbilityLevel every sec

Put them groups like Vis[ability level]
from 1 to 4
set their vertex coloring
This is fastest and easiest way I can think
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
SuperFrog... when a map has a lot of units, you don't want to go adding them to a group, checking to see if they have the ability, setting it if they do, then destroying the group EVERY 2 SECONDS! If this was the only spell, sure, but in a map like DotA when tons of triggers are going off all the time, or for the map I'm creating (Footmen VS Grunts) where there are TONS of units, this just doesn't cut it.
That's actually pretty lightweight, in a map like dota. (2 seconds is nothing - a spell, for example a none homing projectile, is doing anywhere between about 30 and 100 enumerations a second in its general area)

Also, Blue_Jeans, the 3-param functions are Set<blah>, while the 2-param functions are Get<Blah>. (Or they should be)
 
Level 6
Joined
Jun 30, 2006
Messages
230
That's actually pretty lightweight, in a map like dota. (2 seconds is nothing - a spell, for example a none homing projectile, is doing anywhere between about 30 and 100 enumerations a second in its general area)

Also, Blue_Jeans, the 3-param functions are Set<blah>, while the 2-param functions are Get<Blah>. (Or they should be)

About the first part: I didn't mean every two seconds itself is intensive, I meant that in an active 5v5 DotA there are lots of other things going on. Any game with Mercurial tends to lag if people's computers aren't very good. I've never taken a look at the actual triggers for her, but I know they create and destroy a lot of units. I was merely saying that it can be done with Handle Vars and in this case would probably be faster.

About the second part: Thanks. I don't fully understand them, but I figured out the general "how they work" on my own. They look like they are just functions to make it easier to code rather than having to write I2S(H2I(blah)) every time and things like that.

@Need_O2:
I realize English probably isn't your first language, but "you are idiot" isn't really necessary... Adding units that gain the skill to a group would work, though. As I said in my last post, I did get it working. I've done a little bit of searching in our spell archive and I don't believe Blur is in there. I couldn't find it with a quick search, at least. Perhaps I'll submit it along with a few other spells I have.
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
yea sorry for that I was little angry
Umm dont worry I got an -rep for that
Your revange has been TAK3N by HINDYhat :D
(why everyone starts to give -rep after mod promote :p kidding)
 
Level 6
Joined
Jun 30, 2006
Messages
230
yea sorry for that I was little angry
Umm dont worry I got an -rep for that
Your revange has been TAK3N by HINDYhat :D
(why everyone starts to give -rep after mod promote :p kidding)

Hey, man, no hard feelings. I didn't take it offensively, I was just trying to promote goodwill. I certainly didn't wish -rep on you :)

I'm going to try to learn structs to implement them for this spell. It seems it would be a better way.
 
Status
Not open for further replies.
Top