Spell Help Needed =) (help for +rep)

Tinki3

Special Member
Reaction score
418
Everything is fine about this trigger, except when I try to enable it, it comes up with the error ( I have made that line red):
Line 112: Invalid number of arguments

Code:
function WS_Ability_ID takes nothing returns boolean
   return GetSpellAbilityId() == 'A004'     
endfunction

function WS_Filter_unit takes nothing returns boolean
    return (IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) == true)
endfunction

function Move_Caster takes nothing returns nothing      
    local unit WS_Picked_unit = GetEnumUnit()
    local location WS_Picked_unit_loc = GetUnitLoc(WS_Picked_unit)
    local integer gh = GetUnitAbilityLevelSwapped('A004',GetTriggerUnit())
    local real kj = GetRandomReal(50.00,(I2R(GetUnitAbilityLevelSwapped('A004',GetTriggerUnit()))*75.00))
    call SetUnitPositionLoc(GetTriggerUnit(),WS_Picked_unit_loc)
    call AddSpecialEffectTargetUnitBJ("chest",WS_Picked_unit, "Objects\\Spawnmodels\\Naga\\NagaDeath\\NagaDeath.mdl" )
    call DestroyEffectBJ(GetLastCreatedEffectBJ())
    call UnitDamageTargetBJ(GetTriggerUnit(),WS_Picked_unit, kj,ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL)
    call CreateNUnitsAtLoc(1,'h003',GetOwningPlayer(GetTriggerUnit()),WS_Picked_unit_loc, 0.00)
    call SetUnitAbilityLevelSwapped('A005', GetLastCreatedUnit(), gh)
    call IssueTargetOrderBJ(GetLastCreatedUnit(),"thunderbolt",WS_Picked_unit)
    call UnitApplyTimedLifeBJ(1.50,'BTLF',GetLastCreatedUnit())
    call RemoveLocation(WS_Picked_unit_loc)
    set WS_Picked_unit_loc = null
    set WS_Picked_unit = null
endfunction

function Trig_Water_Strike_Actions takes nothing returns nothing
    local unit WS_Caster = GetTriggerUnit()  
    local location WS_Caster_loc = GetUnitLoc(WS_Caster)  
    local integer mb = (R2I(GetUnitAbilityLevelSwapped('A004',WS_Caster)))
    local group WS_Group
    call ShowUnit(WS_Caster, false)
    call PolledWait(5, - mb)
    call [COLOR="Red"]ForGroupBJ(GetUnitsInRangeOfLocMatching(600.00,WS_Caster_loc),Condition(function WS_Filter_unit)), function Move_Caster)[/COLOR]
    call ShowUnit(WS_Caster, true)
    call RemoveLocation(WS_Caster_loc)
    call DestroyGroup(WS_Group)
    set WS_Group = null
    set WS_Caster = null
    set WS_Caster_loc = null
endfunction

//===========================================================================
function InitTrig_Water_Strike takes nothing returns nothing
    set gg_trg_Water_Strike = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(gg_trg_Water_Strike,EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(gg_trg_Water_Strike,Condition(function WS_Ability_ID))
    call TriggerAddAction(gg_trg_Water_Strike,function Trig_Water_Strike_Actions)
endfunction
I also have another Q:

How multi instanceable is this trigger?

Anyone who helps alot will get +rep :)

Thx in advance.
 
C

Capt Griffen

Guest
Code:
    call PolledWait(5, - mb)

That's the problem. Use '.' not ','. English notation for decimal.
 

Chocobo

White-Flower
Reaction score
409
Ok, I'll try that, thanks :D

EDIT: It did nothing :(\

EDIT 2: Got it working. Moved 1 bracket =D But, can some1 still answer this Q:

How you did it?

Code:
    call ForGroupBJ(GetUnitsInRangeOfLocMatching(600.00,WS_Caster_loc),Condition(function WS_Filter_unit)), function Move_Caster)

