HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Artillery JASS Trigger

01-01-2007, 10:48 PM#1
illidan92
I've been turning a lot of my triggers into JASS so I can use local variables and delete a few globals and save map space and fix bugs with new actions available for the future. This one got a whole bunch of errors but I fixed all but 2, and I have no idea how to fix it. At the bottom of the 2 loops at "callforgroupbj" it says "invalid number of arguements" and I have no idea how to fix it. Heres the trigger:
Collapse JASS:
function Trig_Artillery_Fire_Mission_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A01N' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Artillery_Fire_Mission_Func001Func004Func011A takes nothing returns nothing
    if GetLocalPlayer() == GetOwningPlayer(GetEnumUnit()) then 
    call StartSound(gg_snd_ring4)
    endif
endfunction

function Trig_Artillery_Fire_Mission_Func001Func008Func011A takes nothing returns nothing
    if GetLocalPlayer() == GetOwningPlayer(GetEnumUnit()) then 
    call StartSound(gg_snd_ring4)
    endif
endfunction

function Trig_Artillery_Fire_Mission_Func001C takes nothing returns boolean
    if ( not ( GetOwningPlayer(GetSpellAbilityUnit()) == Player(5) ) ) then
        return false
    endif
    return true
endfunction

function Trig_Artillery_Fire_Mission_Actions takes nothing returns nothing
    local location l
    local integer i1
    local integer i2
    if ( Trig_Artillery_Fire_Mission_Func001C() ) then
        call DisplayTimedTextToForce( GetPlayersAll(), 10.00, "TRIGSTR_852" )
        set i1 = 1
        set i2 = 10
        loop
            exitwhen i1 > i2
            call PingMinimapLocForForceEx( GetPlayersAll(), GetRandomLocInRect(gg_rct_Fire_Mission_At_Axis), 3.00, bj_MINIMAPPINGSTYLE_ATTACK, 100, 0.00, 0.00 )
            set i1 = i1 + 1
        endloop
        call TriggerSleepAction( 10.00 )
        set i1 = 1
        set i2 = GetRandomInt(15, 25)
        loop
            exitwhen i1 > i2
            set l = GetRandomLocInRect(gg_rct_Fire_Mission_At_Axis)
            call PingMinimapLocForForceEx( GetPlayersAll(), l, 1, bj_MINIMAPPINGSTYLE_SIMPLE, 100, 100.00, 0.00 )
            call AddSpecialEffectLocBJ( l, "Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl" )
            call AddSpecialEffectLocBJ( l, "Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl" )
            call CreateNUnitsAtLoc( 1, 'o002', Player(PLAYER_NEUTRAL_PASSIVE), l, bj_UNIT_FACING )
            call SetUnitTimeScalePercent( GetLastCreatedUnit(), 50.00 )
            call UnitApplyTimedLifeBJ( 3.00, 'BTLF', GetLastCreatedUnit() )
            call UnitDamagePointLoc( GetLastCreatedUnit(), 0.20, 400.00, l, 150.00, ATTACK_TYPE_SIEGE, DAMAGE_TYPE_NORMAL )
            call UnitDamagePointLoc( GetLastCreatedUnit(), 0.20, 400.00, l, 30.00, ATTACK_TYPE_MELEE, DAMAGE_TYPE_NORMAL )
            call UnitDamagePointLoc( GetLastCreatedUnit(), 0.20, 800.00, l, 45.00, ATTACK_TYPE_SIEGE, DAMAGE_TYPE_NORMAL )
            call ForGroupBJ( GetUnitsInRangeOfLocAll(600.00, l, function Trig_Artillery_Fire_Mission_Func001Func008Func011A ))
            call RemoveLocation( l )
            call TriggerSleepAction( 0.15 )
            set i1 = i1 + 1
        endloop
    else
        call DisplayTimedTextToForce( GetPlayersAll(), 10.00, "TRIGSTR_851" )
        set i1 = 1
        set i2 = 10
        loop
            exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
            call PingMinimapLocForForceEx( GetPlayersAll(), GetRandomLocInRect(gg_rct_Fire_Mission_At_Allies), 3.00, bj_MINIMAPPINGSTYLE_ATTACK, 100, 0.00, 0.00 )
            set i1 = i1 + 1
        endloop
        call TriggerSleepAction( 10.00 )
        set i1 = 1
        set i2 = GetRandomInt(15, 25)
        loop
            exitwhen i1 > i2
            set l = GetRandomLocInRect(gg_rct_Fire_Mission_At_Allies)
            call PingMinimapLocForForceEx( GetPlayersAll(), l, 1, bj_MINIMAPPINGSTYLE_SIMPLE, 100, 100.00, 0.00 )
            call AddSpecialEffectLocBJ( l, "Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl" )
            call AddSpecialEffectLocBJ( l, "Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl" )
            call CreateNUnitsAtLoc( 1, 'o002', Player(PLAYER_NEUTRAL_PASSIVE), l, bj_UNIT_FACING )
            call SetUnitTimeScalePercent( GetLastCreatedUnit(), 50.00 )
            call UnitApplyTimedLifeBJ( 3.00, 'BTLF', GetLastCreatedUnit() )
            call UnitDamagePointLoc( GetLastCreatedUnit(), 0.20, 400.00, l, 150.00, ATTACK_TYPE_SIEGE, DAMAGE_TYPE_NORMAL )
            call UnitDamagePointLoc( GetLastCreatedUnit(), 0.20, 400.00, l, 30.00, ATTACK_TYPE_MELEE, DAMAGE_TYPE_NORMAL )
            call UnitDamagePointLoc( GetLastCreatedUnit(), 0.20, 800.00, l, 45.00, ATTACK_TYPE_SIEGE, DAMAGE_TYPE_NORMAL )
            call ForGroupBJ( GetUnitsInRangeOfLocAll(600.00, l, function Trig_Artillery_Fire_Mission_Func001Func004Func011A ))
            call RemoveLocation( l )
            call TriggerSleepAction( 0.15 )
            set i1 = i1 + 1
        endloop
    endif
