• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Solved] Looking for JASS AI Mentor.

Level 19
Joined
Aug 1, 2022
Messages
213
Hello Im looking for a Mentor that would help coding a JASS AI with a Suicide Charge but is smart. Becuase Im struggling with my AI being stupid and not target the proper enemy. Pllus their path finding is wierd.
 
Level 30
Joined
Aug 29, 2012
Messages
1,383
You need to define your target in the globals at the beginning of your script

JASS:
globals
    player MyTarget = Player(0)
endglobals

Keeping in mind that the number is offset compared to player numbers in the editor, so 0 is player 1 (red), 1 is blue, etc, 2 teal, etc. If you input a player number that doesn't correspond to players in your map, they will attack an enemy at random.

And then you ask to attack after X time

JASS:
call InitAssaultGroup()
call CampaignAttackerEx( 2,2,2, FOOTMAN)
call CampaignAttackerEx( 1,1,1, RIFLEMAN)
call SuicideOnPlayer(M2,MyTarget)

For pathing, you can add this call under your main function to make them change paths a bit but there's only so much they can do

JASS:
call SetRandomPaths(true)
 
Level 19
Joined
Aug 1, 2022
Messages
213
Here is my code I based it on the Legends of Arkain series by the way. Did I made this right?

JASS:
globals
integer user = 6
endglobals

//=====================================
// main
//=====================================
function main takes nothing returns nothing
call CampaignAI(HOUSE,null)

call PrepFullSuicide()
loop
//Units
call SuicideUnitB('hfoo',user) // Footman
call SuicideUnitB('hkni',user) // Calvary
call SuicideUnitB('e000',user) // Arbalist
call SuicideUnitB('hmpr',user) // Battle Priest
call SuicideUnitB('hsor',user) // Bishop
call SuicideUnitB('h007',user) // Honor Guard
call SuicideUnitB('h001',user) // Perdonian Knight
call SuicideUnitB('h005',user) // Perdonian Knight

//Heroes
call SuicideUnitB('H000',user)
call SuicideUnitB('H004',user)

endloop
endfunction


Keeping in mind that the number is offset compared to player numbers in the editor, so 0 is player 1 (red), 1 is blue, etc, 2 teal, etc. And then you ask to attack after X time
Ah so you mean to tell me that all this time Player 1 started with 0? Instead of the proper ways of counting?

So the code Ive sent in this case "Integer User = 6" is technically targeting player 5 yes?
 

Shar Dundred

Hosted Project: LoA
Level 76
Joined
May 6, 2009
Messages
6,090
Without having looked at your script:
Instead of just copying others' AI, you should go here and learn how to code it properly:

Otherwise you will kerp running into these situations.
 
Top