• 0

    posted a message on [Library][Galaxy] XP Utility Library

    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" effect
    const string c_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.
    int GetXPNeededForLevel(int level)
    {
        return (level * (level + 1)) * 50;
    }
     
    void HeroAddXP(unit target, int amount)
    {
        int player = UnitGetOwner(target);
        CatalogFieldValueSet(c_gameCatalogEffect, c_xp_abil, "XP", player, IntToString(amount));
        PlayerCreateEffectUnit(player, c_xp_abil, target);
    }
     
    int HeroGetRequiredXP(unit target, int level)
    {
        int curXP = FixedToInt(UnitXPTotal(target));
        return GetXPNeededForLevel(level) - curXP;
    }
     
    int HeroGetRequiredXPForNextLevel(unit target)
    {
        return HeroGetRequiredXP(target, UnitLevel(target) + 1);
    }
     
    void HeroSetLevel(unit target, int level)
    {
        // Xp is applied 2 times to avoid interface bugs
        int xpNeeded = HeroGetRequiredXP(target, level - 1);
     
        if(xpNeeded > 0)
        {
            HeroAddXP(target, xpNeeded);
        }
     
        HeroAddXP(target, HeroGetRequiredXP(target, level));
    }
     
    void HeroLevelUp(unit target, int numLevels)
    {
        HeroSetLevel(target, UnitLevel(target) + numLevels);
    }
    
    Posted in: Trigger Libraries & Scripts
  • 0

    posted a message on is this possible

    @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).

    Posted in: Galaxy Scripting
  • 0

    posted a message on [Data] Upgrades Applying It Single Units

    @TheRupturedD:

    If you just want one turret to upgrade, try using morph abilities or behavior adding triggers/abilities.  Upgrades are always universal.

    Posted in: Miscellaneous Development
  • 0

    posted a message on quick question about arrays

    @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.

    Posted in: Miscellaneous Development
  • 0

    posted a message on 8-way Anti-blocking System?

    @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).

    Posted in: Miscellaneous Development
  • 0

    posted a message on 8-way Anti-blocking System?

    @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.

    Posted in: Miscellaneous Development
  • 0

    posted a message on 8-way Anti-blocking System?

    @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.

    Posted in: Miscellaneous Development
  • 0

    posted a message on help with an echo command
    Echo
        Events
            Game - Player Any Player types a chat message containing "!echo", matching Partially
        Local Variables
            StoredMessage = "" <String>
        Conditions
            (Substring((Entered chat string), 1, 5)) == "!echo"
        Actions
            Variable - Set StoredMessage = ((Entered chat string) with up to 1 "!echo" replaced by "" (Sensitive to case))
            UI - Display (Text(StoredMessage)) for (All players) to Subtitle area
    
    Posted in: Galaxy Scripting
  • 0

    posted a message on 8-way Anti-blocking System?

    @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.

    Posted in: Miscellaneous Development
  • 0

    posted a message on 8-way Anti-blocking System?

    @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.

    Posted in: Miscellaneous Development
  • 0

    posted a message on 8-way Anti-blocking System?

    @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).

    • edit* NVM - It seems to only work with one lane (and not always). It may take a bit longer than I thought.
    Posted in: Miscellaneous Development
  • 0

    posted a message on 8-way Anti-blocking System?

    @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.

    Posted in: Miscellaneous Development
  • 0

    posted a message on how would I get at the ability actors from a "Any Unit uses" event?

    @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.

    Posted in: Miscellaneous Development
  • 0

    posted a message on 8-way Anti-blocking System?

    @ST4RKiLL3R: Go

    Do you mean, anti-block as in blocking with buildings? If so, have you considered making the road have [No Building] pathing.

    Posted in: Miscellaneous Development
  • 0

    posted a message on Storing unit in a variable

    @PiercingGoblin: Go

    Don't know if this is exactly what you wanted, but here is a demo map.

    • Note* The map now works for each player.
    Posted in: Miscellaneous Development
  • To post a comment, please or register a new account.