Hi,
I recently started working with JASS. I've been practicing making spells, and I have an incomplete spell which I need some help with. In its current iteration, it should:
My spell has3 1 0 bugss:
The 'print' function is defined in the map script and just displays the message with some formatting; you can treat it as "BJDebugMsg".
Thanks for your help.
I recently started working with JASS. I've been practicing making spells, and I have an incomplete spell which I need some help with. In its current iteration, it should:
- Create the visual effect of Warstomp around caster
- Launch the caster into the air, then bring them back down
- Warstomp again upon collision with the ground
My spell has
Even though I give the caster Crow Form and remove it, the caster's fly height can't be changed - the caster remains visually grounded and GetUnitFlyHeight(caster) returns 0 regardless of what I try to set the value to.
Even though the Warstomp effect gets called twice, the effect only displays once each time the spell is cast (the initial Warstomp, and not when the caster lands).
I based the spell off of Immolation, because I want the ability to be toggleable and drain mana/second (in the final build, the caster will continue to bounce until the ability is deactivated). I want the caster to have a custom buff which has a unique visual effect and the right buff tooltip, but even when I strip my Immolation copy of all of its art and buff properties, it still displays the immolation buff art/icon/tooltip upon activation, and I'm unable to make the spell apply the custom buff. Furthermore, I can't even remove the immolation buff by calling "UnitRemoveBuffBJ('BEim', caster)". How do I remove the immolation buff and add my own custom buff? Is there some secret menu where I can make my spell point to my custom buff, rather than to the immolation buff?
Code:
globals
real jumpHeight = 500.
real totalJumpDuration = 0.
real pollingInterval = 0.05
real jumpSpeedMult = 2
endglobals
function Trig_Warbounce_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A002'
endfunction
function warStomp takes unit u returns nothing
call print("Warstomp")
call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl", GetUnitLoc(u)))
endfunction
function getHeight takes real timeElapsed returns real elevation
return Sin(timeElapsed * jumpSpeedMult)*jumpHeight
endfunction
function getRateOfChange takes real timeElapsed returns real roc
return RAbsBJ((getHeight(timeElapsed) - getHeight(timeElapsed - pollingInterval))*(1/pollingInterval))
endfunction
function bounce takes nothing returns nothing
local timer t = GetExpiredTimer()
local real airTime = TimerGetElapsed(t) + totalJumpDuration
local real height = getHeight(airTime)
local real roc = getRateOfChange(airTime)
local unit caster = LoadUnitHandle(udg_Hashtable, GetHandleId(t), 0)
if height < 0 then
call SetUnitFlyHeight(caster, 0, roc*2)
call warStomp(caster)
//TODO: Check if caster has ability active and unit still has mana
call PauseTimer(t)
call DestroyTimer(t)
set totalJumpDuration = 0
call RemoveSavedHandle(udg_Hashtable, GetHandleId(t), 0)
else
call SetUnitFlyHeight(caster, height, roc)
call print("Time elapsed: " + R2S(airTime) + " height: " + R2S(height) + " actual: " + R2S(GetUnitFlyHeight(caster)))
set totalJumpDuration = totalJumpDuration + pollingInterval
endif
set caster = null
set t = null
endfunction
function Trig_Warbounce_Actions takes nothing returns nothing
local timer t = CreateTimer()
local unit caster = GetTriggerUnit()
call UnitRemoveBuffBJ('BEim', caster)
//TODO: Set up mana drain effect?
if UnitAddAbility(caster, 'Amrf') then
call UnitRemoveAbility(caster, 'Amrf')
endif
call print("Warbounce")
call warStomp(caster)
call SaveUnitHandle(udg_Hashtable, GetHandleId(t), 0, caster)
call TimerStart(t, pollingInterval, true, function bounce)
set caster = null
set t = null
endfunction
//===========================================================================
function InitTrig_Warbounce takes nothing returns nothing
set gg_trg_Warbounce = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(gg_trg_Warbounce, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_Warbounce, function Trig_Warbounce_Conditions)
call TriggerAddAction( gg_trg_Warbounce, function Trig_Warbounce_Actions )
endfunction
The 'print' function is defined in the map script and just displays the message with some formatting; you can treat it as "BJDebugMsg".
Thanks for your help.
Last edited: