- Joined
- Jun 30, 2006
- Messages
- 230
This is the code for blur, an ability from DotA:
I look at that and it looks like to me that he converted a GUI to JASS. It's done horribly inefficient. The essential part of the spell is:
It follows the RGBA(RedGreenBlueAlpha) standard.
Again, my JASS skills are poor, but what I have so far is this:
It's not much, it's practically nothing lol. So how would I go about doing this? Or is the way it was originally done the only way/best way to do it?
And btw, how do you get the code to show up all nice like it does in a JASS editor? I've tried code=jass or code type=jass, but the code is a lot harder to read the way I have it posted.
JASS:
function Trig_blur_Conditions takes nothing returns boolean
if ( not ( GetLearnedSkillBJ() == 'A03P' ) ) then
return false
endif
return true
endfunction
function Trig_blur_Func001C takes nothing returns boolean
if ( not ( GetUnitAbilityLevelSwapped('A03P', GetTriggerUnit()) == 1 ) ) then
return false
endif
return true
endfunction
function Trig_blur_Func002C takes nothing returns boolean
if ( not ( GetUnitAbilityLevelSwapped('A03P', GetTriggerUnit()) == 2 ) ) then
return false
endif
return true
endfunction
function Trig_blur_Func003C takes nothing returns boolean
if ( not ( GetUnitAbilityLevelSwapped('A03P', GetTriggerUnit()) == 3 ) ) then
return false
endif
return true
endfunction
function Trig_blur_Func004C takes nothing returns boolean
if ( not ( GetUnitAbilityLevelSwapped('A03P', GetTriggerUnit()) == 4 ) ) then
return false
endif
return true
endfunction
function Trig_blur_Actions takes nothing returns nothing
if ( Trig_blur_Func001C() ) then
call SetUnitVertexColorBJ( GetTriggerUnit(), 100, 100, 100, 40.00 )
else
call DoNothing( )
endif
if ( Trig_blur_Func002C() ) then
call SetUnitVertexColorBJ( GetTriggerUnit(), 100, 100, 100, 60.00 )
else
call DoNothing( )
endif
if ( Trig_blur_Func003C() ) then
call SetUnitVertexColorBJ( GetTriggerUnit(), 100, 100, 100, 80.00 )
else
call DoNothing( )
endif
if ( Trig_blur_Func004C() ) then
call SetUnitVertexColorBJ( GetTriggerUnit(), 100, 100, 100, 99.00 )
else
call DoNothing( )
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 Trig_blur_Conditions ) )
call TriggerAddAction( gg_trg_blur, function Trig_blur_Actions )
endfunction
JASS:
SetUnitVertexColorBJ( GetTriggerUnit(), 100, 100, 100, 99.00 )
Again, my JASS skills are poor, but what I have so far is this:
JASS:
constant function Blur_AbilityRC takes nothing returns integer
return 'A001' //The ability's raw code.
endfunction
constant function Blur_Alpha takes integer level returns real
return 15 + level * 1
endfunction
function Trig_Blur_Actions takes nothing returns nothing
local real alpha = Blur_Alpha(GetUnitAbilityLevel(Blur_AbilityRC()))
call SetUnitVertexColorBJ( GetLearningUnit(), 100, 100, 100, alpha )
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 Trig_Blur_Conditions ) )
call TriggerAddAction( gg_trg_Blur, function Trig_Blur_Actions )
endfunction
And btw, how do you get the code to show up all nice like it does in a JASS editor? I've tried code=jass or code type=jass, but the code is a lot harder to read the way I have it posted.
Last edited: