UnitCreate, UnitDiscover and UnitShow at the same time

Posts: 1
Joined: Mon Feb 21, 2011 1:54 pm

UnitCreate, UnitDiscover and UnitShow at the same time

Postby kikoso » Mon Feb 21, 2011 10:08 pm


I'm running BWAPI 3.4, together with Starcraft BW 1.16.1 and ChaosLauncher. Pretty much the standard configuration. Trying to detect a event when I create a unit in order to handle it, I discovered that every time a unit is created, the following three events are triggered:

1.- UnitCreate
2.- UnitDiscover
3.- UnitShow

I would expect that the three events should trigger when the unit can be finally used (that means, the unit is available at the map). Triggering this effects when the unit is still being created doesn't make so much sense, or does it? Is this the only way to deal with it?


User avatar
Posts: 92
Joined: Sat Jun 21, 2008 11:50 pm

Postby lowerlogic » Sat Jul 30, 2011 1:35 am

These events are not directly related to being able to use the unit. Read descriptions of these events in the manual - http://code.google.com/p/bwapi/wiki/AIModule

To be able to use a unit, it must exist(), be completed, and be done with its cooldown (Gateways have a cooldown of a few seconds if I recall correctly).

For example an SCV gets created when you start training it, so it will trigger these three events a few frames after you call unit->train(Terran_SCV). To see if the SCV is complete and ready to take orders, use SCV->isCompleted().

Return to “BWAPI (wrappers in other languages / questions and announcements related to BWAPI itself)”

Who is online

Users browsing this forum: No registered users and 1 guest