HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

What is wrong with this script

07-28-2004, 05:43 PM#1
Rafael Br
Hello, I am writhing my first AI script, but it does not seen to work, It is supposed to ba a campaign AI, the units Id code is right, I use AI-start campaign AI trigger to start it, but the workers only harvest gold, they start with a hero, 6 workers and a hall.
EDIT: Finnaly it is working 100%
07-29-2004, 12:02 PM#2
AIAndy
If you have any syntax error in the script it will be ignored and the workers only harvest gold. So make sure to check it with PJass.
07-30-2004, 04:57 PM#3
Rafael Br
My old script was a tottaly mess up, so, I have made this new one, it looks almost like one of Blizzard, but it uses a custom race.Still not working.The wait for signal is used because I want they to start an attack only when I get into a certain point, then I use the send ai command action.
Edit: I heard that you have to declare the units rawcode as a constant, if this is what is wrong, how can I declare a constant?
Code:
globals
    player target = PlayerEx(1)
endglobals

//============================================================================
//                                Main Function
//============================================================================
function main takes nothing returns nothing 
    
    call CampaignAI('o603',null)
    call DoCampaignFarms(false) 
    call SetWoodPeons(3)
//Build defense

    call SetBuildUnitEx( 3, 3, 3, 'n602' )
    call CampaignDefenderEx( 4,5,5, 'n603' )
    call CampaignDefender( 2,3,4, 'n605' )
       
//Upgrades

    
    call SetBuildUpgrEx( 1,1,1, 'R60H' )
    call SetBuildUpgrEx( 1,1,2, 'R60A' )
    call SetBuildUpgrEx( 1,1,2, 'R60B' )
    call SetBuildUpgrEx( 0,1,1, 'R60D' )
 
     
//Attack waves
     
    call WaitForSignal()
     
    //Initial Wave
    call InitAssaultGroup()
    call CampaignAttackerEx( 4,5,6, 'n603' )
    call SuicideOnPlayer(M2,M1,M1,target)
     
    loop
    // Wave 1
        call InitAssaultGroup()
        call CampaignAttackerEx( 3,4,5, 'n603' )
        call CampaignAttackerEx( 1,1,1, 'H60K' )
        call SuicideOnPlayer(M2,M2,M2,target)
    // Wave 2
        call InitAssaultGroup()
        call CampaignAttackerEx( 3,3,4, 'n603' )
        call CampaignAttackerEx( 1,2,3, 'n605' )
        call CampaignAttackerEx( 1,2,2, 'h60G' )
        call SuicideOnPlayer(M3,M3,M3,target) 
    // Wave 3
        call InitAssaultGroup()
        call CampaignAttackerEx( 2,3,3, 'n608' )
        call CampaignAttackerEx( 1,1,1, 'H60K' )
        call CampaignAttackerEx( 2,2,3, 'h60G' )
        call SuicideOnPlayer(M4,M3,M2,target)    
    // Wave 4
        call InitAssaultGroup()
        call CampaignAttackerEx( 2,3,3, 'n608' )
        call CampaignAttackerEx( 2,3,3, 'n603' )
        call CampaignAttackerEx( 2,2,3, 'n605' )
        call SuicideOnPlayerEx(M3,M3,M2,target)
    endloop
endfunction
07-31-2004, 12:51 AM#4
AIAndy
You mixed up a lot of the functions with Ex postfix and those without.
AI scripting is a pain without a JASS syntax checker. Get one (PJass or a different one) or you will have difficulties making AI scripts working.