- Joined
- May 9, 2010
- Messages
- 266
Greetings!
I am trying to learn vJass and have made a simple spell. Just heal with floating text.
Heal is works properly, but texttag is not appear
Here is a code, help me please, thanks
I am trying to learn vJass and have made a simple spell. Just heal with floating text.
Heal is works properly, but texttag is not appear
Here is a code, help me please, thanks
JASS:
library heal
globals
private constant integer SpellID = 'A000'//Spell ID
private constant string se = "Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl" // Heal SE
private constant real TTt = 3. //living time of text
private constant real TTs = 15. //Floating text size
private constant real TTtf = 3.5 //Fading time of text
//*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*//
private real HPcur
private real HPs
private real HPplus
private unit u
private integer SpellLevel
private texttag TT
endglobals
function HealAmmount takes integer SpellLevel returns real
return SpellLevel * 50.
endfunction
function Heal takes unit u returns nothing //call Heal(unit)
set HPplus = HealAmmount(SpellLevel)
set HPcur = GetUnitState(u, UNIT_STATE_LIFE) //делаем переменную, равную новому хп юнита
set HPs = HPcur + HPplus
call SetUnitState(u, UNIT_STATE_LIFE, HPs) // сделать хп столько - то
local real HPswap
set HPswap = GetUnitState(u, UNIT_STATE_LIFE) - HPcur
call DestroyEffect(AddSpecialEffectTarget(se,u,"chest")) // Эффект, без BJ
local real ux = GetUnitX(u)
local real uy = GetUnitY(u)
local real uz = GetUnitFlyHeight(u) + GetLocationZ(Location(ux,uy))
//local texttag TT
set TT = CreateTextTag() //Floating text
call SetTextTagPermanent(TT, false)
call SetTextTagLifespan(TT, TTt)
call SetTextTagFadepoint(TT, TTtf)
call SetTextTagText(TT, R2S(HPswap), TTs)
call SetTextTagPos(TT, ux, uy, uz)
endfunction
//===========================================================================
function Conds takes nothing returns boolean
if ( not ( GetSpellAbilityId() == SpellID ) ) then //Conditions
return false
endif
return true
endfunction
function actions takes nothing returns nothing
set u = GetSpellTargetUnit()
set SpellLevel = GetUnitAbilityLevel(GetTriggerUnit(), SpellID)
call Heal(u)//ours HealFunction
endfunction
function InitTrig_Heal_vJass takes nothing returns nothing
local trigger t
set t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT ) //Event
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function actions )
endfunction
endlibrary