Comments (7)
If you need a handy ID -> type lookup while debugging you can use https://docs.google.com/spreadsheets/d/1jlYDkXW2pQey1oGJlQRBiGjdMs0kfrdHAwzVI2zAjrU/edit
from bwapi.
It's good to know for anyone using the debugger to find the reason of their bug.
I found the actual problem in my recruitment process elsewhere, so yeah, I was misled.
I'm closing this since the issue is not relevant for the BWAPI. Thanks for your dedication.
from bwapi.
You can not "train" a Barracks. You can only "build" a Barracks because it is a building.
Expected values:
someSCV->canTrain(Terran_Barracks) == false
someSCV->canBuild(Terran_Barracks) == true
someBarracks->canTrain(Terran_Marine) == true
someBarracks->canBuild(Terran_Marine) == false
from bwapi.
Wait, I may have been not specific enough on my question:
This is what I have so far with my tests:
someBarracks->canTrain(Terran_Marine) == true
someBarracks->canTrain() == false
someCommandCenter->canTrain(Terran_Marine) == true
Is that normal?
Otherwise @dgant that is how I understood it so far, yes
from bwapi.
canTrain() can return false depending on the state of the unit at the time you invoke it. For example, incomplete or floating Barracks can not train units. You can't train a Marine if you have no minerals. See
bwapi/bwapi/Shared/Templates.h
Line 874 in 3438abd
As for your Command Center, I suspect the most likely cause is the variable you think is referring to a Command Center actually referring to a Barracks. A bug of this nature seems very unlikely. I would double check the identity of the unit to be sure.
from bwapi.
I'm surprised myself, to be honest.
Here is what my debugger says, when the onUnitComplete(BWAPI::Unit unit)
event is called (so all following tests are done in the same scope)
unit->getType() == 106
unit->canTrain(BWAPI::UnitTypes::Terran_Marine, true, true) == true
unit->canTrain(true) == false
I think unit with id 106 is the Terran_Command_Center
, am I wrong?
from bwapi.
I get two different outputs when evaluating the functions in the debugger or in the code itself.
The output of my debugger is still the same, however here is what is done in my code:
std::cout << "Unit of type " << unit->getType() << "; can train Marine? " << unit->canTrain(BWAPI::UnitTypes::Terran_Marine) << "; can train? " << unit->canTrain() << std::endl;
Outputs
Unit of type Terran_Command_Center; can train Marine? 0; can train? 1
from bwapi.
Related Issues (20)
- Docs: Improve GameType documentation
- Direct_SNP Crash if Not Launched As Admin HOT 1
- Enable stylechecker/linter/analysis tool
- getScreenPosition behaves different for client and module bots HOT 1
- Potential Issues with OnRenegade
- Feedback from BWAPI when targeted position is occupied after build command is isseud? HOT 3
- Any possible plans to support higher-level api written in a script language, e.g. python? HOT 2
- Remove ICCup plugin for ChaosLauncher
- Possibly uninitialized data deref in SNP module HOT 4
- Starcraft is started in battle.net now, is the tool still working? HOT 3
- Lack of data? HOT 3
- Phre
- How Can I Use 1.08 Version? HOT 2
- Change replay naming to use mapFileName instead of mapName
- canBuildHere mineral vs depot check is not correct
- Protoss Assimilator does not fire created even due to wasAlive flag set to true when first created (fix included in issue) HOT 5
- I should be able to nuke if I own a silo containing a nuke even if the nuke is owned by a different player
- I'm going crazy.....bwapi 4.1.2 fail to load HOT 2
- Support for non-SSE2 CPUs HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bwapi.