Hepl me with spell....

PT.Dyland

New Member
Reaction score
0
someone tell me how to fix an error in this code?
JASS:
function LOD takes nothing returns boolean
    return GetSpellAbilityId() == 'A01D'
endfunction
//*****************************************
private function checkgroup takes nothing returns boolean
    return IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) and IsUnitAliveBJ(GetFilterUnit()) == true
endfunction

function actLOD takes nothing returns nothing
   local unit u = GetTriggerUnit()
   local location p = GetSpellTargetLoc()
   local group g = CreateGroup()
   local unit enum
   local real dame = ( ( 400.00 + ( 100.00 * I2R(GetUnitAbilityLevelSwapped('A01D', u)) ) ) + ( 3.50 * I2R(GetHeroStatBJ(bj_HEROSTAT_STR, u, true)) ) )
   call CreateNUnitsAtLoc(1, 'h002', GetOwningPlayer(u), p, bj_UNIT_FACING)
   call UnitApplyTimedLifeBJ(1, 'BTLF', GetLastCreatedUnit())
   call TriggerSleepAction(0.5)
   call SetUnitPositionLoc(u, p)
   call CreateEffectCircle(u, 300.00, 6, "Objects\\Spawnmodels\\Undead\\UndeadDissipate\\UndeadDissipate.mdl", 2)
   call DestroyEffect(GetLastCreatedEffectBJ())
   call CreateEffectLoc(p, "Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl", 2.00)
   call DestroyEffect(GetLastCreatedEffectBJ())
   call GroupEnumUnitsInRange(G, GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit()), 400, Condition(function checkgroup))
   loop
       set enum = FirstOfGroup(G)
       exitwhen (enum == null)
       call UnitDamageTarget(GetTriggerUnit(), enum, dame, false, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_ENHANCED, null)
       call GroupRemoveUnit(enum)
    endloop
    call GroupClear(G)
    set enum = null
    call DestroyGroup(G)
    call RemoveLocation(p)
    set u = null
endfunction

//****************************************************************************************************

function IniTrg_LeapOfDeath takes nothing returns nothing
    set gg_trg_LeapOfDeath = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(gg_trg_LeapOfDeath, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(gg_trg_LeapOfDeath, Condition(function LOD))
    call TriggerAddAction(gg_trg_LOD, function actLOD)
endfunction

Error: private outside library/scope definition
 

Romek

Super Moderator
Reaction score
963
JASS:
private function checkgroup takes nothing returns boolean

->
JASS:
function checkgroup takes nothing returns boolean


I'd suggest making everything private though, and adding [ljass]scope Name[/ljass] at the top of the code, and [ljass]endscope[/ljass] at the bottom.
 

dudeim

New Member
Reaction score
22
Here try this little optimized removed some BJ's etc.. and made everything private
JASS:
scope INPUTNAMEHERE initializer init //we define a scope here so we can use private function instead of normal function
//private function can only be called inside the scope, but the name of the function can be used in multiple triggers as they are private and won't have the exact same name  after compiling

private function LOD takes nothing returns boolean
    return GetSpellAbilityId() == 'A01D'
endfunction
//*****************************************
private function checkgroup takes nothing returns boolean
    return IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) and (not(IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD) and GetUnitTypeId(GetFilterUnit()) != 0)) //this is is the same as Unit is Alive
endfunction

private function actLOD takes nothing returns nothing
   local unit u = GetTriggerUnit()
   local location p = GetSpellTargetLoc()
   local group g = CreateGroup()
   local unit enum
   local real dame = ( ( 400.00 + ( 100.00 * I2R(GetUnitAbilityLevel(u, 'A01D')) ) ) + ( 3.50 * I2R(GetHeroStr(u, true)) ) )
   call CreateNUnitsAtLoc(1, 'h002', GetOwningPlayer(u), p, bj_UNIT_FACING) //didn't want to rewrite this and not sure if it's a bad BJ
   call UnitApplyTimedLife(bj_lastCreatedUnit, 'BTLF', 1)
   call TriggerSleepAction(0.5)
   call SetUnitPositionLoc(u, p)
   call CreateEffectCircle(u, 300.00, 6, "Objects\\Spawnmodels\\Undead\\UndeadDissipate\\UndeadDissipate.mdl", 2) //this function if i'm right it creates multiple effects if that's true the function itself should clear the leak and here the destroy effect thingy is not needed as you can only destroy 1 with it
   call DestroyEffect(bj_lastCreatedEffect) //so this might not be needed
   call CreateEffectLoc(p, "Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl", 2.00)//this might be another story dunno check the function
   call DestroyEffect(bj_lastCreatedEffect)
   call GroupEnumUnitsInRange(G, GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit()), 400, Condition(function checkgroup))
   loop
       set enum = FirstOfGroup(G)
       exitwhen (enum == null)
       call UnitDamageTarget(GetTriggerUnit(), enum, dame, false, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_ENHANCED, null)
       call GroupRemoveUnit(enum)
    endloop
    call GroupClear(G)
    set enum = null
    call DestroyGroup(G)
    call RemoveLocation(p)
    set u = null
endfunction

//****************************************************************************************************

private function init takes nothing returns nothing //we renamed this trigger to init as we made an initializer named init (at the top by the scope we declared it)
    local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(t, Condition(function LOD))
    call TriggerAddAction(t, function actLOD)
    set t = null //as far as I know trigger vars need to be nulled also
endfunction

endscope //we need to end the scope at the bottom
 

PT.Dyland

New Member
Reaction score
0
thanks pro very much
JASS:
Objects\\Spawnmodels\\Undead\\UndeadDissipate\\UndeadDissipate.mdl", 2) //this function if i'm right it creates multiple effects if that's true the function itself should clear the leak and here the destroy effect thingy is not needed as you can only destroy 1 with it
   call DestroyEffect(bj_lastCreatedEffect) //so this might not be needed
   call CreateEffectLoc(p, "Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl", 2.00)//this might be another story dunno check the function
   call DestroyEffect(bj_lastCreatedEffect)


It's in EGUI
 

Tyrulan

Ultra Cool Member
Reaction score
37
thanks pro very much
JASS:
Objects\\Spawnmodels\\Undead\\UndeadDissipate\\UndeadDissipate.mdl", 2) //this function if i'm right it creates multiple effects if that's true the function itself should clear the leak and here the destroy effect thingy is not needed as you can only destroy 1 with it
   call DestroyEffect(bj_lastCreatedEffect) //so this might not be needed
   call CreateEffectLoc(p, "Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl", 2.00)//this might be another story dunno check the function
   call DestroyEffect(bj_lastCreatedEffect)


It's in EGUI

Meanwhile... unrelated.
 

PT.Dyland

New Member
Reaction score
0
oh my gosh, when I save my map using the code you give me the error still occurs.

Error: Line 17387: Not enough arguments given to function: GroupRemoveUnit
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top