I have made several new upgrades via the data editor. Now I am trying to teach the standard AI how to use them. The upgrades are mostly improvements for unit stats or can be used with auto cast turned on. So there is no need to micro new abilities. I only need to order the AI to research the upgrades.
What I have done so far.
Preset definition
ENUM Research Status
Value Type: Integer
Values
No Reserach Strcuture
Not enough resources
Queued or in progress
Completed
Trigger
Advanced Zerg Tech
Events
Timer - Every 10.0 seconds of Game Time
Local Variables
ZergPlayer = 15 <Integer>
ResearchResult <ENUM Research Status>
Conditions
Actions
Variable - Set ResearchResult = (Check and Order Research for Player ZergPlayer at any Spawning Pool using Spawning Pool - Zerg - Creep Tumor Enhancements 1, Zerg - EnhanceCreepTumor1 and keep at least 0 of Gas and Minerals)
General - If (Conditions) then do (Actions) else do (Actions)
If
ResearchResult == No Reserach Structure
Then
Debug - Debug - Print String("Status", "no reserach structure")
General - Skip remaining actions
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
ResearchResult == Not enough resources
Then
Debug - Debug - Print String("Status", "not enough resources")
General - Skip remaining actions
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
ResearchResult == Queued or in progress
Then
Debug - Debug - Print String("Status", "queued or better")
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
ResearchResult == Completed
Then
Debug - Debug - Print String("Status", "completed")
Else
-------
------- Next "build order" can follow below this line
( The if clauses "no reserach structure" and "Not enough resources" will be combined and the other will be removed later. Here they are splitted for debug reasons. )
Function
Check and Order Research
Options: Function
Return Type: ENUM Research Status
Parameters
ResourceReserve = 0 <Integer>
ZergPlayer = 0 <Integer>
ResearchStructrure = No Game Link <Game Link - Unit>
Tech Order = No Ability Command <Ability Command>
Tech Upgrade = No Game Link <Game Link - Upgrade>
Grammar Text: Check and Order Research for Player ZergPlayer at any ResearchStructrure using Tech Order, Tech Upgrade and keep at least ResourceReserve of Gas and Minerals
Hint Text: (None)
Custom Script Code
Local Variables
ResourceReserve = ResourceReserve <Integer>
Tech Order = Tech Order <Ability Command>
iPlayer = ZergPlayer <Integer>
utResearchStructrureType = ResearchStructrure <Game Link - Unit>
Tech Upgrade = Tech Upgrade <Game Link - Upgrade>
uResearchStructrure = No Unit <Unit>
Actions
Variable - Set uResearchStructrure = (Random Living unit from (utResearchStructrureType units in (Entire map) owned by player iPlayer matching Excluded: Missile, Dead, Hidden, with at most Any Amount))
General - If (Conditions) then do (Actions) else do (Actions)
If
(Tech Upgrade count for player iPlayer, counting Complete) > 0
Then
General - Return Completed
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
Or
Conditions
(Tech Upgrade count for player iPlayer, counting In Progress) > 0
(Tech Upgrade count for player iPlayer, counting Queued) > 0
Then
General - Return Queued or in progress
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
uResearchStructrure == No Unit
Then
General - Return No Reserach Strcuture
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
(Player iPlayer Minerals) < (ResourceReserve + (Integer((Minerals cost of (Ability of Tech Order)))))
(Player iPlayer Vespene) < (ResourceReserve + (Integer((Gas cost of (Ability of Tech Order)))))
Then
General - Return Not enough resources
Else
Unit - Order uResearchStructrure to (Tech Order) (After Existing Orders)
General - Return Queued or in progress
Almost all parts are working. Only the resource check throws an error message.
Quote:
Trigger Error in 'gt_AdvancedZergTech_Func': Catalog field 'Cost.Minerals' could not be read (Core: a required object could not be found)
Trigger Error in 'gt_AdvancedZergTech_Func': Could not get 'str' from parameter in 'StringToFixed' (value: 0)
If the resources are available, the CPU player will already start the research. If the resouces are not available, it ignores the check tries to start the research. That fails without any response. And the function incorrectly returns Queued or in progress
Is there a way to inquire the resource costs of a research ability?
Any region ? No, this region is not predefined. So it can't checked this way. And I don't want to add a region in the terrain editor.
A loop ??? My actions consist only of 3 commands: One to debug, one unit group arithmetic and the last to stop this trigger forever and always. There is no need for any loop.
I could start a tigger from the beginning (map init) and than check every second, if the Overseer is within the region. General - Wait for (Conditions), checking every 1.0 Game Time seconds or I could fire a trigger every second and check if the Overseer is within the region. These would be loops. But than I would risk the event of the Overseer been killed between two checks.
I can't use a replaced region. The trigger should be independed on the map. I will try to use a check of all start locations. And if the overseer enters any of these, I will check if this start location is the reght destination.
Not quite happy with this. But until I found a better solution :/
Here is the working trigger:
Overseer has reached Startlocation
Events
Unit - Any Unit Enters within 5.0 of (Start location of player 0)
Unit - Any Unit Enters within 5.0 of (Start location of player 1)
[...]
Unit - Any Unit Enters within 5.0 of (Start location of player 15)
Local Variables
Conditions
((Triggering unit) is in (Region((Start location of player rec_AttackWave.iOverseerDestination_PlayerNum), 10.0))) == True
(Unit type of (Triggering unit)) == Overseer
Actions
Debug - Debug - Print Function Name(True, "Overseen has reached Startlocation")
Unit Group - Remove (Triggering unit) from rec_AttackWave.ugrpWave[(Owner of (Triggering unit))]
Trigger - Turn (Current trigger) Off
This seems not to be possible to use an event like this ...
Overseen has reached Startlocation
Events
Unit - Any Unit Enters (Region(rAttackWave.reg_OverseenDestination, 5.0))
Local Variables
Conditions
(Unit type of (Triggering unit)) == Overseer
Actions
Debug - Debug - Print Function Name(True, "Overseen has reached Startlocation")
Unit Group - Remove (Triggering unit) from rec_AttackWave.ugrpWave[(Owner of (Triggering unit))]
Trigger - Turn (Current trigger) Off
The point rAttackWave.reg_OverseenDestination is a start location of a randomly chosen opponent.
I know, there is not such event that does exactly cover this event. But how could it be substituted?
I am spawning in random point all over the map several nydus worms. As long as the worm is not spotted by the player it should send its squads to the center of the map and then to any base of the player. This should disguise the position of the worm for some time. After it is spotted it can send its troops directly to the destination point.
If a worm is killed it will respawn at a different position. Again hiding its troops path.
There is an event like this:
Unit - Any Unit Enters a distance of X from Unit
But this would fire too often.
There is also a condition of
((Triggering unit) is visible to player 1) == True
But the nydus worms do not trigger the event ... and on a larger map, there can be many worms be placed. Therefor I can not include this condition in the event check. I have to use the condition within an loop to test all worms. This condition does not cover ((Triggering unit) was visible to player 1) == True, does it?
Does the unit learn / research the upgrades, which is using the spell AND does each unit who wants to participate from the effects needs to learn / research the upgrades on its own?
This is a job for the specialize ability: Apply Behavior and Count Behavior completed at unit.
If only one unit needs to learn / research the upgrades to allow other units (same type or different), then your requirement has a small mistake
Greater then or equal too
upgrade count (dummy upgrade ability) completed at unit
I don't know the maximum number of stored units. If the respawn buildings are kept destroyed for a long time. It could be a queue of a few hundred units. I don't want to use data tables, because there would be a code overhead ... again. Also to pre-select the units to spawn, I am already using a reference table of single character codes. In case of the string variables I could keep this chunk without any changes.
But I have tested a bit the maximal manageable string length. It is something between 500000000 and 900000000 characters. May depend on the other used variables and map components. At this point I got :
Quote:
e_errorIdMemory
"Core: out of memory"
But soooooo many unit I do not need to store. Roughly calculated a game has to run 5 d 6 h before I get into the critical region ;)
P.S. You are right, text variables do not offer any needed operations. There is only a concat and a search replacement op available.
I am trying to clear my triggers out. Therefor I am looking for a easy to handle replacement of a very simple linked list. I though about using three parallel string or text variables: One for storing a reference to a unit type, the second for storing a reference for a position and the last for storing a reference a an respawn point in time.
It would look like this:
Index
0
1
2
3
4
...
Hint
string
unit type
A
B
E
B
C
...
~ 20 different types
"ABEBC..."
respawn position
8
3
2
1
3
...
~ 8 positions
"83213..."
respawn time
4
1
1
3
2
...
cycle is divided in 6 fragments
"41132..."
By using string, it would be easy to search for a unit at a specific respawn time event. I could delete entries in the middle and add new entries at the end.
The problem is: Maybe sometimes there could amass several units before it is possible to empty the queue. Is there a (low) limit for the length of strings / text variables?
Instead of the sum (Hatchery+Lair+Hive) there is the possibility to use an alias. "CountUnit(Alias_Lair,CompleteOnly) ". The aliases (?) can not be selected with the drop down menus.
You have to create an empty mod (File>New>Document Type>Mod). There activate the dependencies you have used for your map and than .... copy and paste from your map all data stuff to your new mod.
Method 1
This is done best by using the XML view of the data. Check the overview manager to not miss any category. While you are coping you have to keep in mind a few things:
Do not save during the coping! Some cross references might by get lost. (Therefor check the overview manager)
In large XML files (eg Units or Actors - depends on your changes) you are limited to 65K characters in one clipboard paste. These large files can not be copied with a single c&p.
The text (buttons and editor descriptions) are not stored in the XML files. For these you should use a different method see below.
Method 2
I don't know, if this can be used for the XML stuff. But for the text files, I recommend this one.
Open your map and save it as a component list.
Open you mod and save it as a component list, too.
Close both files.
Copy from the new created directories the needed files from your map to your mod.
The 3 text files are in the folders xxXX.SC2Data \ LocalizedData
I would like to enlarge the very small number of the ammunition counter. Therefor I thought about creating a set of dummy abilities with requirements to show / not show the buttons. These buttons without any functionality would present the actual amount of the ammunition.
The push priority concerns only the own units and allied units ( if the alliance aspect pushable is turned on ). For eneny units (or allied without the pushable aspect of the alliance) you need the force field effect like you have mentioned it.
0
I have made several new upgrades via the data editor. Now I am trying to teach the standard AI how to use them. The upgrades are mostly improvements for unit stats or can be used with auto cast turned on. So there is no need to micro new abilities. I only need to order the AI to research the upgrades.
What I have done so far.
Preset definition
Trigger
( The if clauses "no reserach structure" and "Not enough resources" will be combined and the other will be removed later. Here they are splitted for debug reasons. )
Function
Almost all parts are working. Only the resource check throws an error message.
If the resources are available, the CPU player will already start the research. If the resouces are not available, it ignores the check tries to start the research. That fails without any response. And the function incorrectly returns Queued or in progress
Is there a way to inquire the resource costs of a research ability?
0
@BasharTeg: Go
Any region ? No, this region is not predefined. So it can't checked this way. And I don't want to add a region in the terrain editor.
A loop ??? My actions consist only of 3 commands: One to debug, one unit group arithmetic and the last to stop this trigger forever and always. There is no need for any loop.
I could start a tigger from the beginning (map init) and than check every second, if the Overseer is within the region.
General - Wait for (Conditions), checking every 1.0 Game Time seconds
or I could fire a trigger every second and check if the Overseer is within the region. These would be loops. But than I would risk the event of the Overseer been killed between two checks.@Kueken531: Go
I am lucky that this trigger is only used within the first minutes of the game. My solution (better workaround) fires now really often.
Btw my "rect" (Region(rAttackWave.reg_OverseenDestination, 5.0)) is quite round for a reactangle ;)
0
@zorbotron: Go
I can't use a replaced region. The trigger should be independed on the map. I will try to use a check of all start locations. And if the overseer enters any of these, I will check if this start location is the reght destination.
Not quite happy with this. But until I found a better solution :/
Here is the working trigger:
0
This seems not to be possible to use an event like this ...
The point
rAttackWave.reg_OverseenDestination
is a start location of a randomly chosen opponent.0
@TheAlmaity: Go
Thanks, I will try that. I hope, this does not cost to much performance ... to check every few seconds every worm vs every human player ;)
0
I know, there is not such event that does exactly cover this event. But how could it be substituted?
I am spawning in random point all over the map several nydus worms. As long as the worm is not spotted by the player it should send its squads to the center of the map and then to any base of the player. This should disguise the position of the worm for some time. After it is spotted it can send its troops directly to the destination point.
If a worm is killed it will respawn at a different position. Again hiding its troops path.
There is an event like this:
But this would fire too often.
There is also a condition of
But the nydus worms do not trigger the event ... and on a larger map, there can be many worms be placed. Therefor I can not include this condition in the event check. I have to use the condition within an loop to test all worms. This condition does not cover
((Triggering unit) was visible to player 1) == True
, does it?0
@Ranakastrasz: Go
0
@Selfcreation: Go
Does the unit learn / research the upgrades, which is using the spell AND does each unit who wants to participate from the effects needs to learn / research the upgrades on its own?
This is a job for the specialize ability: Apply Behavior and Count Behavior completed at unit.
If only one unit needs to learn / research the upgrades to allow other units (same type or different), then your requirement has a small mistake
ability) completedat unit0
@Kueken531: Go
I don't know the maximum number of stored units. If the respawn buildings are kept destroyed for a long time. It could be a queue of a few hundred units. I don't want to use data tables, because there would be a code overhead ... again. Also to pre-select the units to spawn, I am already using a reference table of single character codes. In case of the string variables I could keep this chunk without any changes.
But I have tested a bit the maximal manageable string length. It is something between 500000000 and 900000000 characters. May depend on the other used variables and map components. At this point I got :
But soooooo many unit I do not need to store. Roughly calculated a game has to run 5 d 6 h before I get into the critical region ;)
P.S. You are right, text variables do not offer any needed operations. There is only a concat and a search replacement op available.
0
I am trying to clear my triggers out. Therefor I am looking for a easy to handle replacement of a very simple linked list. I though about using three parallel string or text variables: One for storing a reference to a unit type, the second for storing a reference for a position and the last for storing a reference a an respawn point in time.
It would look like this:
By using string, it would be easy to search for a unit at a specific respawn time event. I could delete entries in the middle and add new entries at the end.
The problem is: Maybe sometimes there could amass several units before it is possible to empty the queue. Is there a (low) limit for the length of strings / text variables?
0
Try this one ...
CountUnit(SpawningPool,CompleteOnly)[TechTreeCheat] && (CountUnit(Queen,QueuedOrBetter) + CountUnit(QueenBurrowed,QueuedOrBetter)) < {Only 1 Queen per town}(CountUnit(Hatchery,CompleteOnly) + CountUnit(Lair,CompleteOnly) + CountUnit(Hive,CompleteOnly))
Instead of the sum (Hatchery+Lair+Hive) there is the possibility to use an alias. "
CountUnit(Alias_Lair,CompleteOnly)
". The aliases (?) can not be selected with the drop down menus.CountUnit(SpawningPool,CompleteOnly)[TechTreeCheat] && (CountUnit(Queen,QueuedOrBetter) + CountUnit(QueenBurrowed,QueuedOrBetter)) < {Only 1 Queen per town}
CountUnit(Alias_Lair,CompleteOnly))
0
@LongLivetheTalDarim: Go
You have to create an empty mod (File>New>Document Type>Mod). There activate the dependencies you have used for your map and than .... copy and paste from your map all data stuff to your new mod.
Method 1
This is done best by using the XML view of the data. Check the overview manager to not miss any category. While you are coping you have to keep in mind a few things:
Method 2
I don't know, if this can be used for the XML stuff. But for the text files, I recommend this one.
Happy copying !
0
This is possible?
I would like to enlarge the very small number of the ammunition counter. Therefor I thought about creating a set of dummy abilities with requirements to show / not show the buttons. These buttons without any functionality would present the actual amount of the ammunition.
But maybe there is a much easier way.
0
@Kueken531: Go
Hm, maybe I have mixed something up, sorry.
0
@Selfcreation: Go
The push priority concerns only the own units and allied units ( if the alliance aspect pushable is turned on ). For eneny units (or allied without the pushable aspect of the alliance) you need the force field effect like you have mentioned it.