StarCraft® II

Custom map with Computer Player

Posts: 19
I am creating a training map and I would like to be able to allow computer players to be opponents. However, when ever I add an AI and start the game, none of the triggers fire. So no units get created, no menus show, and its basically a screen of the map covered in fog of war because you aren't able to do anything at all. Is there some setting I have missed that allows computer players on custom maps?

If I run the map with just me in the lobby (no computer players), all of the triggers work fine and everything. I thought this might be an acceptable solution, and then would just initialize the computer in the game. However, when I try to start the AI, the computer player doesn't move or do anything. It doesn't start gathering resources and leaves all its workers idle. I have tried both MeleeInitAI() and AIStart(2, false, 200) in an effort to make the computer player do something, but they are proving to be rather stubborn. Am I missing another function call to get the AI players going or something?

These all seem like easy questions that someone with more experience knows how to solve in a matter of seconds, but I really can't figure out what to do.
Edited by ColdLogic on 11/15/2012 11:54 AM PST
Reply Quote
Posts: 372
11/15/2012 11:32 AMPosted by ColdLogic
Is there some setting I have missed that allows computer players on custom maps?


Nope.

Obviously I don't know anything about your map but I'm guessing it's probably a problem with your triggers.

11/15/2012 11:32 AMPosted by ColdLogic
when ever I add an AI and start the game, none of the triggers fire.


How do you know they do not fire? Have you placed a debugging statement as the first line in a trigger? Otherwise can you be sure that the trigger is not firing but then encountering an error?

What are the trigger events you are using? are there conditions on these triggers?

Do you have a "map initialization" trigger? If not I would recomend creating one the simply outputs a statement like "map init trigger fired".

I would be very surprised if even the map init trigger does not fire in your map.

EDIT:
spelling.
Also, what's the training map you are creating, if you don't mind me asking?
Edited by turtles on 11/16/2012 8:55 AM PST
Reply Quote
Posts: 19
Sorry for the late response, didn't see your post until today.

Nope.

Obviously I don't know anything about your map but I'm guessing it's probably a problem with your triggers.


Possible, the problem that I foresee with this thought is that if I DO NOT add an AI opponent, and just start the map with one person, or two user players, everything works fine. The triggers fire, the menus display, we can play without problems.

How do you know they do not fire? Have you placed a debugging statement as the first line in a trigger? Otherwise can you be sure that the trigger is not firing but then encountering an error?

What are the trigger events you are using? are there conditions on these triggers?

Do you have a "map initialization" trigger? If not I would recomend creating one the simply outputs a statement like "map init trigger fired".

I would be very surprised if even the map init trigger does not fire in your map.


Pretty much everything about this system is in a galaxy script. I know the triggers do not fire because I have numerous logs that display to the debug chat pane on the screen. None of which display if I start a game with a computer opponent. It is almost as if the map disregards triggers completely when a computer player is present.

To test your theory even more, I created a map initialization trigger that only sends a message to the debug window. When I test the map from the editor, it works fine and displays the message. I then publish the map to battle.net and log on to test. I add a computer opponent and start.

When the game starts, the message IS NOT displayed. I am sitting at the bottom left corner of the map, with no units and no menus displaying. The map is covered in fog of war and the only thing I can really do is leave.

11/16/2012 08:51 AMPosted by turtles
Also, what's the training map you are creating, if you don't mind me asking?


The map is an implementation of TheStaircase training system that was developed by TheJaKaTaK - http://www.teamliquid.net/forum/viewmessage.php?topic_id=374400 . It teaches a player to play SC2 by starting with base mechanics, restricting the use of units to the least micro intensive units based on race. It then enforces energy caps on basic casting units (queen, nexus, orbitals) that must never be exceeded as well as supply block limits, all via league goals.

Each step of the system adds additional units and tech allowing them to build upon the base they have created.
Reply Quote
Posts: 372
Well, I'm stumped.

The only time I've had triggers behave differently if a player was human or AI was a problem where the game would work fine if player 2 was AI but crash if player 2 was human. Whatever the problem was blizzard fixed it in a patch before I could track down what was causing the problem.

If it were me who was looking for a way forward I would

1) start a new map from scratch and stick a "hello world" message in the init trigger (If this does not work then there is something seriously wrong with your editor)

