Warcraft III resources & community, 2003–2006 · archived

I need help with this script!

7 posts
#1

I need help with this script!

I need help with this script it the dummy doesnt learn the ability and doesnt cast it X<

function Trig_Spalter_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A001' ) ) then
return false
endif
return true
endfunction

function Trig_Spalter_Actions takes nothing returns nothing
local unit casterOfSR = GetSpellAbilityUnit()
local unit dummy
local integer CastMulti
set CastMulti = GetRandomInt(1, 4)
loop
exitwhen CastMulti == 0
call CreateUnit(GetOwningPlayer(casterOfSR), 'n000', GetUnitX(casterOfSR), GetUnitY(casterOfSR), 0.00 )
set dummy = GetLastCreatedUnit()
call UnitAddAbilityBJ( udg_SpalterArray[GetUnitAbilityLevelSwapped('A001', casterOfSR)], dummy )
call IssueImmediateOrderBJ( dummy, "thunderclap" )
set CastMulti = CastMulti - 1
call TriggerSleepAction(1.00)
endloop
set casterOfSR = null
set dummy = null
endfunction

//===========================================================================
function InitTrig_Spalter takes nothing returns nothing
set gg_trg_Spalter = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Spalter, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Spalter, Condition( function Trig_Spalter_Conditions ) )
call TriggerAddAction( gg_trg_Spalter, function Trig_Spalter_Actions )
endfunction
#2
here

function Trig_Spalter_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A001'
endfunction

function Trig_Spalter_Actions takes nothing returns nothing
    local unit cast = GetTriggerUnit()
    local unit dummy
    local integer CastMulti = GetRandomInt(1, 4)
    loop
        exitwhen CastMulti == 0
        set dummy = CreateUnit(GetOwningPlayer(cast), 'n000', GetUnitX(cast), GetUnitY(cast), 0.00 )
        call UnitAddAbility( dummy, udg_SpalterArray[GetUnitAbilityLevel(cast, 'A001')] )
        call IssueImmediateOrder( dummy, "thunderclap" )
        set CastMulti = CastMulti - 1
        call TriggerSleepAction(1.00)
    endloop
    set cast = null
    set dummy = null
endfunction

//===========================================================================
function InitTrig_Spalter takes nothing returns nothing
set gg_trg_Spalter = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Spalter, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Spalter, Condition( function Trig_Spalter_Conditions ) )
call TriggerAddAction( gg_trg_Spalter, function Trig_Spalter_Actions )
endfunction


the problem was that you were saying

CreateUnit

and then

Get Last Created Unit.

Get Last Created Unit ( bj_lastCreatedUnit ) has to be defined, so it is defined by CreateNUnitsAtLoc. Since you were trying to access the dummy thru Last Created Unit which was undefined, this didnt work.

I fixed up some BJ's and stuff as well.
#3

Thx

Thx alot :) i`ll test it :D
#4
no prob, i c you're new to JASS.
#5

No

No, i`m longer here than u :wink: look under my name the spells and btw test my new arcane assassin :)
#6
but however, how long have you been doing JASS?

LOL, looking at your spells, i just realized i learned alot from your 'Mass Spells' and 'Assasin' spellpacks back when i was a newbie ^.^
#7

Thx

Thx ;-) i hope u like my work :D