• 0

    posted a message on New natives in patch 1.3

    Additions:

    // Camera data used for default camera motion and parameters
    native void         CameraSetData (playergroup players, string cameraId);
    
    // Catalogs
    native bool CatalogEntryIsDefault (int catalog, string entry);
    native int CatalogFieldValueGetAsInt (int catalog, string entry, string fieldPath, int player);
    
    //--------------------------------------------------------------------------------------------------
    //  Note: The LinkReplace API does not actually search & replace all catalog fields.
    //  It saves the replacement in a separate table so that code setup to handle being replaced can
    //  do the replacement where necessary.
    //--------------------------------------------------------------------------------------------------
    native void CatalogLinkReplace (int player, int catalog, string idA, string idB);
    native string CatalogLinkReplacement (int player, int catalog, string id);
    
    native void     GameSetSeed (int value);
    
    // Player states
    const int c_playerStateChargesPaused        = 9;
    const int c_playerStateCooldownsPaused      = 10;
    const int c_playerStateMineralCostIgnored   = 11;
    const int c_playerStateVespeneCostIgnored   = 12;
    const int c_playerStateTerrazineCostIgnored = 13;
    const int c_playerStateCustomCostIgnored    = 14;
    const int c_playerStateDisplayGameResult    = 15;
    
    // StringExternal looks up the given string identifer in the externalized string table
    native text     StringExternalHotkey (string s);
    native text     StringExternalAsset (string s);
    
    // Unit attributes
    const int c_unitAttributeNone           = -1;  //  Base Damage.
    const int c_unitAttributeShielded       = -2;  //  Damage vs. Shielded Units.
    
    // Unit states
    const int c_unitStateDetectable         = 29;
    const int c_unitStateRadarable          = 30;
    
    // Unit properties
    const int c_unitPropLifeArmor           = 35; // Read-only
    const int c_unitPropShieldArmor         = 36; // Read-only
    
    native unit     UnitAddOnChild (unit inUnit, int inIndex);
    native unit     UnitAddOnParent (unit inUnit);
    
    // behavior buff flags
    const int c_unitBehaviorFlagRefreshStack        = 9;
    
    // Unit weapons
    native fixed        UnitWeaponDamage (unit inUnit, int inIndex, int inAttribute, bool inMaximum);
    native fixed        UnitWeaponSpeedMultiplier (unit inUnit, int inIndex);
    
    // Local Selection Types
    const int c_localSelectionTypeUnknown         = -1;
    const int c_localSelectionTypeControlGroup    = 0;
    const int c_localSelectionTypeIdleButton      = 1;
    const int c_localSelectionTypePylonButton     = 2;
    const int c_localSelectionTypeSelectLarva     = 3;
    const int c_localSelectionTypeSelectBuilder   = 4;
    const int c_localSelectionTypeAlert           = 5;
    const int c_localSelectionTypeHeroPanel       = 6;
    const int c_localSelectionTypeInfoPanel       = 7;
    const int c_localSelectionTypeWorldPanel      = 8;
            
    native void         UIStatusBarOverride (playergroup inPlayers, int group);
    native void         UIStatusBarClearOverride (playergroup inPlayers);
    
    native void         UISetResourceVisible (playergroup inPlayers, int inResource, bool inVisible);
    
    native void         UISetSelectionTypeEnabled (playergroup inPlayers, int inSelectionType, bool inEnabled);
    
    // Unit flags
    const int c_unitFlagShareControl = 53;
    

    Changes to existing presets:

    // Camera movement events
    const int c_cameraMoveReasonAny             = -1;
    const int c_cameraMoveReasonAlert           = 0;
    const int c_cameraMoveReasonIdleWorker      = 1;
    const int c_cameraMoveReasonKeyScroll       = 2;
    const int c_cameraMoveReasonMinimap         = 3;
    const int c_cameraMoveReasonMouseScroll     = 4;
    const int c_cameraMoveReasonSelection       = 5;
    const int c_cameraMoveReasonTown            = 6;
    const int c_cameraMoveReasonView            = 7;
    const int c_cameraMoveReasonZoom            = 8;
    
    // Players
    const int c_maxPlayers = 16;
    
    // Behavior info flags
    const int c_unitBehaviorFlagHidden              = 10;
    
    Posted in: Galaxy Scripting
  • 0

    posted a message on Fun with Catalogs

    Are you simply looking for a way to store strings for later use?

    Or do you want to store them on/in the units?

    Posted in: Galaxy Scripting
  • 0

    posted a message on Is there a way to disable a unit from auto-engaging enemies?

    Give the unit the GhostHoldFire ability and turn it on?

    Posted in: Galaxy Scripting
  • 0

    posted a message on EagleAI Custom AI maps

    I have spend the past 6 months working on a new custom AI (from scratch) that is better then the AI that comes with the game and is more fun to play against.

    Noteable features:

    • Unit micro (focus fire on weakest unit, use weapon bonuses, retreat wounded units)
    • Tactical ability usage (blink, force fields, emp's and fungal growth are all used)
    • Excessive creep spread (zerg AI uses tons of creep tumors to make a creep highway)
    • Harassment strategies (medivac drops, mutalisk harassment and nydus worms)
    • Human-like errors on lower difficulty settings (limited multi-tasking, slipping macro, getting supply blocked, etc)
    • Large amounts of strategies available, so every game is different
    • Priority based production system (instead of food based)

    --

    I have uploaded the following maps with this AI integrated:

    • Xel'Naga Caverns
    • Delta Quadrant
    • Metalopolis

    How to play: Create a custom game and search for "EagleAI". Add an AI to the game and set the difficulty. That's it!

    Please try it and let me know what you think. Feel free to post the replay. (if you do, please tell me which league you are in)

    PS It's possible the AI is vulnerable to some cheeses. I haven't build any specific counters against those yet, so please be a sport and play fair. :)

    Posted in: Map Feedback
  • 0

    posted a message on Really weird syntax error

    @avogatro: Go

    It's already on there... :D

    Posted in: Galaxy Scripting
  • 0

    posted a message on Really weird syntax error

    @ShooperMAN:

    This is per scope.

    int bla1() {
        int a;
        int b;
    
        a = 10;
        b = 20;
        a += b;
        return a;
    }
    
    int bla2() {
        int a;
        int b;
    
        a = 5;
        b = 8;
        a -= b;
        return a;
    }
    

    Pretty useless code, but it's for demonstration purposes... :)

    Posted in: Galaxy Scripting
  • 0

    posted a message on Galaxy preprocessor in development

    I am currently building my AI project in Notepad++. It currently exists of 893.556 bytes of .galaxy files.
    Notepad++ works fine for syntax highlighting and auto-completion, but what I am really missing is debugging functionality.
    When I make a typo somewhere, the game simply refuses to run and I have to dig through my most recent changes to find the mistake.

    I am unable to develop this project in the editor, because the editor does not recognize the "include" statement so functions declared in other files are not known to him, generating tons of compile errors.

    If you could provide with a program that has similar features to Notepad++ and includes a galaxy preprocessor so it can tell where I made an error in the script, I will love you till the end of time.

    Posted in: Galaxy Scripting
  • 0

    posted a message on Really weird syntax error

    Here is the problem:

    Galaxy requires you to declare all variables first before you do any other statements.

    The reason the line with the avgDistanceFromCenterToEdge declaration is pointed at is because that is the first time you declare something new after running regular statements.

    When you comment out those regular statements, like you said, it will work fine.

    Move the "tempRegion =" and the "RegionSetCenter" lines beneath the "int addY =" line and it should work.

    Posted in: Galaxy Scripting
  • 0

    posted a message on libNtve_gf_DialogItemColor Bugged?... [Solved]

    This should work:

    string ColorToString(color c) {
        if (c == null) { return "color is null!"; }
        return "r: " + FixedToString(ColorGetComponent(c, 0), 1) + ", g:" + FixedToString(ColorGetComponent(c, 1), 1) + ", b:" + FixedToString(ColorGetComponent(c, 2), 1);
    }
    

    I can't explain why this works or not for you, I've never worked with interface elements.

    Posted in: Galaxy Scripting
  • 0

    posted a message on libNtve_gf_DialogItemColor Bugged?... [Solved]

    color libNtve_gf_DialogItemColor (int lp_dialogItem, int lp_player);

    Takes an int as second argument, not a player group. But I guess that should prevent it from running in the first place...

    Are you getting a color with three 0.0 values, or are you getting a null pointer that your colorToString converts into 0,0,0? Because ColorGetComponent returns 0.0 when given a null pointer as color.

    Posted in: Galaxy Scripting
  • 0

    posted a message on libNtve_gf_DialogItemColor Bugged?... [Solved]

    Maybe the engine needs a tick to update the color internally?

    Have you tried setting the color and calling the getter a few seconds later?

    Posted in: Galaxy Scripting
  • 0

    posted a message on Supply Depot control?

    The automatic lowering of supply depots is somewhere in the engine. I have completely replaced all the AI scripts with my project and the depots are still getting lowered.

    However, creating an order that should raise them shouldn't be hard. The Blizzard AI scripts have a function for creating orders based on a unit and an ability.

    order AITacticalOrder(int player, unit aiUnit, string ability)
    

    The most important to use this function is the unit pointer. You need to get the supply depot you want to lower/raise in some way. If you need help with that, let me know. For the player argument, you can simply use UnitGetOwner(unit u) and plug the supply depot in there as well.

    The ability string is indeed the c_AB_DepotRaise you found. Of course there is also c_AB_DepotLower. Those are defined in the requirements.galaxy.

    The AITacticalOrder function creates the order based on the ability and checks if the result is a viable order for the unit you specified. If this is not the case, it will return null.

    Now you need a way to give the supply depot the order to raise or lower. There are actually two ways to do that:

    int AICast (unit u, order o, marker m, bool retreat)
    bool UnitIssueOrder (unit inUnit, order inOrder, int inQueueType)
    

    I am using UnitIssueOrder in my project, because with the inQueueType I can queue orders which is not possible with AICast. Downside is that orders given with UnitIssueOrder are not registered by the APM meter.

    To summarize:

    bool raiseSupplyDepot(unit depot) {
        order ord;
    
        ord = AITacticalOrder(UnitGetOwner(depot), depot, c_AB_DepotRaise);
    
        if (ord == null) { return false; }
    
        return UnitIssueOrder(depot, ord, c_orderQueueReplace);
    }
    
    Posted in: Galaxy Scripting
  • 0

    posted a message on Galaxy Questions
    Quote from FuzzYD: Go

    Quote:

    Do we have benchmark natives available?

    I do believe this is a question for s3rius :P

    No, there is not, unfortuantely. There is a AIGetTime() native that will return the same value the game timer in the bottom left shows you (in seconds). But because the game is effectively frozen when the game is running through the script, it cannot be used as a benchmark.

    Posted in: Galaxy Scripting
  • 0

    posted a message on Galaxy Questions
    Quote from FuzzYD: Go

    @MTops: Go

    Please upload that into the wiki, there is a big novelty for it.

    It's on the wiki: http://wiki.sc2mapster.com/galaxy/triggers/presets/unit-property-get/

    Posted in: Galaxy Scripting
  • 0

    posted a message on Galaxy Questions
    These are my findings for the UnitGetPropertyInt function: c_unitPropLife = 0 c_unitPropLifePercent = 1 c_unitPropLifeMax = 2 c_unitPropLifeRegen = 3 c_unitPropEnergy = 4 c_unitPropEnergyPercent = 5 c_unitPropEnergyMax = 6 c_unitPropEnergyRegen = 7 c_unitPropShields = 8 c_unitPropShieldsPercent = 9 c_unitPropShieldsMax = 10 c_unitPropShieldsRegen = 11 c_unitPropSuppliesUsed = 12 c_unitPropSuppliesMade = 13 c_unitPropKills = 14 c_unitPropVitality = 15 c_unitPropVitalityPercent = 16 c_unitPropVitalityMax = 17 c_unitPropAcceleration = 18 c_unitPropHeight = 19 c_unitPropMovementSpeed = 20 c_unitPropTurnRate = 21 c_unitPropResources = 22 c_unitPropRadius = 23 c_unitPropXP = 24 c_unitPropLevel = 25 c_unitPropBountyMinerals = 26 c_unitPropBountyVespene = 27 c_unitPropBountyTerrazine = 28 c_unitPropBountyCustom = 29 c_unitPropKillXP = 30 c_unitPropCarriedMinerals = 31 c_unitPropCarriedVespene = 32 c_unitPropCarriedTerrazine = 33 c_unitPropCarriedCustom = 34 35 and above represents the internal unit ID
    Posted in: Galaxy Scripting
  • To post a comment, please or register a new account.