2) start copy/pasting triggers from your old map to the new one to see what stops it from working.

3a) it stops working at some point but you know where (and possibly why)
OR
3b) it works! (but the problem remains unsolved forever more)

Any way whatever it is, best of luck sorting it out.

GOOD training/practice maps are a field I think is neglected
Reply Quote
Posts: 19
Bummer, was hoping it was a super simple fix.

Thank you very much for your input.

One thing that I didn't mention is that I took the terrain map of Cloud Kingdom. Maybe there is something special on that map specifically that is causing the described situation (and probably all map pool maps). So perhaps starting fresh will lead to an answer. I cant help but think that it is a setting somewhere that I am just missing.
Reply Quote
Posts: 130
You think maybe something in your initialization function(s) fails when it attempts to perform some operation on a computer player, and then in javascript-esque fashion your script just quits right there, meaning that nothing even gets to register for events? I kind of thought galaxy was more robust to errors than that, and you'd think you'd at least get some kind of warning message... But at least it would make a basic amount of sense.
Reply Quote
Posts: 19
I noticed some peculiar behavior yesterday trying to debug this problem. All though the scripts all compiled fine, when I ran the map from the editor, i got a debug message that said something along the lines of "function already defined". But I couldn't figure out which function or where the problem was. Perhaps I have accidentally named one of my own functions the same as a base function? And only when I have a computer present is the overloaded (galaxy doesn't allow overloaded functions, so it probably just errors out there) function being called. However, the error went away... so I am still unsure what the problem is.

11/20/2012 05:25 PMPosted by TheFed
You think maybe something in your initialization function(s) fails when it attempts to perform some operation on a computer player, and then in javascript-esque fashion your script just quits right there, meaning that nothing even gets to register for events? I kind of thought galaxy was more robust to errors than that, and you'd think you'd at least get some kind of warning message... But at least it would make a basic amount of sense.


Yea, usually when i get an error, it runs past it and continues the rest of the functions. Perhaps this is one that doesn't allow carry through. Ugh.

I have started the tedious task of bringing in code one function at a time to figure out which is going wrong, lets hope that leads to a solution.
Edited by ColdLogic on 11/20/2012 7:07 PM PST
Reply Quote
Posts: 19
Sigh, that took about 3 hours narrowing down in the code where the problem was. Apparently my function called "SpawnLarva" was an invalid name. This is a function I use to spawn larva for a newly created Zerg player (If you just call init, a hatchery gets created with 0 larva, some weird bug).

All I had to do was rename that function and everything worked perfectly... sigh so much time wasted.
Reply Quote
Posts: 372
Sigh, that took about 3 hours narrowing down in the code where the problem was. Apparently my function called "SpawnLarva" was an invalid name. This is a function I use to spawn larva for a newly created Zerg player (If you just call init, a hatchery gets created with 0 larva, some weird bug).

All I had to do was rename that function and everything worked perfectly... sigh so much time wasted.


I feel for you. But at least you figured out what the problem was. A bit strange that it only manifested when playing against the computer though.

Also how did you implement the spawn larva problem? I have had the same problem before but never found a perfect solution.

If I remember correctly I used the queen ability which spawns 4 larva. So if I wanted to have 5 larva at a hatch I would use the ability twice (8 larva), wait a second for them to pop and then kill 3 larva (to get 5 larva).

Did you find a better way?
Reply Quote
Posts: 19
Of course I didn't find a better way :P.

Spawning the larva is easy of course, the tricky part is having them tied to the hatchery. The only way I found to tie the larva to the hatchery is via the Queen spawn larva ability (I tried a lot of other things as well).

My solution is just as you described, I spawn 4 larva using the queen ability then kill one so a zerg player has 3 starting larva tied to the hatchery.
Reply Quote

Please report any Code of Conduct violations, including:

Threats of violence. We take these seriously and will alert the proper authorities.

Posts containing personal information about other players. This includes physical addresses, e-mail addresses, phone numbers, and inappropriate photos and/or videos.

Harassing or discriminatory language. This will not be tolerated.

Forums Code of Conduct

Report Post # written by

Reason
Explain (256 characters max)
Submit Cancel

Reported!

[Close]