- Joined
- Jul 12, 2010
- Messages
- 1,737
Hi everybody, I have been experimenting with the UI Natives and I was thinking that's it's really possible to create a lot of custom spells using only triggers.
Of course this is all thanks to @Tasyen and his awesome UI Tutorials
So this is pretty much a simple spell/ability I coded.
To do:
-Cooldown for spells (coming soon)
What I need help with:
Pretty much a jass beginner so I basically convert gui to jass and modify it to my needs.
I saw some people saying BJs are bad so should:
PolarProjectionBJ, AddSpecialEffectLocBJ, DestroyEffectBJ, IssuePointOrderLocBJ not be used?
can they be replaced with something else?
Any other rookie mistakes I do in my coding? feedback is much appreciated.
Of course this is all thanks to @Tasyen and his awesome UI Tutorials
JASS:
function clickedability01 takes nothing returns nothing
//I use udg_Player_Hero cause that's the main variable I use for all my systems in my RPG map
//And I only need this to be MPI so it doesn't really matter
local integer pid = GetConvertedPlayerId(GetTriggerPlayer())
local unit u = (udg_Player_Hero[pid])
local location p1 = GetUnitLoc(u)
local location p2 = PolarProjectionBJ(p1, 500.00, GetUnitFacing(u))
local location p3 = PolarProjectionBJ(p1, 1000.00, GetUnitFacing(u)) //this is to keep the unit moving forward, not really needed
call SetUnitPositionLoc( u, p2 )
call AddSpecialEffectLocBJ( p2, "Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl" )
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
call IssuePointOrderLocBJ( u, "move", p3 ) //this is to keep the unit moving forward, not really needed
call RemoveLocation(p1)
call RemoveLocation(p2)
call RemoveLocation(p3)
set u = null
call DisplayTimedTextToForce( bj_FORCE_PLAYER[0], 2.00, "ability click" )
call BlzFrameSetEnable(BlzGetTriggerFrame(), false) //disable the clicked button
call BlzFrameSetEnable(BlzGetTriggerFrame(), true) //enable it again.
endfunction
//===========================================================================
function Holy_Blink takes nothing returns nothing
local trigger trig = CreateTrigger()
local framehandle abilityicon = BlzCreateFrameByType("BACKDROP", "AbilityIcon", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), "", 0)
local framehandle abilitybutton = BlzCreateFrameByType("GLUEBUTTON" , "AbilityClick" , abilityicon, "ScoreScreenTabButtonTemplate", 0)
local framehandle hover = BlzCreateFrameByType("FRAME", "FaceFrame", abilityicon,"", 0)
local framehandle tooltip = BlzCreateFrameByType("TEXT", "FaceFrameTooltip", hover,"", 0)
call BlzFrameSetSize(abilityicon, 0.04, 0.04)
call BlzFrameSetAbsPoint(abilityicon, FRAMEPOINT_CENTER, 0.235, 0.158)
call BlzFrameSetTooltip(abilitybutton, tooltip)
call BlzFrameSetText(tooltip, " Holy Blink (Q)|n|nBlinks the hero forward")
call BlzFrameSetPoint(tooltip, FRAMEPOINT_BOTTOM, abilityicon, FRAMEPOINT_TOP, 0.0, 0.01)
call BlzFrameSetAllPoints(abilitybutton, abilityicon)
call BlzFrameSetTexture(abilityicon, "ReplaceableTextures\\CommandButtons\\BTNHolyBolt",0, true)
call BlzTriggerRegisterFrameEvent(trig, abilitybutton , FRAMEEVENT_CONTROL_CLICK)
call BlzTriggerRegisterPlayerKeyEvent(trig, Player(0), OSKEY_Q, 0, true)
call TriggerAddAction(trig, function clickedability01 )
endfunction
//===========================================================================
function InitTrig_Holy_Blink takes nothing returns nothing
set gg_trg_Holy_Blink = CreateTrigger( )
call TriggerRegisterTimerEventSingle( gg_trg_Holy_Blink, 0.10 )
call TriggerAddAction( gg_trg_Holy_Blink, function Holy_Blink )
endfunction
To do:
-Cooldown for spells (coming soon)
What I need help with:
Pretty much a jass beginner so I basically convert gui to jass and modify it to my needs.
I saw some people saying BJs are bad so should:
PolarProjectionBJ, AddSpecialEffectLocBJ, DestroyEffectBJ, IssuePointOrderLocBJ not be used?
can they be replaced with something else?
Any other rookie mistakes I do in my coding? feedback is much appreciated.