| 10-15-2002, 02:54 PM | #1 |
At the beginning, the computer attacks player, Then after some event, the computer turns to defence. |
| 10-15-2002, 03:07 PM | #2 |
Guest | Well, if you're talking scripting, then I'm assuming you know the basic functions for building attackers/defenders. Assuming that you know that, then here's what I'd do. loop exitwhen CommandsWaiting() != 0 ***** ATTACK STUFF ********** endloop ***** DEFENSE STUFF ********* Then you'd just set up a trigger in the WE that uses the action AI- Send AI Command to the computer player whenever the event that you're talking about occurs. |
| 10-15-2002, 03:16 PM | #3 |
call CampaignAttackerEx(whatever) call CampaignDefenderEx(whatever) You mean those? and when exitwhen CommandsWaiting() != 0 is on the AI script, what number I will give with AI- Send AI Command to the computer player trigger? I know only basics.... |
| 10-15-2002, 03:33 PM | #4 |
Sorry, I am at work at the moment and have yet to get the .ai files on here. I will help as much as I can. Yes JonahDean is right loop exitwhen CommandsWaiting() != 0 ***** ATTACK STUFF ********** endloop ***** Defend STUFF ********** The zero being the time or you could have it loop but use something elese to activate the exitwhen. Then causing it to run over to defend mode. That is simple and not many things would happen. Also call CampaignAttackerEx() and the defender are for Campaign AI and since default for any map in WE is Standard AI(). You can't use them since all the initialization stuff is in the campaign AI it wouldn't do anything. But their is a version of them for Standard AI if I am right. Something like BuildAttackers() and BuildDefenders() This off the top of my head. I am pretty sure they exist but I can't rememeber name since I have not the files. Also you might need more to get your AI going. But I'll help you with that when I get home. |
| 10-15-2002, 08:36 PM | #5 |
Guest | If you're using CommandsWaiting() as your exit condition, then just send 0,0 as the command. exitwhen CommandsWaiting() != 0 just exits the loop when ANY command is sent to the AI. |
| 10-16-2002, 04:19 AM | #6 |
human misson 06 Mal'Ganis' AI has 'exitwhen CommandsWaiting() != 0' thing. but.. I have no idea how to edit this.. because it is too unique ai.. Also, I looked other scripts, I saw human mission 09 ai has someting like /====================== / after_sword /=================== //grab...(whatever... I don't think this thing actually effects on ai) something /===================== / test sword /==================== If CommandsWaiting() > 0 then call after_sword() endif /==================== / main /=================== something Is this will work, too? |
| 10-16-2002, 03:28 PM | #7 |
That script human_9 is for level 9 of the humans campaign. That is for the part were he finally gets the sword. And it picks it up. Can't remember the swords name. Also the computers default .ai file is for IE if it is a human.ai file. So you will need to create a trigger to start up a yours one. You can have It do as little or as you want. |
| 10-16-2002, 08:32 PM | #8 |
Then, if I edit that ai script, at the begining of my mission, send ai command (0,0) and the, after some event, send ai command (1,0) this will change ai into other ai? |
| 10-16-2002, 09:31 PM | #9 |
Guest | Basically here's the scenario: The beginning of your AI script does some initialization stuff, and then calls WaitForSignal() WaitForSignal() tells the AI to wait until it recieves a command (from a WE trigger) to continue. After the Wait, you should have it enter a loop. In the loop, you set up your attacks. The exit condition for the loop is: exitwhen GetCommandsWaiting() != 0 This tells the AI to keep looping and doing its attacks until it recieves another command from a WE trigger. After the loop, your script does its defending stuff (CampaignDefender, etc...) Then when your mission starts you: Send AI Command (0,0) // This causes the AI to move past the WaitForSignal() call, and enter the loop where it does the attacking stuff Then, after the event you want happens you: Send AI Command(0,0) //This tells the AI to break out of the loop, at which point it starts doing what you've instructed for defense. |
| 10-17-2002, 04:28 AM | #10 |
I will right the Code tommorrow. So that you can see what I mean. I'll make it to where it should work exaclty right for you :). Sorry can't do it now. Net goes off in 1 30 minutes and I have a a lot to do. Work on the Script Editor and a C++ Lab due. |
| 10-17-2002, 06:31 PM | #11 |
Thank you alot! =) |
