Staredit Network > Forums > Modding Assistance > Topic: Help! Making Melee AIs
Help! Making Melee AIs
Apr 23 2011, 5:15 pm
By: pastelmind  

Apr 23 2011, 5:15 pm pastelmind Post #1



Hello, folks. I'm working on a mod with melee ai scripts, and apparently most of them don't cope well with tech tree changes. One of my new units is based on the Dark Archon and can be produced from a Gateway, but my melee AI script refuses to build them with the train() command. But the reason I based the new unit on the Dark Archon was so that it could rely on the Dark Archon's default AI to cast spells like Maelstrom and Mind Control, the effects of which have obviously been replaced. In fact, creating a UMS map with pre-placed units reveal that the new unit's combat AI works fine.

In short: is there a way to force a melee AI to build a Dark Archon-based unit from a Gateway? If not, what would be the best way to emulate a human player actually building that unit from the Gateway?

Post has been edited 1 time(s), last time on Apr 23 2011, 5:21 pm by RadiganP.



None.

Apr 24 2011, 12:39 am Dem0n Post #2

ᕕ( ᐛ )ᕗ

What unit does the dark archon replace? If it replaces the dark templar or something, just tell it build that. Maybe that'll work?




Apr 24 2011, 12:51 am ubermctastic Post #3



No, the unit he's trying to build is replacing the dark archon.
but I don't know how to write ai



None.

Apr 24 2011, 1:04 am Dem0n Post #4

ᕕ( ᐛ )ᕗ

No, I think he's saying that the unit is a dark-one-esque unit that can be built from the gateway, but he can't get the AI to build it. He has to tell it to build the original unit (the one that he replaced with this new one) in order for it to work, I think.




Apr 24 2011, 2:39 am pastelmind Post #5



