| 02-02-2009, 01:38 PM | #1 | |
Anyone familiar about the trigger: Send AI command?
Forget about the rest. I just need to focus on this part: Trigger: AI - Send Player 1 (Red) the AI Command (0, 0)That "(0,0)" meant: The first 0 is Command, the second is Data. So... 1: What is "Command"? Where do I get the values for the correct commands from? 2: What is "Data"? And where do I get those values from? That'll be it. I heard AMAI peoples are here, and basically our admin said this stuff here, which really tempted me to come here and ask them (or you) for help. Thanks in advance. |
| 02-03-2009, 03:52 AM | #2 |
You can send any integers to an AI using AI Command (CommandAI in JASS). But the AI must be designed to access the values using GetLastCommand and GetLastData, usually with WaitForSignal or a loop that checks between Sleeps. Examples:globals integer playerIndex = 0 endglobals function CheckForTargetPlayer takes nothing returns nothing local integer data = 0 loop set data = GetLastData() if (playerIndex != data) and (data >= 0) and (data <= 16) then set playerIndex = data endif call Sleep(M1) endloop endfunction function main takes nothing returns nothing call CampaignAI(HOUSE,null) call StartThread(function CheckForTargetPlayer) // This starts a new thread // that checks for data // value each minute, then // passes the value on to // 'playerIndex', used as // a player target. call SetBuildUnit( 4, PEASANT ) call SetBuildUnit( 3, BARRACKS ) call SetBuildUnit( 2, SANCTUM ) call SetBuildUnit( 1, BLACKSMITH ) call SetBuildUnit( 1, LUMBER_MILL ) call SetBuildUnit( 1, ARCANE_VAULT ) call SetBuildUnit( 1, HUMAN_ALTAR ) call WaitForSignal() // 'WaitForSignal' will loop-sleep until the // AI receives a command, whatever the value. loop call InitAssaultGroup() call CampaignAttacker(0,GetRandomInt(2,4),FOOTMAN) call CampaignAttacker(0,GetRandomInt(2,4),RIFLEMAN) call CampaignAttacker(0,GetRandomInt(1,2),SORCERESS) call CampaignAttacker(0,GetRandomInt(1,2),PRIEST) call CampaignAttacker(0,GetRandomInt(1,2),SPELL_BREAKER) call CampaignAttacker(0,GetRandomInt(0,1),KNIGHT) call CampaignAttacker(0,GetRandomInt(0,1),MORTAR) call SuicideOnPlayer(M1,Player(playerIndex)) endloop endfunction I realize this may be confusing to a GUI-user, but the full extent of AI capability is beyond what the WE AI Editor can render. |
| 02-03-2009, 02:01 PM | #3 | |
Quote:
I'm not going to use AI editor. At the beginning (map initialization), what should be retrieved when using GetLastData? Isn't that suppose to be empty, since the last data technically didn't exist? I didn't see GetLastCommand(), where is it? --------------------------- Back to the trigger (Send AI command), should the integers be user-defined? Do I just input the numbers and then let it run on its own? |
| 02-03-2009, 04:38 PM | #4 |
|
| 02-04-2009, 01:46 PM | #5 |
Oh....Thank you. --------- Note to self: Which leaves me wondering why do the developers placed the Send AI command trigger in there for...? You may answer if you want, it's just me stumped. |
| 02-04-2009, 02:17 PM | #6 |
Send AI Command is usually used with Blizzard Campaign AIs to tell the AIs when to begin building assault forces. It has no use with Blizzard Melee AIs. |
| 02-04-2009, 03:02 PM | #7 |
check AMAI this will help a lot. |
| 02-04-2009, 03:39 PM | #8 |
To Archmage Owenalacaster: Thank you. To Diod: No thanks. AMAI sure is a lot more complex than the Campaign AI. I haven't learned much about AMAI. |
| 02-04-2009, 03:51 PM | #9 |
AMAI have nice documentation and great to learn about "send get and return commands" |
| 02-07-2009, 07:32 PM | #10 |
Hmm...You've got me. |