You are using differant types with ForGroupBJ (using "unknown types" for WE). 3 paramaters for only 2, how you will do?

Code:
    call ForGroupBJ(GetUnitsInRangeOfLocMatching(600.00,WS_Caster_loc,Condition(function WS_Filter_unit)), function Move_Caster)
    call ShowUnit(WS_Caster, true)

This should work.

It is a GUI to JASS Conversion, isn't it?

Code:
function WS_Ability_ID takes nothing returns boolean
   return GetSpellAbilityId() == 'A004'     
endfunction

function WS_Filter_unit takes nothing returns boolean
    return (IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) == true)
endfunction

function Move_Caster takes nothing returns nothing      
    local unit WS_Picked_unit = GetEnumUnit()
    local location WS_Picked_unit_loc = GetUnitLoc(WS_Picked_unit)
    local integer gh = GetUnitAbilityLevelSwapped('A004',GetTriggerUnit())
    local real kj = GetRandomReal(50.00,(I2R(GetUnitAbilityLevelSwapped('A004',GetTriggerUnit()))*75.00))
    call SetUnitPositionLoc(GetTriggerUnit(),WS_Picked_unit_loc)
    call AddSpecialEffectTarget("chest",WS_Picked_unit, "Objects\\Spawnmodels\\Naga\\NagaDeath\\NagaDeath.mdl" )
    call DestroyEffect(GetLastCreatedEffectBJ())
    call UnitDamageTarget(GetTriggerUnit(),WS_Picked_unit, kj,true,false,ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
    call CreateNUnitsAtLoc(1,'h003',GetOwningPlayer(GetTriggerUnit()),WS_Picked_unit_loc, 0.00)
    call SetUnitAbilityLevelSwapped('A005', GetLastCreatedUnit(), gh)
    call IssueTargetOrder(GetLastCreatedUnit(),"thunderbolt",WS_Picked_unit)
    call UnitApplyTimedLife(GetLastCreatedUnit(),'BTLF',1.50)
    call RemoveLocation(WS_Picked_unit_loc)
    set WS_Picked_unit_loc = null
    set WS_Picked_unit = null
endfunction

function Trig_Water_Strike_Actions takes nothing returns nothing
    local unit WS_Caster = GetTriggerUnit()  
    local location WS_Caster_loc = GetUnitLoc(WS_Caster)  
    local integer mb = (R2I(GetUnitAbilityLevelSwapped('A004',WS_Caster)))
    local group WS_Group
    call ShowUnit(WS_Caster, false)
    call PolledWait(5 - mb)
    call ForGroup(GetUnitsInRangeOfLocMatching(600.00,WS_Caster_loc,Condition(function WS_Filter_unit)), function Move_Caster)
    call ShowUnit(WS_Caster, true)
    call RemoveLocation(WS_Caster_loc)
    call DestroyGroup(WS_Group)
    set WS_Group = null
    set WS_Caster = null
    set WS_Caster_loc = null
endfunction

//===========================================================================
function InitTrig_Water_Strike takes nothing returns nothing
    local trigger gg_trg_Water_Strike = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(gg_trg_Water_Strike,EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(gg_trg_Water_Strike,Condition(function WS_Ability_ID))
    call TriggerAddAction(gg_trg_Water_Strike,function Trig_Water_Strike_Actions)
endfunction

Here's a better code I did on 10 min. You should move the conditions. :p
 

Arkan

Nobody rides for free
Reaction score
92
Code:
local integer mb = ([COLOR="Red"]R2I[/COLOR](GetUnitAbilityLevelSwapped('A004',WS_Caster)))
I believe this conversion is unecessary.
GetUnitAbilityLevel works aswell but you would have to switch the arguments.
 

emjlr3

Change can be a good thing
Reaction score
395
well considering getunitabilitylevel returns an integer

converting it from a real to an integer is just stupid
 
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