HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

JASS AI Script - Changing Target Player

10-10-2010, 02:51 PM#1
Everstill-Ghost
Hello Everyone :)

I'm making a campaign (6 maps already) that what you make change the next map in some sort, i.e. If you don't destroy a faction base, they you apear in the next map; if you allies dies in one map, in the next they base will be destroyed too, etc...

I'm recreating the AI Editor's made AI to JASS ones.

THE PROBLEM: I can't make a simple thing, ordering a AI attack like player Red and after some event in the map, they change the target to player Blue using a trigger (Send AI Command)

How I do that??

Collapse JASS:
globals
    player Player_1 = Player( 0 )
endglobals

function ConfigureAI takes nothing returns nothing
    call SetSlowChopping( true )
    call SetPeonsRepair( true )
endfunction

function main takes nothing returns nothing
    call CampaignAI( 'npgf', null )
    call ConfigureAI( )
    set do_campaign_farms = false
    // **********************************
    // *      Building Strategy         *
    // **********************************
    call SetReplacements( 3, 3, 3 )
    call SetBuildUnit( 6, 'ohun' )
    call CampaignDefenderEx( 2, 2, 2, 'ohun' )
    //**********************************
    //*    End Building Strategy       *
    //**********************************
    
    //**********************************
    //*       Attack Strategy          *
    //**********************************
//*** WAVE 1 ***
    call InitAssaultGroup()
    call CampaignAttackerEx( 3, 3, 3, 'ohun' )  
    call SuicideOnPlayerEx( 30, 30, 30, Player_1 )
//*** WAVE 2 ***
    call InitAssaultGroup()
    call CampaignAttackerEx( 4, 4, 4, 'ohun' )  
    call SuicideOnPlayerEx( 70, 70, 70, Player_1 )
//*** WAVE 3 ***
    call InitAssaultGroup()
    call CampaignAttackerEx( 5, 5, 5, 'ohun' )  
    call SuicideOnPlayerEx( 70, 70, 70, Player_1 )
//*** WAVE 4 ***
    call InitAssaultGroup()
    call CampaignAttackerEx( 2, 2, 2, 'ohun' )  
    call SuicideOnPlayerEx( 70, 70, 70, Player_1 )
loop 
    //*** LAST WAVE ***
    call InitAssaultGroup()
    call CampaignAttackerEx( 6, 6, 6, 'ohun' )  
    call SuicideOnPlayerEx( 70, 70, 70, Player_1 )  
  
    call InitAssaultGroup()
    call CampaignAttackerEx( 3, 3, 3, 'ohun' )  
    call SuicideOnPlayerEx( 70, 70, 70, Player_1 )
endloop 
    //**********************************
    //*   Attack Strategy never ends   *
    //**********************************
endfunction
10-10-2010, 03:25 PM#2
DioD
you must add wait command loop with sleep time, this loop will check for commands every iteration and execute them.

this done in many camp maps, you dont need to check every map, just check scripts directory inside war3x.mpq, all AI stored here.
10-11-2010, 01:56 AM#3
Everstill-Ghost
Yes, I checked the AI Scripts, but no one "directly" change the target player, all attack the user player from start to end.

Can you make a example to me?? I'll be very happy =D
10-11-2010, 11:09 AM#4
DioD
read carefully my post, one more (ten) time(s).

ps. post code you "checked"