endfunction

//===========================================================================
function InitTrig_Artillery_Fire_Mission takes nothing returns nothing
    set gg_trg_Artillery_Fire_Mission = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Artillery_Fire_Mission, EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddCondition( gg_trg_Artillery_Fire_Mission, Condition( function Trig_Artillery_Fire_Mission_Conditions ) )
    call TriggerAddAction( gg_trg_Artillery_Fire_Mission, function Trig_Artillery_Fire_Mission_Actions )
endfunction

01-01-2007, 10:56 PM#2
darkwulfv
Take my advice right now. Get JASScraft. Your trigger is loaded with BJ's and other problematic script... Plus, it could be heavily optimized. Get JASScraft, plug this into it, and check the problematic lines. It will show you each argument value it takes.
01-01-2007, 11:00 PM#3
illidan92
Quote:
Originally Posted by darkwulfv
Take my advice right now. Get JASScraft. Your trigger is loaded with BJ's and other problematic script... Plus, it could be heavily optimized. Get JASScraft, plug this into it, and check the problematic lines. It will show you each argument value it takes.
I do and I did it but I dunno wtf to do with it >.<. It comes up with a bunch of problems which I don't know what to do with. It says on the removelocation( l ) that I need a ')' but I dunno where to put it, etc. etc.. Sorry i'm so noob.

I think I know how to get rid of the BJ integers, local variables right?

My biggest problem is just that freakin' "Too many arguements passed to function". I am absolutely clueless as how to fix that.

Edit: Removed BJs.
01-01-2007, 11:14 PM#4
darkwulfv
Ok, to fix it. Go to the line you said was causing problems, double click it the function. it will bring up a little box that shows all the argument values. It takes a bit to learn, but once you do it'll be very helpful. Just do trial and error. And when it shows you the box with all the errors, do the first one each time, then re-syntax. Many times, one problem can cause many errors.

Whenever it says "line needs a ')', refer to the line above it. The line above needs another ')'.
If you want, I suppose i can fix this up for you.
01-01-2007, 11:17 PM#5
illidan92
Quote:
Originally Posted by darkwulfv
If you want, I suppose i can fix this up for you.
Knock yourself out :D.
01-01-2007, 11:23 PM#6
darkwulfv
You owe me for this... I'll have it up soon.

It ain't perfect, but the only errors are caused by the globals, which is normal.
Collapse JASS:
function Trig_Artillery_Fire_Mission_Conditions takes nothing returns boolean
    return ( GetSpellAbilityId() == 'A01N' )
endfunction

function Play_Sound2 takes nothing returns nothing
    if GetLocalPlayer() == GetOwningPlayer(GetEnumUnit()) then 
    call StartSound(gg_snd_ring4)
    endif
endfunction

function Play_Sound takes nothing returns nothing
    if GetLocalPlayer() == GetOwningPlayer(GetEnumUnit()) then 
    call StartSound(gg_snd_ring4)
    endif
endfunction

