AMAI Plugins/Job Creation
Warning this section is an advanced part of AMAI and you need to be fluent in jass
Since version 2.41 it is now possible to make your own code segmants for the ai to follow. This will control the ai in a certain way. Maybe you want to make a script that controls the how players use shops. You can either make your own or edit the already inbuilt ones included.
Jobs are basically the equivelent of triggers in warcraft 3 as they run independent of the warcaft script. (In actual fact it only appears to be running independent, of course they are not truly running independent. :D ). Due to the design of AMAI to simulate triggers, jobs CANNOT USE WAITS/SLEEP commands. Using them could completly destroy the job system.
These files are found in your job directory of the developer edition. Opening up these in notepad/wordpad shows the code and functions inside.
These jobs though are controlled from a jobs.txt file in your main directory. It is this file that lists all the different jobs and when they are required to run.
Job ID - Unique id of job that is supposed to be the same as the Job.eai file it will use
Frequency - Number of times job runs theoretically.
Function Call - The initial function to be called when job is run
Condition for initial start time - If there is a condition to when the job is allowed the start. If true then the job will start somewhere between the start times otherwise it requires to be called before starting.
minimum start time - The smallest amount of time that must pass before starting
Maximum start time - The largest amount of time that can pass before starting
Another way to start you script
If you do not set your job to start after a certain amount of time automatically you will have to make it start by placing a command somewhere else. There are many different versions of such and your best bet is to browse the current code yourselves. Below is an example
call TQAddJob(time, Job ID,parameter)
Time= is how many seconds till job does one run of the job
Job Id=the Id you gave job and is the same as the filename
paramenter=if you need to pass a certain parameter into your job or something
You have to decide where you want to put this command, most likely in another job. If you want to add it the the core AMAI code itself you can but requires care in where command is placed in the common.eai file.
This system potentially gives the AMAI engine limitless modability.
NOTE: For your job to continue running you must use the TQAddJob or equivelent at the end of your job code so that it repeats. Otherwise it will run your job script once only when it starts.