HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

[Spell] Burning Steps

04-24-2007, 12:26 PM#1
IKilledKenny
Hello. I'm very new to this site, I'm coming from thehelper.net.

I have submitted this simple spell in there, and I thought why not make a post here as well? so anyway, I present before you "Burning Steps".

This is a MUI spell that doesn't leak (as far as I'm aware).

Once activated for the next few seconds (10/10/15) a trail of flames will be left behind the caster. Any enemy that will step into the flames will be damaged. This spell will increase the hero's speed as well.









How can this be done? Well using KaTTaNa's Handle system, we can create a certain link between a timer and a unit once it casts the spell. Then, using the timer every amount of seconds (which will varie) we will create a flame and add to it immolation. I'm only using part of KaTTaNa's system

Collapse JASS:
function H2I takes handle h returns integer
    return h
    return 0
endfunction

function LocalVars takes nothing returns gamecache
    return InitGameCache("jasslocalvars.w3v")
endfunction
 
function SetHandleHandle takes handle subject, string name, handle value returns nothing
    if value==null then
        call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),name)
    else
        call StoreInteger(LocalVars(), I2S(H2I(subject)), name, H2I(value))
    endif
endfunction

 
function GetHandleUnit takes handle subject, string name returns unit
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
 
function FlushHandleLocals takes handle subject returns nothing
    call FlushStoredMission(LocalVars(), I2S(H2I(subject)) )
endfunction

After you have copied that into the map header the spell will be useable. There are import instructions inside the READ ME in the map. Enjoy, comments are welcomed.

The spell::

Collapse JASS:
function BurningStepsCon takes nothing returns boolean // This is the condition of the trigger.
// It checks if the ability that was casted is Burning Steps
return GetSpellAbilityId()=='A000' 
// You might need to change 'A000' to some other Id, check in your map.
endfunction

function BurningStepsDo takes nothing returns nothing // This is the function that will create the flames
  local timer CallingTimer=GetExpiredTimer() // We get the timer that triggered this function
  local unit Caster=GetHandleUnit(CallingTimer,"Caster") // We get Caster from the timer using KaTTaNa's Handle System.
  local real CasterX=GetUnitX(Caster) // This is the X of the caster. X + Y = Location
  local real CasterY=GetUnitY(Caster) // This is the Y of the caster. X + Y = Location
  local player Owner=GetOwningPlayer(Caster) // We get the owner of the Caster inside a variable
  local unit FlameDummy // This unit will be used as the created flame
  local integer AbilityLevel=GetUnitAbilityLevel(Caster,'A000') // This will store the level of Burning Steps for the Caster inside a variable
  local real Mana=GetUnitState(Caster, UNIT_STATE_MANA) // We store Caster's mana inside a real local variable
  local real NewMana=Mana-AbilityLevel*0.5 // We calculate the caster's new mana

  if NewMana > 0 then // If his new mana is more then 0 then we do (else we do nothing):
    set FlameDummy=CreateUnit(Owner,'h000',CasterX,CasterY,0) // We create a flame in caster's position, for it's owner and store in in a variable.
    call SetUnitState(Caster,UNIT_STATE_MANA, NewMana) // WE apply the new mana to the caster
    call UnitAddAbility(FlameDummy,'A001') // We add immolation ability to the dummy
    call SetUnitAbilityLevel(FlameDummy,'A001',AbilityLevel) // We set the immolation level for the dummy to the Burning Steps level of the caster
    call UnitApplyTimedLife(FlameDummy,'BTLF',2.00) // We add a command which will kill the dummy in 2 seconds.
  endif
  // Here we remove leaks.
  set FlameDummy=null
  set Owner=null
  set CallingTimer=null
  set Caster=null
endfunction

function BurningStepsAct takes nothing returns nothing // This function will be triggered when a unit starts casting Burning Steps.
  local timer CallingTimer=CreateTimer() // We create a timer, however it is not used yet. We store it inside a variable
  local unit Caster=GetTriggerUnit() // We set Caster as triggering unit.
  local real Redo=20/GetUnitMoveSpeed(Caster) // We define the frequency of the timer
  local real WaitTime // This will serve as the number of second that timer will run
  if GetUnitAbilityLevel(Caster,'A000') < 3 then // If the level of burning steps is smaller then 3 then:
    set WaitTime=10 // WaitTime is now 10
  else // If the level is 3 then:
    set WaitTime=15 // WaitTimer is now 15
  endif

  call SetHandleHandle(CallingTimer,"Caster",Caster) // Using KaTTaNa's Handle System we attach Caster to CallingTimer for future use.
  call TimerStart(CallingTimer,Redo, true,function BurningStepsDo) // We start the timer which will run every Redo time and will call BurningStepDo.
  call TriggerSleepAction(WaitTime) // We wait WaitTime (10 seconds or 15 seconds)
  call FlushHandleLocals(CallingTimer) // We destroy the linkage between CallingTi8mer and Caster
  call DestroyTimer(CallingTimer) // We destroy the timer
  // Here we remove leaks
  set CallingTimer=null
  set Caster=null
endfunction

//===========================================================================
function InitTrig_BurningSteps takes nothing returns nothing
  set gg_trg_BurningSteps=CreateTrigger()
  call TriggerRegisterAnyUnitEventBJ( gg_trg_BurningSteps, EVENT_PLAYER_UNIT_SPELL_EFFECT )
  call TriggerAddCondition(gg_trg_BurningSteps,Condition(function BurningStepsCon))
  call TriggerAddAction(gg_trg_BurningSteps,function BurningStepsAct)
endfunction
04-24-2007, 12:30 PM#2
Rising_Dusk
Please, jass tags not trigger tags.
And honest to God I made this exact same style of spell without gamecache at all.

Just GroupEnumUnitsInRect() in the world rect and get all unit's with the caster buff.
Then loop through them or ForGroup() and spawn fire thingies at their positions with decay timers on them.
Done, no cache needed, fully MUI.
04-24-2007, 12:36 PM#3
IKilledKenny
> Please, jass tags not trigger tags.

Yes I have realised this a second after posting the spell.

> And honest to God I made this exact same style of spell

Ah, I see someone beat me to it. :)

> without gamecache at all

Yeah, the gamechace isn't a must have, but it eases things.

> Done, no cache needed, fully MUI.

This spell should be MUI as well.

Thanks for commenting!