function Trig_Artillery_Fire_Mission_Actions takes nothing returns nothing
    local location l
    local integer i1 = 0
    local integer i2 = 0
    local group g = GetUnitsInRangeOfLocAll(600.00, l)
    local unit u
    if ( GetOwningPlayer(GetSpellAbilityUnit()) == Player(5)) then
        call DisplayTimedTextToForce( GetPlayersAll(), 10.00, "TRIGSTR_852" )
        set i1 = 1
        set i2 = 10
        loop
            exitwhen i1 > i2
            call PingMinimapLocForForceEx( GetPlayersAll(), GetRandomLocInRect(gg_rct_Fire_Mission_At_Axis), 3.00, bj_MINIMAPPINGSTYLE_ATTACK, 100, 0.00, 0.00 )
            set i1 = i1 + 1
        endloop
        call TriggerSleepAction( 10.00 )
        set i1 = 1
        set i2 = GetRandomInt(15, 25)
        loop
            exitwhen i1 > i2
        set l = GetRandomLocInRect(gg_rct_Fire_Mission_At_Axis)
            call PingMinimapLocForForceEx( GetPlayersAll(), l, 1, bj_MINIMAPPINGSTYLE_SIMPLE, 100, 100.00, 0.00 )
            call AddSpecialEffectLoc( "Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl", l)
            call AddSpecialEffectLoc( "Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl",l  )
        set u = CreateUnitAtLoc(Player(PLAYER_NEUTRAL_PASSIVE), 'o002', l, bj_UNIT_FACING )
            call SetUnitTimeScalePercent( u, 50.00 )
            call UnitApplyTimedLife( u, 'BTLF', 3.0 )
            call UnitDamagePointLoc( u, 0.20, 400.00, l, 150.00, ATTACK_TYPE_SIEGE, DAMAGE_TYPE_NORMAL )
            call UnitDamagePointLoc( u, 0.20, 400.00, l, 30.00, ATTACK_TYPE_MELEE, DAMAGE_TYPE_NORMAL )
            call UnitDamagePointLoc( u, 0.20, 800.00, l, 45.00, ATTACK_TYPE_SIEGE, DAMAGE_TYPE_NORMAL )
            call ForGroup( g, function Play_Sound )
            call RemoveLocation( l )
            call DestroyGroup(g)
            call TriggerSleepAction( 0.15 )
            set i1 = i1 + 1
        endloop
    else
        call DisplayTimedTextToForce( GetPlayersAll(), 10.00, "TRIGSTR_851" )
        set i1 = 1
        set i2 = 10
        loop
            exitwhen i1 > i2
            call PingMinimapLocForForceEx( GetPlayersAll(), GetRandomLocInRect(gg_rct_Fire_Mission_At_Allies), 3.00, bj_MINIMAPPINGSTYLE_ATTACK, 100, 0.00, 0.00 )
            set i1 = i1 + 1
        endloop
        call TriggerSleepAction( 10.00 )
        set i1 = 1
        set i2 = GetRandomInt(15, 25)
        loop
            exitwhen i1 > i2
        set l = GetRandomLocInRect(gg_rct_Fire_Mission_At_Allies)
        set g = GetUnitsInRangeOfLocAll(600.00, l)
            call PingMinimapLocForForceEx( GetPlayersAll(), l, 1, bj_MINIMAPPINGSTYLE_SIMPLE, 100, 100.00, 0.00 )
            call AddSpecialEffectLoc("Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl", l )
            call AddSpecialEffectLoc("Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl" , l )
        set u = CreateUnitAtLoc(Player(PLAYER_NEUTRAL_PASSIVE), 'o002', l, bj_UNIT_FACING )            
            call SetUnitTimeScalePercent(u, 50.00 )
            call UnitApplyTimedLife( u, 'BTLF', 3.0 )
            call UnitDamagePointLoc( u, 0.20, 400.00, l, 150.00, ATTACK_TYPE_SIEGE, DAMAGE_TYPE_NORMAL )
            call UnitDamagePointLoc( u, 0.20, 400.00, l, 30.00, ATTACK_TYPE_MELEE, DAMAGE_TYPE_NORMAL )
            call UnitDamagePointLoc( u, 0.20, 800.00, l, 45.00, ATTACK_TYPE_SIEGE, DAMAGE_TYPE_NORMAL )
            call ForGroup(g, function Play_Sound2 )
            call RemoveLocation( l )
            call DestroyGroup(g)
            call TriggerSleepAction( 0.15 )
            set i1 = i1 + 1
        endloop
    endif
set l = null
set g = null
set u = null
endfunction

