I'm trying to allow and disallow unit upgrades via triggers. At first it seemed easy. Just by adding the action "Tech tree - Disable tech tree requirements" all unit upgrades (Blink, StimPack, etc.) became available. But certain upgrades were not applied, the speed upgrade for the Reaper, for example. I checked several threads here in the forums and learned that there's more to unit upgrades than I previously thought. And it seems to be quite complicated...
So, could someone please explain to me how unit abilities are defined within the data editor? I got the impression there's a lot of cross-referencing and checking of certain requirements going on, and I just can't wrap my head around it...
So, let's say I want to buff my marines with the shield upgrade. When triggering the "Tech tree - Disable tech tree requirements" action all newly spawned marines will carry a shield, but their hit points will not have increased. However, if I research that upgrade via TechLab, it works as it's supposed to. I guess that upgrade requires some kind of condition that is not fullfilled just by the action mentioned above. What am I missing here?
If you want to do unit upgrades in the data editor, you need a couple of things:
For each upgrade, you want
- A button (defines the icon and tooltip for the research)
- An upgrade (look in the upgrade tab of the data editor)
- A requirement (determines if the button can be clicked/is showed)
And to tie it together
- The unit where you learn the upgrades
- An ability of type Research
For the upgrade, there is a field called effects. Here you set what will happen when the upgrade is researched. You can change pretty much every field for units/actors/abilities/effects.. etc. For example, this is where you increase the health of your units if that is what you want the upgrade to do.
The interesting field for requirements are the Requirements+ field. You can set conditions for when the button should be showed, and when it should be useable (versus grayed out). Typically u want something like Equals(Count upgrade queued or better, Constant 0) under show, so the upgrade can only be researched once.
In the research ability, you want to look at Ability - Info+. This is a list of all the researches under this ability. To add an upgrade here, you will atleast want to add a default button, and the upgrade. You might also want to specify a requirement, rescource cost and time.
If u just wanna use triggers for upgrades, you can use the CatalogFieldValueSet function to change fields in the data editor from triggers, such as the health of marines.
It's similar to http://www.sc2mapster.com/api-docs/functions/catalog-field-value-get/
In the last parameter you just add the value you want to set (as a string)
In the end, I would like to simulate the in-game effect (i.e. what happens when the shield upgrade is done being researched) just by the press of a button.
Once I'm back home, I'll dig deeper into the data editor and try to understand, what you've explained above. I'll let you know how it worked out. But be prepared for a pile of questions. ^_^
Similar to setting armor and damage upgrades, talents and spells can be activated by this action, too. By setting the talent "Marine - Combat Shield" to upgrade level "1", all marines now have the correct model AND the correct amount of HP. The devil is in the details...
Never the less, I actually did spend some time with the data editor and I think I now have a pretty good idea of how upgrades work. But there are still some little things I'm not 100% sure of. For example: Again the Marine Shield. There is no ability connected to this upgrade. Why is that? Because it's not really an ability that can be used (like StimPack) but more of a stat buff? And likewise, the Marine Shield does not have a requirement either. Is that because requirements can only be set for abilities?
I have another question concerning the "CatalogFieldValueSet" function. Does this function have to implemented by actually writing code? While I found the function in the trigger editor I was not able to find appopriate presets or functions for the "Entry" and "Field Patch" parameters.
The marine shield upgrade does have the points I mentioned above.
First of all, there is an ability of type research, its called "Tech Lab Research (Barracks)". If you look under Ability - info+ and then the second upgrade, you find the shield upgrade. It has a requirement "Learn Shield Wall", which prevents you from researching it more then once. Also, there is an upgrade, "Marine - Combat Shield". Under the Upgrade - Effects+ field of the upgrade you can see that it adds 10 health to marines.
If you are wondering how the marine know that he should be wearing a shield, you need to look at the actor for the marine - it's just called "Marine". Under the Event - Events+ field, you see some events that change some animations when the upgrade is researched - Im not entirely sure how that works, it looks like the actor must be playing multiple animations at the same time when the marine has no shields. If you look in the previewer, the animation that is being played while the shield isn't researched is an animation where the marine has no shield though, and he has one at all the other animations, so I'm pretty sure this is where the magic happens.
As for the CatalogFieldValueSet function.. Lets take an example - say I want to make the marine hit for an extra 5 damage vs light targets.
Then I need to edit the damage effect for the marine, so the first parameter will be c_gameCatalogEffect. The second parmeter is the identifier of the damage effect (the "Marine - Gauss Rifle (Damage)" effect). If you double click on that effect, you see the field ID, so the second parameter is "Marine".
The thrid parameter is the name of the field we want to edit. If you don't know the name of the field, you can change it to something other then the default - lets change it to 5. Then save the map and open it with an MPQ editor. You then look for the file Base.SC2Data/GameData/EffectData.xml This file contains a list of the custom settings you have made in the effect tab of the data editor. Look for <CEffectDamage id="Marine">, here we find a line called <AttributeBonus index="Light" value="5"/>, this means that our 3rd parameter becoms "AttributeBonus[Light]". The 4th parameter is the player you want to change this for, and the last parameter is our value, 5 as a string, so "5".
CatalogFieldValueSet(c_gameCatalogEffect, "Marine", "AttributeBonus[Light]", 1, "5");
or in gui: Catalog - Set value of Effects "Marine" "AttributeBonus[Light]" for player 1 to "5"
The marine shield upgrade does have the points I mentioned above.
First of all, there is an ability of type research, its called "Tech Lab Research (Barracks)". If you look under Ability - info+ and then the second upgrade, you find the shield upgrade. It has a requirement "Learn Shield Wall", which prevents you from researching it more then once. Also, there is an upgrade, "Marine - Combat Shield". Under the Upgrade - Effects+ field of the upgrade you can see that it adds 10 health to marines.
Ok, I found it. I was looking for an actual ability called "Combat Shiled". I didn't know that it's part of the TechLab(Barracks) ability. Looks like that's how things work with all the upgrades that do not give units a clickable button. Similar to the Combat Shield, the Zergling upgrades for speed and attack speed are part of the spawning pool research ability. I see, I see...
Quote:
As for the CatalogFieldValueSet function.. Lets take an example - say I want to make the marine hit for an extra 5 damage vs light targets.
Then I need to edit the damage effect for the marine, so the first parameter will be c_gameCatalogEffect. The second parmeter is the identifier of the damage effect (the "Marine - Gauss Rifle (Damage)" effect). If you double click on that effect, you see the field ID, so the second parameter is "Marine".
The thrid parameter is the name of the field we want to edit. If you don't know the name of the field, you can change it to something other then the default - lets change it to 5. Then save the map and open it with an MPQ editor. You then look for the file Base.SC2Data/GameData/EffectData.xml This file contains a list of the custom settings you have made in the effect tab of the data editor. Look for <CEffectDamage id="Marine">, here we find a line called <AttributeBonus index="Light" value="5"/>, this means that our 3rd parameter becoms "AttributeBonus[Light]". The 4th parameter is the player you want to change this for, and the last parameter is our value, 5 as a string, so "5".
CatalogFieldValueSet(c_gameCatalogEffect, "Marine", "AttributeBonus[Light]", 1, "5");
or in gui: Catalog - Set value of Effects "Marine" "AttributeBonus[Light]" for player 1 to "5"
Great step-by-step guide. Can't get any clearer than that.
Once again, thanks for taking the time. Really appreciated! : )
Cheers!
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hi everybody,
I'm trying to allow and disallow unit upgrades via triggers. At first it seemed easy. Just by adding the action "Tech tree - Disable tech tree requirements" all unit upgrades (Blink, StimPack, etc.) became available. But certain upgrades were not applied, the speed upgrade for the Reaper, for example. I checked several threads here in the forums and learned that there's more to unit upgrades than I previously thought. And it seems to be quite complicated...
So, could someone please explain to me how unit abilities are defined within the data editor? I got the impression there's a lot of cross-referencing and checking of certain requirements going on, and I just can't wrap my head around it...
So, let's say I want to buff my marines with the shield upgrade. When triggering the "Tech tree - Disable tech tree requirements" action all newly spawned marines will carry a shield, but their hit points will not have increased. However, if I research that upgrade via TechLab, it works as it's supposed to. I guess that upgrade requires some kind of condition that is not fullfilled just by the action mentioned above. What am I missing here?
Cheers and thx for your help! ^_^
If you want to do unit upgrades in the data editor, you need a couple of things:
For each upgrade, you want
- A button (defines the icon and tooltip for the research)
- An upgrade (look in the upgrade tab of the data editor)
- A requirement (determines if the button can be clicked/is showed)
And to tie it together
- The unit where you learn the upgrades
- An ability of type Research
For the upgrade, there is a field called effects. Here you set what will happen when the upgrade is researched. You can change pretty much every field for units/actors/abilities/effects.. etc. For example, this is where you increase the health of your units if that is what you want the upgrade to do.
The interesting field for requirements are the Requirements+ field. You can set conditions for when the button should be showed, and when it should be useable (versus grayed out). Typically u want something like Equals(Count upgrade queued or better, Constant 0) under show, so the upgrade can only be researched once.
In the research ability, you want to look at Ability - Info+. This is a list of all the researches under this ability. To add an upgrade here, you will atleast want to add a default button, and the upgrade. You might also want to specify a requirement, rescource cost and time.
If u just wanna use triggers for upgrades, you can use the CatalogFieldValueSet function to change fields in the data editor from triggers, such as the health of marines.
It's similar to http://www.sc2mapster.com/api-docs/functions/catalog-field-value-get/
In the last parameter you just add the value you want to set (as a string)
This was helpful to me as well.. thanks
Hi SBeier,
thanks for your elaborate reply.
In the end, I would like to simulate the in-game effect (i.e. what happens when the shield upgrade is done being researched) just by the press of a button.
Once I'm back home, I'll dig deeper into the data editor and try to understand, what you've explained above. I'll let you know how it worked out. But be prepared for a pile of questions. ^_^
Cheers!
D'oh...I found what I was looking for...
Similar to setting armor and damage upgrades, talents and spells can be activated by this action, too. By setting the talent "Marine - Combat Shield" to upgrade level "1", all marines now have the correct model AND the correct amount of HP. The devil is in the details...
Never the less, I actually did spend some time with the data editor and I think I now have a pretty good idea of how upgrades work. But there are still some little things I'm not 100% sure of. For example: Again the Marine Shield. There is no ability connected to this upgrade. Why is that? Because it's not really an ability that can be used (like StimPack) but more of a stat buff? And likewise, the Marine Shield does not have a requirement either. Is that because requirements can only be set for abilities?
I have another question concerning the "CatalogFieldValueSet" function. Does this function have to implemented by actually writing code? While I found the function in the trigger editor I was not able to find appopriate presets or functions for the "Entry" and "Field Patch" parameters.
Cheers and thanks again for taking the time! ^_^
The marine shield upgrade does have the points I mentioned above.
First of all, there is an ability of type research, its called "Tech Lab Research (Barracks)". If you look under Ability - info+ and then the second upgrade, you find the shield upgrade. It has a requirement "Learn Shield Wall", which prevents you from researching it more then once. Also, there is an upgrade, "Marine - Combat Shield". Under the Upgrade - Effects+ field of the upgrade you can see that it adds 10 health to marines.
If you are wondering how the marine know that he should be wearing a shield, you need to look at the actor for the marine - it's just called "Marine". Under the Event - Events+ field, you see some events that change some animations when the upgrade is researched - Im not entirely sure how that works, it looks like the actor must be playing multiple animations at the same time when the marine has no shields. If you look in the previewer, the animation that is being played while the shield isn't researched is an animation where the marine has no shield though, and he has one at all the other animations, so I'm pretty sure this is where the magic happens.
As for the CatalogFieldValueSet function.. Lets take an example - say I want to make the marine hit for an extra 5 damage vs light targets.
Then I need to edit the damage effect for the marine, so the first parameter will be c_gameCatalogEffect. The second parmeter is the identifier of the damage effect (the "Marine - Gauss Rifle (Damage)" effect). If you double click on that effect, you see the field ID, so the second parameter is "Marine".
The thrid parameter is the name of the field we want to edit. If you don't know the name of the field, you can change it to something other then the default - lets change it to 5. Then save the map and open it with an MPQ editor. You then look for the file Base.SC2Data/GameData/EffectData.xml This file contains a list of the custom settings you have made in the effect tab of the data editor. Look for <CEffectDamage id="Marine">, here we find a line called <AttributeBonus index="Light" value="5"/>, this means that our 3rd parameter becoms "AttributeBonus[Light]". The 4th parameter is the player you want to change this for, and the last parameter is our value, 5 as a string, so "5".
CatalogFieldValueSet(c_gameCatalogEffect, "Marine", "AttributeBonus[Light]", 1, "5");
or in gui: Catalog - Set value of Effects "Marine" "AttributeBonus[Light]" for player 1 to "5"
Ok, I found it. I was looking for an actual ability called "Combat Shiled". I didn't know that it's part of the TechLab(Barracks) ability. Looks like that's how things work with all the upgrades that do not give units a clickable button. Similar to the Combat Shield, the Zergling upgrades for speed and attack speed are part of the spawning pool research ability. I see, I see...
Great step-by-step guide. Can't get any clearer than that.
Once again, thanks for taking the time. Really appreciated! : )
Cheers!