| 12-03-2002, 08:20 PM | #1 |
Guest | Ok I have 1 map under my belt. This is the first map I've made for a game since Doom II so I'm not a pro. I can't find a starting point for learning how to use scripts. None of the WC3 websites I've visited seem to have any posted. If anybody could give me a push in the right direction I'd appreciate it. As an example of what I'd like to know how to do, let just just say I have the red team and the blue team on a map. I set them up with a gold mine and some buildings and I want them to try to kick each others ***. I have no idea how to do that :) It seems like a pretty basic feature of a map. MY previous map was 100% tigger based. Guys popped out at set times and attack-moved to set positions and that was it. I'd like this to be designed differently. I'm gonna go peel open every map I can get my hands on looking for hints, but any advice would be appreciated. |
| 12-03-2002, 08:58 PM | #2 |
Actually not many maps include a .ai files I actually can't think of any. Now you can do this with the Blizzard campaign maps, these all have scripts. These are campaign though so they are rather proprietory(Specially done for that map) If you want a LOAD of scripts unload all the scripts in the war3.mpq under Scripts\ The main ones used for melee are human.ai, elf.ai, undead.ai, and orc.ai. There is a common.ai file which holds all the common ai functions, which the other .ai files pull from. Now there is the two .j files which hold and compose JASS the programming lanuage so you want to learn how to use it. If you are one of those guys that thought Custom Text triggers were hard you better suck it up if you want to learn AI. If you loved custom, you will feel mroe at home, just new functions to play with :). I would post more but at work and need to run to the college. |
| 12-03-2002, 10:15 PM | #3 |
Guest | Cool thanks. I have an mpq unpacker doohickey that I downloaded and haven't used yet. I'll give that a whirl. Thanks. |
| 12-04-2002, 01:09 AM | #4 |
Guest | The AI mocks me. So far I can get them to dig for gold...which is better than before, but still not very good. Stupid lazy ugly peasants. |
| 12-04-2002, 01:16 AM | #5 |
Man, if you only knew, getting the Peasonts to harvest gold in Beta was a great accomplish ment, definitly since there was no example .ai stuff, and it did not come with the race.ai files. You are learning and doing attacks also takes alot of practice. I usually have the Melee file for that rice like orc.ai open so I can compare. Ask questions if you are having problems with any specific part. Thanks DKSlayer |
| 12-04-2002, 01:49 PM | #6 |
Depends if you are trying to create an actual ai file, or just a campaign ai, the campaign ai file is very easy to create, if you need more infromation on this, ask and I will post help later today... |
| 12-04-2002, 03:57 PM | #7 |
Guest | I'm not sure I understand what the difference would be between "an actual ai file, or just a campaign ai" but I'll take any help you're willing to offer. I'm still mostly monkeying around. Not really sure what I'm doing but I'm knocking stuff over to see, exactly, how I can break things. It's sorta like learning about music by pushing a piano down a flight of stairs but it's a start. |
| 12-04-2002, 04:52 PM | #8 |
Guest | I actually do have 1 specific question. There is a trigger action that I can't remember exactly but it's something like this: AI - Issue AI Order (command, data) The two things you can send are, obviously, command and data and they both seem to want to be integers. Anybody know how that trigger action works? Just judging by it's name it looks like it could be terribly handy, but the fact that it only accepts integers as inputs is a little confusing. I also cant find a map that uses this action. Anybody have any clues? |
| 12-04-2002, 06:14 PM | #9 |
Funny you bring that up Me and AIAndy use that to issue our commands to the AI. Here is a call " call CommandAI(Player, Command, Data) " Example of how we do it. Code:
CUSTOM TRIGGER PART call CommandAI(Comp, 12, 0) AI FILE PART loop //Comand Loop wait //Can't thing of real code right now exitwhen(Command != 0) endloop if Command = 12 then call Go() endif We use a wait loop that sits there and waits till a command is sent than compares the value to a if statement in the AI until the command finds a match. Data is sometimes not even needed so we leave it at 0 when not. Also Commands stack, at least that's what we thought. I don't have code here to Check. AIAndy has worked that out real good, He probably will see this if not I will get him over here. I will also post more when I get home and can see code. But yes the jest of it sends a integer command integer data to AI this allows you to do trigger to AI interaction. |
| 12-04-2002, 06:55 PM | #10 |
Guest | Actually, the AI functions that deal with commands are: GetLastCommand() - Returns the integer value of the last command sent to the AI GetLastData() - Returns the integer value of the last data sent to the AI. CommandsWaiting() - Returns the number of commands waiting to be processed. PopLastCommand() - Removes the last command from the stack. I believe DK is right, commands do stack, meaning that you can issue multiple commands, and then retrieve them with a loop. Something like this (Keeping in mind that stacks are last-in-first-out): integer com loop exitwhen (CommandsWaiting == 0) set com = GetLastCommand() *** PROCESS COMMAND *** call PopLastCommand() endloop Data, on the other hand, isn't stacked (I don't believe). If you want to see a blizzard campaign mission that uses these AI functions to great effect, check out the human mission where Arthas races Mal'Ganis to kill the most villagers (I believe it's h05_green.ai or something like that). Looking at that script should also help you understand the concept of captains as well. Jaina's script from the final orc mission also uses some commands to perform actions, but not quite the way that the human mission does. |
| 12-04-2002, 07:21 PM | #11 |
Guest | Excellent! Thanks. Captains were giving me a headache just last night. I think that's why all I could get to work is gold digging. I didn't have a captain there to flog the worthless townfolk. I'll bust open that ai file tonight. |
| 12-04-2002, 07:42 PM | #12 |
Yea, what he said :). I always just looked at the code real quick just so I could get the commands and data for my triggers, never looked at it much. So Thanks Dude. Now I was thinking that data was stackable, but I amn not sure I'll check on that when I get home. As a matter of fact I think it is we used two different commands to send the x and y values as well as command. Although I will look again when we get home. That Reminds me of something else, but anyways. Have fun creating AI makes you feel all tingly inside. :ggani: DKSlayer |
| 12-04-2002, 08:28 PM | #13 |
Guest | Data may be stackable, I haven't really played around much with that portion of it. Blizzard's AI's also use two separate commands for x,y coordinates, so maybe it keeps track of that as well. I was thinking that the script (at least Blizz's) processes each command as it comes in, instead of allowing them to stack up, so there's never more than one command waiting at a time, but your script could be completely different. Let me know what you find out. |
| 12-04-2002, 09:08 PM | #14 |
Data definitely stacks the same way as commands. Otherwise it would be nonsense because they would get seperated and you would not know which data belongs to which command. Actually it is probably one stack because there is only one pop command. Most of the time the stacking will not be needed but if you want to send more than 2 integers to the AI it is needed. Like in one of the commands in the commander it is necessary to send the command number and attack coordinates to the AI. That was when we first encountered that it was a stack and not a queue. CommandAI is the only way to send information from Triggers to AI. It can also be used to send information from AI to AI. In between allied AIs it is also possible to send unit handles with SetAllianceTarget and GetAllianceTarget. But that one is shared between all AIs in a force. It is usually used to set a target for all allies to attack (SingleMeleeAttack uses it). BTW, you should know that when there is a syntax error in an AI script you do not get any error message. In that case he just ignores the entire script and does what he does without a script which is mining gold with orc peon and human peasant and lumbering with wisps and doing nothing with undead. |