Eh....looks like I made everyone confused :( so I'll clarify:

I removed the Dark Archon (unit #63) and modified its UNITS.DAT entries so as to fit the specs of my new unit. I then added/removed appropriate DAT requirements in Firegraft so that unit #63 could be produced from a Gateway. I also used a Firegraft EXE edit to change the resulting unit of two Dark Templar to an Archon (unit #68). So:

Dark Archon -> graphics changed to a different unit, can now be produced only from the Gateway.
Dark Templars -> merging will create unit #68, which is Protoss Archon.

The reason I did this was so that when attacked, the computer-controlled unit #63 would attempt to use Dark Archon's spells on enemy units. When using a UMS map with pre-placed unit #63s, this works perfectly--the new unit uses Dark Archon's spells fine and dandy. But the melee AI doesn't seem to produce them at all. I thought it would be able to make them with the train() command since they are now produced from the Gateway, but it seems that I was wrong.



None.

Apr 25 2011, 1:45 am Derqua Post #6



Mind posting your script?



None.

Apr 25 2011, 5:58 am pastelmind Post #7



Do you mean the Protoss melee AI script? If so, I'm attaching it. It's in PyAI format, BTW.

The AI script itself is based on the default Protoss Expansion Custom Level script, with labels renamed and comments added myself to improve readability.

Attachments:
Protoss Expansion Custom Level.txt
Hits: 5 Size: 41.85kb



None.

Apr 26 2011, 12:25 am Derqua Post #8



A quick glance shows that it all checks out, the only thing I can think of is that your .dat file doesn't have the right race flag check off.



None.

Apr 26 2011, 4:34 am pastelmind Post #9



Strange, because the race flags are all set correctly. Could it be that the Dark Archon is hardcoded to be produced by merging two Dark Templar, and the game does not recognize that it now must be produced from the Gateway? The Zerg AI has similar issues--it refuses to build the Devourer, which is now made directly from larva.



None.

Apr 26 2011, 6:30 pm poiuy_qwert Post #10

PyMS and ProTRG developer

I'm pretty sure this is an issue somewhere in your FG settings. I think it's a problem in the requirements for the unit or something like that.




Apr 26 2011, 7:05 pm IskatuMesk Post #11

Lord of the Locker Room

Yes, the AI reads requirements and not actual buttons.



Show them your butt, and when you do, slap it so it creates a sound akin to a chorus of screaming spider monkeys flogging a chime with cacti. Only then can you find your destiny at the tip of the shaft.

Apr 27 2011, 7:37 am pastelmind Post #12



The unit requirements are all correct:

Code
Current unit is...
Gateway
Cybernetics Core

It's the same as the Dragoon's requirement. Besides, I can make Sentries with no problem when I'm a Protoss.

I also found something really weird. The train(1, Protoss Sentry) actually builds a Dragoon. The command wait_train(1, Protoss Sentry) keeps building Dragoons indefinitely. But I see no relation between Dragoons and Sentries, apart from that they have the same requirement, are both trained from the Gateway, and the Sentry button comes right after the Dragoon's button.



None.

May 3 2011, 2:00 am Derqua Post #13



Try using the unit id instead, just because you might not have your unitdef.txt set up for your mod.



None.

May 4 2011, 6:45 am pastelmind Post #14



Hmm, do I need to make a custom unitdef.txt in the first place? Looking at the default unitdef.txt provided in PyAI doesn't seem to contain anything special...besides, I thought PyAI can use stat_txt.tbl to match unit names with unit ID numbers. Could you please tell me how I should set up the unitdef.txt?



None.

May 5 2011, 12:36 am poiuy_qwert Post #15

PyMS and ProTRG developer

Quote from name:RadiganP
I thought PyAI can use stat_txt.tbl to match unit names with unit ID numbers.

It can, though it will take the first match in stat_txt, so if you have duplicate unit names by accident that could screw it up.

Quote from name:RadiganP
Could you please tell me how I should set up the unitdef.txt?

Creating a unitdef.txt is easy, its just a bunch of variable definitions in the form "<type> <name> = <value>", then all occurrences of <name> in the code will be replaced with <value>. You should be able to create one looking at the default file. The only tricky part might be the type of your units will be "military" but workers are considered "building"s, but PyAI will give warnings/errors if you use a variable with the wrong type.




May 5 2011, 4:19 pm jababeans Post #16



Quote from name:RadiganP
I also used a Firegraft EXE edit to change the resulting unit of two Dark Templar to an Archon (unit #68).

... The reason I did this was so that when attacked, the computer-controlled unit #63 would attempt to use Dark Archon's spells on enemy units.

... When using a UMS map with pre-placed unit #63s, this works perfectly--the new unit uses Dark Archon's spells fine and dandy. But the melee AI doesn't seem to produce them at all
I had a similar problem and baja told me that Dark Archons will not use their default spells unless they were created from the merging of 2 dark templars. Go back and rearrange your mod so that Dark Archons are built from the merging of 2 dt's and you'll then see mind-control, feedback, and maelstorm. Ask him to give you a copy of the latest PEAI build if you want to see these wicked spells in action. Warning: Spammed mindcontrol is a bitch so be careful tweaking this one << :)



None.

May 6 2011, 12:37 pm pastelmind Post #17



Heh, thanks. I think the computer AI is hardcoded to attempt to merge two Dark Templar when instructed to build a unit with an ID # of 63 (Dark Archon), and thus it does not recognize that it can now be built directly at the Gateway. I think I'll settle for the Protoss melee AI not being able to produce Sentries.

I had similar problems with the Mutalisk, where I decided to just replace it with an entirely different unit that was intended to morph into Guardians. The resulting Zerg AI seems to play fine.



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[01:35 am]
Ultraviolet -- Vrael
Vrael shouted: NEED SOME SPORTBALL> WE GOT YOUR SPORTBALL EQUIPMENT MANUFACTURING
Gonna put deez sportballs in your mouth
[01:24 pm]
Vrael -- NEED SOME SPORTBALL> WE GOT YOUR SPORTBALL EQUIPMENT MANUFACTURING
[2024-4-30. : 5:08 pm]
Oh_Man -- https://youtu.be/lGxUOgfmUCQ
[2024-4-30. : 7:43 am]
NudeRaider -- Vrael
Vrael shouted: if you're gonna link that shit at least link some quality shit: https://www.youtube.com/watch?v=uUV3KvnvT-w
Yeah I'm not a big fan of Westernhagen either, Fanta vier much better! But they didn't drop the lyrics that fit the situation. Farty: Ich bin wieder hier; nobody: in meinem Revier; Me: war nie wirklich weg
[2024-4-29. : 6:36 pm]
RIVE -- Nah, I'm still on Orange Box.
[2024-4-29. : 4:36 pm]
Oh_Man -- anyone play Outside the Box yet? it was a fun time
[2024-4-29. : 12:52 pm]
Vrael -- if you're gonna link that shit at least link some quality shit: https://www.youtube.com/watch?v=uUV3KvnvT-w
[2024-4-29. : 11:17 am]
Zycorax -- :wob:
[2024-4-27. : 9:38 pm]
NudeRaider -- Ultraviolet
Ultraviolet shouted: NudeRaider sing it brother
trust me, you don't wanna hear that. I defer that to the pros.
[2024-4-27. : 7:56 pm]
Ultraviolet -- NudeRaider
NudeRaider shouted: "War nie wirklich weg" 🎵
sing it brother
Please log in to shout.


Members Online: Roy