• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[vJASS] CAn someoen help me here, jass/vjass indexing & code

Status
Not open for further replies.
Hi all I'm trying here to create a something with this spell, cause they told me Indexing would be easier, and for timers. I could do this in GUI, but i have to include indexed timer(Which i didn't yet), but can you check this code, I blowed my head to write some things, and tell me what do you think...(Almost)I have no idea what I'm doing. ...And the code is unfinished.
JASS:
//                           RECALL / CALLBACK v1.0.0
//                                   created by Stan0033 
//                              [url]http://www.hiveworkshop.com/users/stan0033[/url]

//  Remembers X heroes in X range around the caster with their exact positions.
//   On a second casting these units are teleported back to these positions, 
//                                              if in X range of the caster.
// ===================CONFIGURATION============================
function setvariables takes nothing returns nothing
set udg_RECALL_Integer = 4 //number of heroes stored in the spell
set udg_RECALL_Radius = 500 // The radius around the caster that is used to pick the heroes.
set udg_RECALL_RR = 2000 // The distance required for units in the spell in order to teleport them back.
set udg_RECALL_Indexer = udg_RECALL_Indexer
endfunction
// ===================CONFIGURATION END========================
function trig_RECALL_Event takes nothing returns nothing
call TriggerRegisterAnyUnitEventBJ( gg_trg_RECALL, EVENT_PLAYER_UNIT_SPELL_EFFECT )

endfunction
function Trig_RECALL_Func01 takes nothing returns boolean //First requirment for picking units, can be changed.
return ( GetOwningPlayer(GetEnumUnit()) == GetOwningPlayer(GetSpellAbilityUnit()) )
endfunction
function Trig_RECALL_Func02 takes nothing returns boolean //Second requirment for picking units, can be changed.
return ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) == true )
endfunction

function Pickup_Gr00 takes nothing returns boolean
    return GetBooleanAnd( Trig_RECALL_Func01(), Trig_RECALL_Func02() )
endfunction

function Trig_RECALL_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A0de' ) ) then
        return false
    endif
    return true
endfunction
function Trig_RECALL_GroupLoop takes nothing returns nothing
set bj_forLoopAIndex = udg_RECALL_Indexer
    set bj_forLoopAIndexEnd = udg_RECALL_Indexer + udg_RECALL_Integer
    loop
set RECALL_Locs[RECALL_Indexer] = GetUnitLoc(GetEnumUnit())
set RECALL_heroes[GetForLoopIndexA()] = GetEnumUnit()
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
endfunction
function Trig_RECALL_Actions takes nothing returns nothing
set udg_RECALL_Indexer = udg_RECALL_Indexer + udg_RECALL_Integer
set udg_RECALL_Caster[udg_RECALL_Indexer] = GetTriggerUnit()
set bj_forLoopAIndex = udg_RECALL_Indexer
    set bj_forLoopAIndexEnd = udg_RECALL_Integer
    loop
        
if udg_RECALL_SpellActive[GetForLoopIndexA()] == false then
set udg_RECALL_Indexer = udg_RECALL_Indexer + udg_RECALL_Integer
set udg_RECALL_Caster_Loc = GetUnitLoc(GetSpellAbilityUnit())
set udg_RECALL_RangeGr[GetForLoopIndexA()] = GetUnitsInRangeOfLocMatching(512, udg_RECALL_Caster_Loc, Condition(function Pickup_Gr00))
// the range of group can be changed. Or set to variable.
call GroupRemoveUnitSimple( GSpellAbilityUnit(), udg_RECALL_RangeGr[GetForLoopIndexA()] )
call ForGroupBJ( udg_RECALL_RangeGr[udg_RECALL_Indexer], function Trig_RECALL_GroupLoop)
set udg_RECALL_SpellActive[GetForLoopIndexA()] = true
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
    endif
    return
    if udg_RECALL_SpellActive[GetForLoopIndexA()] == true then
    set bj_forLoopAIndex = udg_RECALL_Indexer
    set bj_forLoopAIndexEnd = udg_RECALL_Indexer + udg_RECALL_Integer
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        call AddSpecialEffectTargetUnitBJ( "origin", udg_RECALL_heroes[GetForLoopIndexA()], "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportTo.mdl" )
        set udg_RECALL_SFX_CurPos[GetForLoopIndexA()] = GetLastCreatedEffectBJ()
        call AddSpecialEffectLocBJ( udg_RECALL_Locs[GetForLoopIndexA()], "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportTo.mdl" )
        set udg_RECALL_SFX_OldPos[GetForLoopIndexA()] = GetLastCreatedEffectBJ()
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
    endif
endfunction
 
Status
Not open for further replies.
Top