Blizzard / s2client-api

StarCraft II Client - C++ library supported on Windows, Linux and Mac designed for building scripted bots and research using the SC2API.
MIT License
1.66k stars 281 forks source link

How to get detailed information about enemy units? #250

Closed ayu-mail closed 6 years ago

ayu-mail commented 6 years ago

How do you get enemy units attack targets, weapon cooldown, weapon level, armor level?

I looked up a lot of sc2 API issue and game tests, but I could only get my own, not the enemy,It's always zero.

thx

ayu-mail commented 6 years ago

This is known in human combat, and this information is important to combat.

Archiatrus commented 6 years ago

I agree with weapon and armor upgrades.

Weapon cooldown is only guessed from experience. You can not click on a unit and see the cooldown. I am more in favor of not having it because I fear it could break unit interactions but I have no strong evidence assuming you do not have the target.

With target information I strongly disagree. It would make a lot of units virtually obsolete. Just google for the micro bot video where there are tanks vs zerglings. Overall it would be a huge nerf to all splash and projectile units.

ayu-mail commented 6 years ago

ZERG_RAVAGER: EFFECT_CORROSIVEBILE TERRAN_GHOST: EFFECT_NUKECALLDOWN PROTOSS_HIGHTEMPLAR: EFFECT_PSISTORM ...... How do you avoid this ABILITY? These injuries are high, but they are not available.

Is there any sign of attack on our unit? like this: unit->attacked(value:true or false)

Archiatrus commented 6 years ago

const std::vector<sc2::Effect> effects = agent.Observation()->GetEffects(); and const float radius = agent.Observation()->GetEffectData()[effect.effect_id].radius; gives you everything you need.

No there is no "attacked" field. But you can monitor the health. If HP this loop is less then HP last loop then we can assume the unit is under attack (there are of course exceptions, e.g., stim).

ayu-mail commented 6 years ago

thx, It was very helpful to me.

herodrigues commented 6 years ago

@ayu-mail Please, consider closing this issue if your question was answered.