Hey guys, I'm fairly new to the StarCraft editor and I'm currently writing a bachelor's thesis for a dynamic player handicap. I've been searching for a while now and couldn't figure it out myself how to check a players current resources, units, etc in runtime.
Basically I'm trying to adjust the StarCraft map in terms of symmetry and asymmetry to help a struggling player and give him better chances of coming back and maybe even be able to compete with a better player. To do this, I wanted to take a look at the current resources, units, etc. of both players and compare them and find the weaker player. This should occured every couple of minutes (I already got all that running but I don't know how to get the current resources, units, etc. Of a player.) Additionally, is it possible to check the all already spent resources aswell?
It would be pretty helpful to me if someone could help me with that?
Well there is the For Each Catalog Entry In Catalog action definition that can be combined with an If Then Else that uses a Comparison condition to identify if a player has a specific upgrade. You could then add to an integer variable assuming you are weighting all upgrades equally.
For unit counts use Units In Region Matching Condition of the entire map and the Number Of Units In Unit Group function. Again this assumes every unit is equal so maybe categorising by supply usage would be better.
With resources use the Player Property (Integer) function.
For spent resources you would need to use an integer variable to tally up all the stuff spent that uses a Catalog Field Value Get function to add to the variable each time the resource is used by a Train, Build or Arm Magazine ability.
Rollback Post to RevisionRollBack
Contribute to the wiki (Wiki button at top of page) Considered easy altering of the unit textures?
Thanks for this fast reply, i'll try these things out. And i agree, categorising units by supply usages seems like a nice idea or just using the resource costs as a value to weight the different units, same for upgrades.
One can use catalog functions to dynamically look up the costs of an upgrade type or unit type. Instead of iterating through every upgrade declared to find which the player has, it might be more efficient to log upgrades in response to research complete events.
StarCraft II might have events that allow logging of when player resources change, allowing one to track earnings and discard expenditure.
Thanks so much for the help guys, the cataloge function hint really helped me. I'm now checking the score amount of the Upgrade via the catalog function and save the value in a variable.
However i'm still trying to figure out how to track unspent resources. Where and how do i use the Player Property (integer) function? I can only find the Player Property Changed event and the Modify Player Property (intereger) action.
EDIT: Turns out, i cannot get the solution i used for Upgrades working for Units.
Why can't i use the Catalog Field Value Get As Integer action for units, the same as i used it for Upgrades? When i use this action, i simply cannot use the "Triggering Unit" in the "Entry" part. Does anyone know why this is the case? Also is there another way to get the values of the Units Data Catalog (especcially the CUnit_ScoreMake Value)?
Its a very simple trigger, that should only grant me the "ScoreMake" value. Currently that trigger is empty. I've checked Field Value Get but my problem is that for Field Value Get, i need the specific Unit for that. I believe using the Field Value Get, i cannot use Triggering Unit when my event is either "Unit dies" or "Unit Enters/Leaves Region".
Why can't i use the Catalog Field Value Get As Integer action for units, the same as i used it for Upgrades? When i use this action, i simply cannot use the "Triggering Unit" in the "Entry" part. Does anyone know why this is the case? Also is there another way to get the values of the Units Data Catalog (especcially the CUnit_ScoreMake Value)?
Its because a unit is not a unit catalog entry... You need to get the type of the unit which is a unit catalog entry.
Technically speaking a unit is a unit where as a catalog entry is a string, hence incompatible type. You need to get the unit type of the unit which is a string and use that as a catalog entry.
One can look at unspent resources directly as it is a player property.
Thanks guys. Everything worked out fine! Im now checking the current mineral and vespene score, add and substarct the Unit score whenever a unit enters or leaves the region (entire Map) and track the score of any upgrade that finishes. This way i'm getting a complete score of each player which updates every couple of seconds, so i can compare both (all) players.
Hey guys, I'm fairly new to the StarCraft editor and I'm currently writing a bachelor's thesis for a dynamic player handicap. I've been searching for a while now and couldn't figure it out myself how to check a players current resources, units, etc in runtime.
Basically I'm trying to adjust the StarCraft map in terms of symmetry and asymmetry to help a struggling player and give him better chances of coming back and maybe even be able to compete with a better player. To do this, I wanted to take a look at the current resources, units, etc. of both players and compare them and find the weaker player. This should occured every couple of minutes (I already got all that running but I don't know how to get the current resources, units, etc. Of a player.) Additionally, is it possible to check the all already spent resources aswell?
It would be pretty helpful to me if someone could help me with that?
Well there is the For Each Catalog Entry In Catalog action definition that can be combined with an If Then Else that uses a Comparison condition to identify if a player has a specific upgrade. You could then add to an integer variable assuming you are weighting all upgrades equally.
For unit counts use Units In Region Matching Condition of the entire map and the Number Of Units In Unit Group function. Again this assumes every unit is equal so maybe categorising by supply usage would be better.
With resources use the Player Property (Integer) function.
For spent resources you would need to use an integer variable to tally up all the stuff spent that uses a Catalog Field Value Get function to add to the variable each time the resource is used by a Train, Build or Arm Magazine ability.
Contribute to the wiki (Wiki button at top of page) Considered easy altering of the unit textures?
https://www.sc2mapster.com/forums/resources/tutorials/179654-data-actor-events-message-texture-select-by-id
https://media.forgecdn.net/attachments/187/40/Screenshot2011-04-17_09_16_21.jpg
Thanks for this fast reply, i'll try these things out.
And i agree, categorising units by supply usages seems like a nice idea or just using the resource costs as a value to weight the different units, same for upgrades.
One can use catalog functions to dynamically look up the costs of an upgrade type or unit type. Instead of iterating through every upgrade declared to find which the player has, it might be more efficient to log upgrades in response to research complete events.
StarCraft II might have events that allow logging of when player resources change, allowing one to track earnings and discard expenditure.
Thanks so much for the help guys, the cataloge function hint really helped me. I'm now checking the score amount of the Upgrade via the catalog function and save the value in a variable.
However i'm still trying to figure out how to track unspent resources. Where and how do i use the Player Property (integer) function? I can only find the Player Property Changed event and the Modify Player Property (intereger) action.
EDIT: Turns out, i cannot get the solution i used for Upgrades working for Units.
Why can't i use the Catalog Field Value Get As Integer action for units, the same as i used it for Upgrades? When i use this action, i simply cannot use the "Triggering Unit" in the "Entry" part. Does anyone know why this is the case? Also is there another way to get the values of the Units Data Catalog (especcially the CUnit_ScoreMake Value)?
How is your trigger structured? Field Value Get is probably your best choice.
Contribute to the wiki (Wiki button at top of page) Considered easy altering of the unit textures?
https://www.sc2mapster.com/forums/resources/tutorials/179654-data-actor-events-message-texture-select-by-id
https://media.forgecdn.net/attachments/187/40/Screenshot2011-04-17_09_16_21.jpg
Its a very simple trigger, that should only grant me the "ScoreMake" value. Currently that trigger is empty. I've checked Field Value Get but my problem is that for Field Value Get, i need the specific Unit for that. I believe using the Field Value Get, i cannot use Triggering Unit when my event is either "Unit dies" or "Unit Enters/Leaves Region".
It uses a game data link in this case from the units data type so you would need a Unit Type Of Unit function that then uses the triggering unit.
Contribute to the wiki (Wiki button at top of page) Considered easy altering of the unit textures?
https://www.sc2mapster.com/forums/resources/tutorials/179654-data-actor-events-message-texture-select-by-id
https://media.forgecdn.net/attachments/187/40/Screenshot2011-04-17_09_16_21.jpg
Its because a unit is not a unit catalog entry... You need to get the type of the unit which is a unit catalog entry.
Technically speaking a unit is a unit where as a catalog entry is a string, hence incompatible type. You need to get the unit type of the unit which is a string and use that as a catalog entry.
One can look at unspent resources directly as it is a player property.
Okay, i will give these things a go today. Let's hope i can make this work now.
If not look at the mineral drop triggers from co-op where they use a similar system to determine rewards on kills for Kerrigan and Horner.
Contribute to the wiki (Wiki button at top of page) Considered easy altering of the unit textures?
https://www.sc2mapster.com/forums/resources/tutorials/179654-data-actor-events-message-texture-select-by-id
https://media.forgecdn.net/attachments/187/40/Screenshot2011-04-17_09_16_21.jpg
Thanks guys. Everything worked out fine! Im now checking the current mineral and vespene score, add and substarct the Unit score whenever a unit enters or leaves the region (entire Map) and track the score of any upgrade that finishes. This way i'm getting a complete score of each player which updates every couple of seconds, so i can compare both (all) players.
You guys helped me a ton!
So solved?
Contribute to the wiki (Wiki button at top of page) Considered easy altering of the unit textures?
https://www.sc2mapster.com/forums/resources/tutorials/179654-data-actor-events-message-texture-select-by-id
https://media.forgecdn.net/attachments/187/40/Screenshot2011-04-17_09_16_21.jpg
Sorry for replying this late, yes everything is solved! Thanks guys!