• 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.

Ai overrides my triggers?

Status
Not open for further replies.
Level 7
Joined
Nov 18, 2012
Messages
272
I have a problem with the Ai.

I assigned him some units so that he micros them, but instead it just orders them to move at the start location instead.

I tried triggering them but he just won't move them. Is there a way to activate an Ai without it moving to it's start location?
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
Could you show us the triggers you've used including the melee initialization trigger for setting up the AI?
Or did you use the AI editor?
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
I use the Melee Ai. No custom Ai. It just sends them to its start location. Do I need custom Ai?

The standard? I'll take a look at which one will order the AI to move it's units towards starting location.
(This may take a while).

EDIT: take a look at this in the meanwhile: Melee AI Importing

EDIT 2: unfortunately what you want to alter is inside the human.ai, orc.ai, undead.ai and elf.ai files.
These scripts are run for each AI player inside:
  • Melee Game - Run melee AI scripts (for computer players)
A solution could be: triggering the AI for the players yourself, importing a custom made AI script made by someone else, or importing your own AI script.
 
Last edited:
Level 14
Joined
Apr 20, 2009
Messages
1,543
My second edit shows you that the player moving its units towards the starting location is inside the standard AI script made by blizzard. You can only change it by using a custom AI script or by triggering the entire AI yourself. If you look around the internet you might find a custom AI script made by someone that does it's job better then blizzards AI script.

But if you want something specific for your game only, you might want to go with triggering it yourself.

Another solution could be: extracting the blizzard AI scripts from the MPQ, altering them and then recreating the MeleeStartingAI function to take your custom scripts instead.

JASS:
function MeleeStartingAI takes nothing returns nothing
    local integer index
    local player  indexPlayer
    local race    indexRace

    set index = 0
    loop
        set indexPlayer = Player(index)
        if (GetPlayerSlotState(indexPlayer) == PLAYER_SLOT_STATE_PLAYING) then
            set indexRace = GetPlayerRace(indexPlayer)
            if (GetPlayerController(indexPlayer) == MAP_CONTROL_COMPUTER) then
                // Run a race-specific melee AI script.
                if (indexRace == RACE_HUMAN) then
                    call PickMeleeAI(indexPlayer, "human.ai", null, null)
                elseif (indexRace == RACE_ORC) then
                    call PickMeleeAI(indexPlayer, "orc.ai", null, null)
                elseif (indexRace == RACE_UNDEAD) then
                    call PickMeleeAI(indexPlayer, "undead.ai", null, null)
                    call RecycleGuardPosition(bj_ghoul[index])
                elseif (indexRace == RACE_NIGHTELF) then
                    call PickMeleeAI(indexPlayer, "elf.ai", null, null)
                else
                    // Unrecognized race.
                endif
                call ShareEverythingWithTeamAI(indexPlayer)
            endif
        endif

        set index = index + 1
        exitwhen index == bj_MAX_PLAYERS
    endloop
endfunction

Sorry to dissapoint you :(
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
To alter the ai scripts you have to go into war3.mpq and war3x.mpq in your warcraft 3 installation folder.
To do this you'll need a MPQ editor like this one: MPQ editor

Once you open up the MPQ's you should be abled to extract the .ai files.
Those ai files can be opened with text editors and they will contain Jass code.

common.ai is an ai file that contains all the common functions that are used within the human.ai, orc.ai, undead.ai and elf.ai files.

You would need to have some Jass experience in order to change them.
You can import them when you are done changing them like explained in this thread I've linked before:
Melee AI Importing

You could always ask someone with more Jass experience than you to change what you want for you.
If I weren't working at my job right now I'd do it for you.
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
Well I did manage to make them move by setting them to neutral side.

It's probably because the AI scripts are not loaded for the neutral player you've set it to. This is because:
JASS:
constant integer   bj_MAX_PLAYERS                   =  12
0 counts for player 1 in Jass so this:
JASS:
exitwhen index == bj_MAX_PLAYERS
goes from player 1 to 12. This way the AI scripts are only loaded for computer players that are player 1-12 and not neutral hostile, neutral passive or items (yes items is a player slot that can be used in Jass) Player(14). There is even a Player(15) but let's not drift away from this subject.

Is there a way to make the Ai level abilities of custom heroes?

Well you could integrate custom heroes into the AI but it'll take some work to script it.
It will probably be easier for you to trigger the AI instead of re-scripting blizzards standard AI.

(In this case don't load the AI script and order the players to do stuff through triggers.
You can check the slot state of the player to check if it's a computer.)
 
Status
Not open for further replies.
Top