Here is a very small galaxy library for messing around with experience and levels. I'll get around to GUIing and making an actual library and test map later.
// *Notes* // - You must create a dummy ability of type "Modify Unit" for these triggers to work.// - This assumes you have your veterancy ability using levels at xp amounts that can be defined by a formula (which you can change).// - It is possible to gain multiple levels at once using these triggers.// - If multiple levels are gained, triggers of type TriggerAddEventUnitGainLevel will only fire one time (not once per level)!// Change this to a defualt "Modify Unit" effectconststringc_xp_abil="AddXP";// Change this to match your xp leveling formula// This one generates the following values:// Level 1 - 100xp, Level 2 - 300xp, Level 3 - 600xp, Level 4 - 1000xp, Level 5 - 1500xp, etc.intGetXPNeededForLevel(intlevel){return(level*(level+1))*50;}voidHeroAddXP(unittarget,intamount){intplayer=UnitGetOwner(target);CatalogFieldValueSet(c_gameCatalogEffect,c_xp_abil,"XP",player,IntToString(amount));PlayerCreateEffectUnit(player,c_xp_abil,target);}intHeroGetRequiredXP(unittarget,intlevel){intcurXP=FixedToInt(UnitXPTotal(target));returnGetXPNeededForLevel(level)-curXP;}intHeroGetRequiredXPForNextLevel(unittarget){returnHeroGetRequiredXP(target,UnitLevel(target)+1);}voidHeroSetLevel(unittarget,intlevel){// Xp is applied 2 times to avoid interface bugsintxpNeeded=HeroGetRequiredXP(target,level-1);if(xpNeeded>0){HeroAddXP(target,xpNeeded);}HeroAddXP(target,HeroGetRequiredXP(target,level));}voidHeroLevelUp(unittarget,intnumLevels){HeroSetLevel(target,UnitLevel(target)+numLevels);}
I do not think it is possible to change the actual command card in game. As fr0d0b0ls0n has stated validators and having all abilities on the card at the start can work if you can fit within these constraints. This was not possible for the map I was working on however due to the 32 ability limit (I have 77 abilities for 10 command card slots). How I got around it was to give each command card slot 2 dummy abilities (an instant and a a targeted) then alter the catalog associated with the dummy abilities and their associated buttons. Then, I triggered each dummy ability so when they are fired the appropriate effect is created. The only thing I was not able to easily change was the icon for each button, so I made a custom UI dialog as an overlay on the command card that displays the icons. The downside with using this approach is that the command card changes are applied to all units using the dummy abilities owned by the same player (because the catalog is altered). Oh, and the icon overlay stays visible when using a targeting ability.
Long story short - No it's not possible. But you can make it look like it is (with about a couple hundred lines of script).
Arrays are indeed different in sc2. You must set them to the size you wish to use or you'll get an underflow/overflow error. Also, arrays start indexing at 0 not 1.
While that code will work for most general purpose uses, it has some idiosyncrasies that could pose as problems when you are purposefully blocking off areas of the map for a split-second. Also, there's a built-in AI function that can calculate how long a particular unit will take to travel a path (and can detect blocked paths).
Yeah, it is kind of hard to follow, if you have any specific questions regarding the map feel free to ask them. And remember, nothing is impossible with the galaxy editor as long as you can come up with horribly convoluted solutions to seemingly easy problems.
Basically, whenever you place a building it checks to see if a path from one point to another is possible depending on the region where you placed the building. If there is no possible path, it removes the newly created building (in production code, you might want to display a message and refund costs also). To make sure that the long way around is not checked for pathing, it is blocked using "invisible" blocker units temporarily. The downside to the system is that you have to set up a TON of variables for temporary blocking units in order to get the blocked off paths working correctly. The positions of these temporary blockers are stored in a multi-dimensional array which is used as a lookup to create each region specific temporary blocker. Oh, and pathing is checked using an unclickable unselectable unit at each spawn point. Make sure you look at each of the custom units in the data editor, because some of their properties are important.
Well now I feel like an idiot. I just figured out that by putting the ignore placement option on the create unit script it ignores units and stuff. Well, now it should be 100% reliable.
Well, it's still not that reliable... but it kind of works. The main problem is disabling the pathing of each alternate route before checking for blocks. To do this, the map spawns blocking apples (I made them apples so you can see them). The problem is, if there is a unit where a blocking apple needs to be, the path blocking will fail. I think this kind of system can be used with success... if the blocker positions are strategically placed. If blizzard decides to actually implement the scripting path manipulators (which currently exist in custom script form but do nothing), it would make everything super simple.
Now that's a hard one, I'll have to think about it for a bit.
Update: So far, I have it so it anti-blocks in one direction, but I still cant figure out how to prevent units from going the long way around. Normal methods are currently not working, time to try some hacky ideas.
If I'm not mistaken, I believe that the game links from actor->ability not ability->actor. And even then, I think that they are usually linked to ability effects, not the ability itself. This fact should make it suitably hard (if not impossible) to retrieve the data you want using scripting. I might be able to help you if you could tell me exactly what you are trying to accomplish.
0
Here is a very small galaxy library for messing around with experience and levels. I'll get around to GUIing and making an actual library and test map later.
0
@xrit:
I do not think it is possible to change the actual command card in game. As fr0d0b0ls0n has stated validators and having all abilities on the card at the start can work if you can fit within these constraints. This was not possible for the map I was working on however due to the 32 ability limit (I have 77 abilities for 10 command card slots). How I got around it was to give each command card slot 2 dummy abilities (an instant and a a targeted) then alter the catalog associated with the dummy abilities and their associated buttons. Then, I triggered each dummy ability so when they are fired the appropriate effect is created. The only thing I was not able to easily change was the icon for each button, so I made a custom UI dialog as an overlay on the command card that displays the icons. The downside with using this approach is that the command card changes are applied to all units using the dummy abilities owned by the same player (because the catalog is altered). Oh, and the icon overlay stays visible when using a targeting ability.
Long story short - No it's not possible. But you can make it look like it is (with about a couple hundred lines of script).
0
@TheRupturedD:
If you just want one turret to upgrade, try using morph abilities or behavior adding triggers/abilities. Upgrades are always universal.
0
@HatsuneMikuMegurine:
Arrays are indeed different in sc2. You must set them to the size you wish to use or you'll get an underflow/overflow error. Also, arrays start indexing at 0 not 1.
0
@DarkFireDragoon: Go
While that code will work for most general purpose uses, it has some idiosyncrasies that could pose as problems when you are purposefully blocking off areas of the map for a split-second. Also, there's a built-in AI function that can calculate how long a particular unit will take to travel a path (and can detect blocked paths).
0
@ST4RKiLL3R: Go
Yeah, it is kind of hard to follow, if you have any specific questions regarding the map feel free to ask them. And remember, nothing is impossible with the galaxy editor as long as you can come up with horribly convoluted solutions to seemingly easy problems.
0
@ST4RKiLL3R: Go
Basically, whenever you place a building it checks to see if a path from one point to another is possible depending on the region where you placed the building. If there is no possible path, it removes the newly created building (in production code, you might want to display a message and refund costs also). To make sure that the long way around is not checked for pathing, it is blocked using "invisible" blocker units temporarily. The downside to the system is that you have to set up a TON of variables for temporary blocking units in order to get the blocked off paths working correctly. The positions of these temporary blockers are stored in a multi-dimensional array which is used as a lookup to create each region specific temporary blocker. Oh, and pathing is checked using an unclickable unselectable unit at each spawn point. Make sure you look at each of the custom units in the data editor, because some of their properties are important.
0
0
@ST4RKiLL3R: Go
Well now I feel like an idiot. I just figured out that by putting the ignore placement option on the create unit script it ignores units and stuff. Well, now it should be 100% reliable.
0
@ST4RKiLL3R: Go
Well, it's still not that reliable... but it kind of works. The main problem is disabling the pathing of each alternate route before checking for blocks. To do this, the map spawns blocking apples (I made them apples so you can see them). The problem is, if there is a unit where a blocking apple needs to be, the path blocking will fail. I think this kind of system can be used with success... if the blocker positions are strategically placed. If blizzard decides to actually implement the scripting path manipulators (which currently exist in custom script form but do nothing), it would make everything super simple.
0
@ST4RKiLL3R: Go
Mwahahaha, got it (its kind of a pain in the butt). Uploading the map in an hour of so (I need to make it more understandable).
0
@ST4RKiLL3R: Go
Now that's a hard one, I'll have to think about it for a bit.
Update: So far, I have it so it anti-blocks in one direction, but I still cant figure out how to prevent units from going the long way around. Normal methods are currently not working, time to try some hacky ideas.
0
@waterfoul: Go
If I'm not mistaken, I believe that the game links from actor->ability not ability->actor. And even then, I think that they are usually linked to ability effects, not the ability itself. This fact should make it suitably hard (if not impossible) to retrieve the data you want using scripting. I might be able to help you if you could tell me exactly what you are trying to accomplish.
0
@ST4RKiLL3R: Go
Do you mean, anti-block as in blocking with buildings? If so, have you considered making the road have [No Building] pathing.
0
@PiercingGoblin: Go
Don't know if this is exactly what you wanted, but here is a demo map.