//===========================================================================
function InitTrig_Artillery_Fire_Mission takes nothing returns nothing
  local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddCondition(t, Condition( function Trig_Artillery_Fire_Mission_Conditions ) )
    call TriggerAddAction( t, function Trig_Artillery_Fire_Mission_Actions )
set t = null
endfunction
01-01-2007, 11:25 PM#7
illidan92
Quote:
Originally Posted by darkwulfv
You owe me for this... I'll have it up soon.
Lol i'll make a shitty skin for you .
While you're at it why not fix up all my Shass! (new word for illidan's jass, means shitty JASS loaded with bj lagconstants.)
01-01-2007, 11:26 PM#8
oNdizZ
call ForGroupBJ( GetUnitsInRangeOfLocAll(600.00, l, function Trig_Artillery_Fire_Mission_Func001Func004Func011A )
should be:
call ForGroupBJ( GetUnitsInRangeOfLocAll(600.00, l), function Trig_Artillery_Fire_Mission_Func001Func004Func011A )
edit: sorry for stealing your answer darkwulfv, guess the hyrule hero inside me couldn't resist.
01-01-2007, 11:28 PM#9
illidan92
Quote:
Originally Posted by oNdizZ
call ForGroupBJ( GetUnitsInRangeOfLocAll(600.00, l, function Trig_Artillery_Fire_Mission_Func001Func004Func011A ) should be:
call ForGroupBJ( GetUnitsInRangeOfLocAll(600.00, l), function Trig_Artillery_Fire_Mission_Func001Func004Func011A )
O rly!? It's working now weeee! Thankz!

I had converted this one to JASS so thats why some functions got me a little confused O_O.
01-01-2007, 11:47 PM#10
darkwulfv
There you go, I updated my post with the new code, optimized as well as i could decipher.
Go ahead, show me your SHASS.

Collapse JASS:
function Trig_Artillery_Fire_Mission_Conditions takes nothing returns boolean
    return ( GetSpellAbilityId() == 'A01N' )
endfunction

function Play_Sound2 takes nothing returns nothing
    if GetLocalPlayer() == GetOwningPlayer(GetEnumUnit()) then 
    call StartSound(gg_snd_ring4)
    endif
endfunction

function Play_Sound takes nothing returns nothing
    if GetLocalPlayer() == GetOwningPlayer(GetEnumUnit()) then 
    call StartSound(gg_snd_ring4)
    endif
endfunction

function Trig_Artillery_Fire_Mission_Actions takes nothing returns nothing
    local location l
    local integer i1 = 0
    local integer i2 = 0
    local group g = GetUnitsInRangeOfLocAll(600.00, l)
    local unit u
    if ( GetOwningPlayer(GetSpellAbilityUnit()) == Player(5)) then
        call DisplayTimedTextToForce( GetPlayersAll(), 10.00, "TRIGSTR_852" )
        set i1 = 1
        set i2 = 10
        loop
            exitwhen i1 > i2
            call PingMinimapLocForForceEx( GetPlayersAll(), GetRandomLocInRect(gg_rct_Fire_Mission_At_Axis), 3.00, bj_MINIMAPPINGSTYLE_ATTACK, 100, 0.00, 0.00 )
            set i1 = i1 + 1
        endloop
        call TriggerSleepAction( 10.00 )
        set i1 = 1
        set i2 = GetRandomInt(15, 25)
        loop
            exitwhen i1 > i2
        set l = GetRandomLocInRect(gg_rct_Fire_Mission_At_Axis)
            call PingMinimapLocForForceEx( GetPlayersAll(), l, 1, bj_MINIMAPPINGSTYLE_SIMPLE, 100, 100.00, 0.00 )
            call AddSpecialEffectLoc( "Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl", l)
            call AddSpecialEffectLoc( "Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl",l  )
        set u = CreateUnitAtLoc(Player(PLAYER_NEUTRAL_PASSIVE), 'o002', l, bj_UNIT_FACING )
            call SetUnitTimeScalePercent( u, 50.00 )
            call UnitApplyTimedLife( u, 'BTLF', 3.0 )
            call UnitDamagePointLoc( u, 0.20, 400.00, l, 150.00, ATTACK_TYPE_SIEGE, DAMAGE_TYPE_NORMAL )
            call UnitDamagePointLoc( u, 0.20, 400.00, l, 30.00, ATTACK_TYPE_MELEE, DAMAGE_TYPE_NORMAL )
            call UnitDamagePointLoc( u, 0.20, 800.00, l, 45.00, ATTACK_TYPE_SIEGE, DAMAGE_TYPE_NORMAL )
            call ForGroup( g, function Play_Sound )
            call RemoveLocation( l )
            call DestroyGroup(g)
            call TriggerSleepAction( 0.15 )
            set i1 = i1 + 1
        endloop
    else
        call DisplayTimedTextToForce( GetPlayersAll(), 10.00, "TRIGSTR_851" )
        set i1 = 1
        set i2 = 10
        loop
            exitwhen i1 > i2
            call PingMinimapLocForForceEx( GetPlayersAll(), GetRandomLocInRect(gg_rct_Fire_Mission_At_Allies), 3.00, bj_MINIMAPPINGSTYLE_ATTACK, 100, 0.00, 0.00 )
            set i1 = i1 + 1
        endloop
        call TriggerSleepAction( 10.00 )
        set i1 = 1
        set i2 = GetRandomInt(15, 25)
        loop
            exitwhen i1 > i2
        set l = GetRandomLocInRect(gg_rct_Fire_Mission_At_Allies)
        set g = GetUnitsInRangeOfLocAll(600.00, l)
            call PingMinimapLocForForceEx( GetPlayersAll(), l, 1, bj_MINIMAPPINGSTYLE_SIMPLE, 100, 100.00, 0.00 )
            call AddSpecialEffectLoc("Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl", l )
            call AddSpecialEffectLoc("Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl" , l )
        set u = CreateUnitAtLoc(Player(PLAYER_NEUTRAL_PASSIVE), 'o002', l, bj_UNIT_FACING )            
            call SetUnitTimeScalePercent(u, 50.00 )
            call UnitApplyTimedLife( u, 'BTLF', 3.0 )
            call UnitDamagePointLoc( u, 0.20, 400.00, l, 150.00, ATTACK_TYPE_SIEGE, DAMAGE_TYPE_NORMAL )
            call UnitDamagePointLoc( u, 0.20, 400.00, l, 30.00, ATTACK_TYPE_MELEE, DAMAGE_TYPE_NORMAL )
            call UnitDamagePointLoc( u, 0.20, 800.00, l, 45.00, ATTACK_TYPE_SIEGE, DAMAGE_TYPE_NORMAL )
            call ForGroup(g, function Play_Sound2 )
            call RemoveLocation( l )
            call DestroyGroup(g)
            call TriggerSleepAction( 0.15 )
            set i1 = i1 + 1
        endloop
    endif
set l = null
set g = null
set u = null
endfunction

//===========================================================================
function InitTrig_Artillery_Fire_Mission takes nothing returns nothing
  local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddCondition(t, Condition( function Trig_Artillery_Fire_Mission_Conditions ) )
    call TriggerAddAction( t, function Trig_Artillery_Fire_Mission_Actions )
set t = null
endfunction
enjoy.
01-02-2007, 12:03 AM#11
illidan92
Weeeee thanks!

Now...hehe...I will be all set if you just update this one so it doesn't crash the game :D.

Collapse JASS:
function Trig_Scope_Fade_Filter_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A01O' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Scope_Fade_Filter_Actions takes nothing returns nothing
if GetLocalPlayer() == GetOwningPlayer(GetTriggerUnit()) then
    call CinematicFilterGenericBJ( 0.20, BLEND_MODE_BLEND, "ReplaceableTextures\\CameraMasks\\Scope_Mask.blp", 0.00, 0.00, 0.00, 100.00, 0, 0, 0, 0.00 )
    call TriggerSleepAction( 5.00 )
    call CinematicFilterGenericBJ( 0.20, BLEND_MODE_BLEND, "ReplaceableTextures\\CameraMasks\\Scope_Mask.blp", 0.00, 0.00, 0.00, 0.00, 0, 0, 0, 100.00 )
    endif
endfunction

//===========================================================================
function InitTrig_Scope_Fade_Filter takes nothing returns nothing
  local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( t, Condition( function Trig_Scope_Fade_Filter_Conditions ) )
    call TriggerAddAction( t, function Trig_Scope_Fade_Filter_Actions )
set t = null
endfunction


01-02-2007, 12:20 AM#12
darkwulfv
aint gonna happen, I have no clue what's wrong there, I never use GetLocalPlayer().
But this:
Collapse JASS:
    if ( not ( GetSpellAbilityId() == 'A01O' ) ) then
        return false
    endif
    return true

can be:
Collapse JASS:
   return ( GetSpellAbilityId() == 'A01O' ) 
do this to all conditions, just put return (whatever). If there more than one condition call, use and/or.