| 12-13-2002, 03:26 PM | #1 |
Guest | to create/implement an AI script that uses a limited build order? That is, bare basics - such as just footmen for human. I've been debating about either creating the AI script or simply making triggers that emulate the creation of units, etc. I wonder which would be more difficult.. hrm. |
| 12-13-2002, 03:42 PM | #2 |
Building stuff is quite easy in the AI. Do you want to make a melee or a campaign AI script ? |
| 12-13-2002, 05:22 PM | #3 |
Guest | What's the difference? I'm assuming campaign. |
| 12-13-2002, 05:39 PM | #4 |
Guest | Ok, here is what I wanted - I want to simply have the AI build up to 2 barracks and then build footmen as much as possible. Then have it launch attacks when it has 10. How would I create an inner ai in my map? - Josh |
| 12-13-2002, 08:21 PM | #5 |
Guest | Well, a very simple method to do it would be like this: Code:
call SetBuildUnit(2, BARRACKS)
call SetBuildUnit(10, FOOTMAN)
loop
call CampaignAttackerEx(10,10,10,FOOTMAN)
call SuicideOnPlayer(M3,user)
endloopOf course you'd have to define the constant for 'user' but that should work. The first two lines make sure the AI keeps 10 footmen and 2 barracks built, and the second two send the 10 footmen after the player after 3 minutes. You'd have to modify the code just a little if you want them to attack the second they have 10, but that should work. EDIT: If you know absolutely nothing about AI, then you might want to check out my common.ai reference to get a feel for what some of the functions do. It's posted in this forum, but it's an old post, so you might have to adjust your forum settings to display posts older than 30 days. Also take a look at common.ai from the war3.mpq to get a better idea of how things work. |
| 12-13-2002, 08:33 PM | #6 |
The difference between melee and campaign AIs is not much. Mostly their purpose is different. While campaign AIs are made for a specific map and provided with resources, the melee AIs are made map independent and should play like a human. What you can do does not differ AFAIK. I'd do your AI like that: Start it like the other campaign AIs (e.g. use a Blizzard campaign AI as the base) Then do: call SetBuildUnit(2, BARRACKS) call SetBuildUnit(50, FOOTMAN) loop loop exitwhen GetUnitCountDone(FOOTMAN) >= 10 call Sleep(3) endloop // put the code here to let it attack endloop Add the code to let it attack the right target at the marked place. Then it should build 2 Barracks and then Footmen and whenever it has at least 10 it will attack. EDIT: I was too slow with writing. |
| 12-13-2002, 09:37 PM | #7 |
Guest | heheh, well at least we had similar thoughts.. :) |
| 12-16-2002, 04:07 PM | #8 |
Guest | -------------------------------------------------------------------------------- call SetBuildUnit(2, BARRACKS) call SetBuildUnit(10, FOOTMAN) loop call CampaignAttackerEx(10,10,10,FOOTMAN) call SuicideOnPlayer(M3,user) endloop -------------------------------------------------------------------------------- Where/how do I use this custom AI? Do I make a trigger or something? Explain in step-by-step for a true green campaign builder =( |
| 12-16-2002, 05:03 PM | #9 |
Guest | Ok, here's what you need to do. 1) Pick up a good mpq editor (I use WinMPQ, or TechMPQ depending on what I'm doing) 2) Extract all of the *.ai files from the Scripts\ folder of war3.mpq 3) Take a look at various campaign ai files from war3.mpq (these will be h06_green.ai, etc...) 4) Browse through common.ai, and/or take a look at my common.ai reference (posted on this forum) to get an idea of what functions do. That should give you a starting point for learning to put together your own AI scripts. After that, it's just a matter of writing your script (in a text editor) and inserting it into your map (in the Scripts\ folder) using your MPQ editor. AI scripting definately isn't for the faint of heart, at least not yet. See what you can learn from blizzard's script, and then if you still have questions then come back here. |
