| 12-05-2002, 12:45 AM | #1 |
Guest | I got some help in a previous post how to make the ai rebuild structures, but obviously I'm doing something wrong, because when I call startthread the ai stops working. Can someone please have a look at the script. |
| 12-05-2002, 04:59 AM | #2 |
You need an if around that command right there. Heck if it loops that it will keep building 1 cryp. You need it to test if it made one or not so something like this. Code:
if GetUnitCountDone(CRYPT) <= 1 then call SetBuildUnitEx( 1,1,1, CRYPT) endif Something like that, I don't have the stuff right here in front of me but that should help. Good Luck DKSlayer |
| 12-05-2002, 06:21 AM | #3 |
It is a syntax error. The function you start with StartThread needs to be put before the calling function (in this case main). And one other thing: When you start a thread, that thread runs all the time, so you need to put a call Sleep(5) in such an endless loop. Else he will steal all the performance. What DKSlayer says is wrong. SetBuildUnit(1,1,1,CRYPT) just says build crypts until you have 1. But on the other hand the code he posts is quite useful because it will prevent that the crypt will be inserted uselessly often into the build array. So do it that way. But without the = . |
| 12-05-2002, 02:11 PM | #4 |
Guest | Actually you don't need a loop at all if you want to make the AI rebuild lost units. As long as you don't reset the build queue, the SetBuildUnitEx(1,1,1,CRYPT) order will stay in there indefinately. That will insure that 1 crypt is always available. If at any point, the computer loses all of its crypts, then another will be built to replace it. In fact, since you call the BuildUnit function for 1 crypt at the start, you can eliminate the e_t function entirely, because the order for 1 crypt is already in the queue, thus it's always there. |
| 12-05-2002, 03:14 PM | #5 |
Man, I have been out of the AI loop to long. When I get done with the Commander I am writing some AI files. Anyways. I have noticed an increase in questions about AI. Since the AI Project forum really isn't a project. It's more of a ask questions about AI. Which doesn't really happen all the time since people think it's a project. I am thinking of getting Skull to Chage it to AI Forum and putting it here in Developers' Corner. I think this would help to have all AI questions in one forum it would help Tons of NB's. AI people respond on what you think about this and if this would help you. Also I think I might want to get all AI Knowledgeable people for soemthing. I'll say later. :) Thanks DKSlayer |
| 12-05-2002, 03:55 PM | #6 |
Guest | I think that's a good idea. Would be nice to give those wayward AI scripters a place to go :D |
| 12-05-2002, 05:04 PM | #7 |
Guest | great, thx guys :) |
| 12-05-2002, 06:10 PM | #8 |
Guest | Arg, I just removed the unnecessary lines like you said, but now all the AI does is building a ghoul and attacks and then it just stands there. I tried to replace whith the original and make the necessary changes but it didn't help. I totally clueless here, please help me (yet again) I'm attaching the whole map this time. emote_confused |
| 12-05-2002, 06:22 PM | #9 |
Did you import the .ai file into the map? If not the map shouldn't do us much Good. It will be the ai file that's the prob. I will look at it as soon as I can. Thanks DKSlayer |
| 12-05-2002, 06:49 PM | #10 |
Guest | Try increasing the time for your first attack to at least a minute. Other than that, I'd say just make sure that all of the units you're asking it to build have their requirements met. I'll take a look at the map when I have the chance, unfortunately I'm at work atm :/ |
| 12-05-2002, 10:39 PM | #11 |
Guest | yes the ai is in there, thx for your time |
| 12-06-2002, 02:28 PM | #12 |
We have a AI forum now so, Moving to that one. Thanks DKSlayer |
| 12-08-2002, 01:06 PM | #13 |
Guest | how's it going? have you found out anything about the problem? I'm stuck more or less... |
| 12-08-2002, 05:18 PM | #14 |
Guest | I took a look at both your map and your script. I removed the e_t function entirely, and increased the time on the first attack to 2 minutes. The script worked fine in my script-testing map, but in yours it still didn't work right. This tells me that it's a requirement somewhere, or resources or something. Make sure that ALL of the units you're trying to build have ALL of their requirements met, and that the AI always has plenty of resources (it looked like you had the triggers to feed it resources, so that probably isn't the problem) Other than that, i'm not sure why it wouldn't work in yours. Like I said, it works fine in my test map. |
| 12-29-2002, 11:11 PM | #15 |
Guest | I made it work, finaly. Looks like the ai needs plenty of food to work properly. :ggani: |
