• 0

    posted a message on Ability Command Indices [Solved(?)]

    @FuzzYD: Go

    Your assumption about the unit abilities is correct. The default index is 0.

    However, I do not have experience with abilities in custom maps like Dota, so I can't tell you anything about the setup there.

    Posted in: Galaxy Scripting
  • 0

    posted a message on Ability Command Indices [Solved(?)]

    Here are some examples: The ability command a SCV needs to build a building is "TerranBuild". The command index is what determines the type of building.

    The ability command an Engineering Bay uses to research anything is "EngineeringBayResearch". The command index determines what is researched.

    The ability command a Bunker uses to load or unload units is "BunkerTransport". The command index determines if it's a single unload, a complete unload or a load.

    Posted in: Galaxy Scripting
  • 0

    posted a message on Modifying the AI?

    I'm afraid you will not be able to modify the Blizzard AI to make them use your map in the way you want it. The scripts don't tell the AI where to expand, only when it should. Neither does the script control where the buildings are build. Only when to build which building. So you will not have control over that either.

    Posted in: Triggers
  • 0

    posted a message on Detecting force fields in script
    Quote from s3rius: Go

    Do you know the way that your units will take to a certain point? (e.g. can you determine the path a unit will take) Or can you only find out the pathing cost to this point?

    I have written a function that calculates this, but it uses the pathing costs to determine the shortest path. And since those pathing costs ignore units and force fields, it doesn't help in this regard.

    An invisible dummy unit that would collide with force fields would help to figure out if a choke is completely blocked or not. But this dummy should not collide with other ground units because that could disrupt normal gameplay.

    Posted in: Galaxy Scripting
  • 0

    posted a message on Detecting force fields in script

    @SouLCarveRR: Go

    My choke detection logic only responds to cliff edges, ramps and destructibles. Not buildings or force fields. So there is no need to update it constantly.

    The pathing algorithms available will respond to buildings blocking paths, so I will be able to detect that.

    But I do not have any tools to detect temp path blockers like units or force fields. Do you?

    I have tested the trigger and it works. So I will be able to detect the effect being used, just not the effect it has on pathing.

    Posted in: Galaxy Scripting
  • 0

    posted a message on Detecting force fields in script

    I just started working on my Protoss AI and the use of their special abilities. The guardian shield was easy to implement.

    But I'm stuck now on the force fields. It's easy to make a Sentry cast a force field at a random location, but that location needs to be well considered. One of the most important things it needs to check is the presence of existing force fields and what they exactly block.

    There are several pathing related native functions. Some ignore buildings and destructibles and others don't. I expected those that don't to also take into account any force fields because a ground unit needs to path around it. But apparently this is not the case.

    As it stands now, I have no way of checking if there is a force field blocking a ramp. All the pathing functions pretend the force field doesn't exist.

    I could probably manage to catch force field casts with a trigger and store the location and time of cast somewhere so I have at least something, but that will still make it pretty hard to get any decent force field code working.

    Does anyone have any helpful information on this matter?

    Posted in: Galaxy Scripting
  • 0

    posted a message on Quick Functions (Cos I'm Lazeh)

    Woops... Apologies about that, you are completely right. :)

    But using X and Y or a Point works exactly the same for me. :)

    Posted in: Galaxy Scripting
  • 0

    posted a message on Quick Functions (Cos I'm Lazeh)

    @s3rius: Go

    I see you listing functions that are already present in the native galaxy library:

    fixed Pow2 (fixed x)
    int Pow2I (fixed x)
    fixed Pow (fixed x, fixed power)
    int PowI (fixed x, fixed power)
    
    fixed AngleBetweenPoints (point p1, point p2)
    fixed DistanceBetweenPoints (point p1, point p2)
    
    point PointWithOffset (point p, fixed x, fixed y)
    point PointWithOffsetPolar (point p, fixed distance, fixed angle)
    

    And you are absolutely correct about the + operator being overloaded on points. Thanks for that.

    Posted in: Galaxy Scripting
  • 0

    posted a message on Quick Functions (Cos I'm Lazeh)

    Here are some of mine:

    string PointToString(point p) {
    	return "x: " + FixedToString(PointGetX(p), -1) + ", y: " + FixedToString(PointGetY(p), -1);
    }
    
    string BoolToString(bool b) {
    	if (b == true) { return "true"; }
    	if (b == false) { return "false"; }
    	return "nullBoolean";
    }
    
    color PlayerGetColor(int player) {
    	int index = PlayerGetColorIndex(player, false);
    	return ColorFromIndex(index, 0);
    }
    
    point PointAdd(point p1, point p2) {
    	return PointWithOffset(p1, PointGetX(p2), PointGetY(p2));
    }
    
    point PointOnLine(point p1, point p2, fixed ratio) {
    	point diff = Point(PointGetX(p2) - PointGetX(p1), PointGetY(p2) - PointGetY(p1));
    	return PointWithOffset(p1, PointGetX(diff) * ratio, PointGetY(diff) * ratio);
    }
    
    unitgroup UnitGroupMerge(unitgroup ug1, unitgroup ug2) {
    	unitgroup newGroup = UnitGroupCopy(ug1);
    	int i = 1;
    	
    	while (UnitGroupCount(ug2, c_unitCountAll) >= i) {
    		UnitGroupAdd(newGroup, UnitGroupUnit(ug2, i));
    		i += 1;
    	}
    	return newGroup;
    }
    
    point UnitGroupCenter(unitgroup group) {
    	point loc = Point(0.0, 0.0);
    	int i = 0;
    	
    	while (i + 1 <= UnitGroupCount(group, c_unitCountAll)) {
    		i += 1;
    		loc = PointAdd(loc, UnitGetPosition(UnitGroupUnit(group, i)));
    	}
    	
    	if (i == 0) { return loc; }
    	return Point(PointGetX(loc) / IntToFixed(i), PointGetY(loc) / IntToFixed(i));
    }
    
    fixed AngleBetweenAngles(fixed angle1, fixed angle2) {
    	fixed diff = AbsF(angle1 - angle2);
    	if (diff < 180.0) {
    		return diff;
    	}
    	if (angle1 < angle2) {
    		diff = AbsF((angle1 + 360.0) - angle2);
    		return diff;
    	}
    	diff = AbsF(angle1 - (angle2 + 360.0));
    	return diff;
    }
    
    fixed eTimePassedSince(fixed time) {
    	return AIGetTime() - time;
    }
    
    Posted in: Galaxy Scripting
  • 0

    posted a message on Need help! Pause AI FOR PLAYER

    There simply isn't a script pause function for a specific player.

    So make a boolean that is checked at the start of your script that returns when the boolean is set to true.

    Posted in: Galaxy Scripting
  • 0

    posted a message on New natives in patch 1.2

    I did a comparison on all galaxy files contained in the new patch mpq with the old ones to find new native functions: (i've added new constants as well if they are required for any of the new functions)

    native int      AINumEnemyBuildingsOnSharedIslands (int player);
    native int      AINumEnemyBuildingsOnOtherIslands (int player);
    native bool     AIEnemyBuildingsOnlyOnOtherIslands (int player);
    
    native int      AICounterUnitsSameTechAdjusted (int player, int testPlayerId, string makeWhat);
    
    native fixed    AIFoodCost (int player, string aliasUnitType);
    
    const int       c_bankOptionSignature = 0;
    
    native bool     BankVerify (bank b);
    native bool     BankOptionGet (bank b, int option);
    native void     BankOptionSet (bank b, int option, bool enable);
    
    const int       c_formatNumberStyleNormal     = 0;
    const int       c_formatNumberStyleCurrency   = 1;
    const int       c_formatNumberStylePercent    = 2;
    
    native text     FixedToTextAdvanced (fixed inNumber, int inStyle, bool inGroup, int inMinDigits, int inMaxDigits);
    
    native int      DialogControlCreateInPanel (int panel, int type);
    native int      DialogControlCreateInPanelFromTemplate (int panel, int type, string inTemplate);
    native int      DialogControlHookup (int panel, int type, string inTemplate);
    
    native bool     CrossCliff (point inFrom, point inDest);
    
    native void     HelpPanelDestroyAllTips ();
    native void     HelpPanelDestroyAllTutorials ();
    
    native void     PortraitSetTeamColor (int p, color inColor);
    native void     PortraitSetMouseTarget (int p, bool inMouseTarget);
    
    native void     TextTagSetFogVisibility (int inTag, int inVisType);
    
    native void     UnitInventoryRemove (unit inItem);
    
    native void     UISetResourceTradingAllowed (int inResourceType, bool inAllowed);
    native void     UISetResourceTradingMinorStep (int inResourceType, int inAmount);
    native void     UISetResourceTradingMajorStep (int inResourceType, int inAmount);
    
    native void     UISetDragSelectEnabled (playergroup players, bool enable);
    
    native void     TriggerAddEventMouseMoved (trigger t, int player);
    
    native int      EventMouseMovedPosXUI ();
    native int      EventMouseMovedPosYUI ();
    native fixed    EventMouseMovedPosXWorld ();
    native fixed    EventMouseMovedPosYWorld ();
    native fixed    EventMouseMovedPosZWorld ();
    
    Posted in: Galaxy Scripting
  • 0

    posted a message on validating location properties before unit creation

    CliffLevel returns an int, so is sufficient for cliffs, but if you want subtle height differences as well (on a ramp for example), use:

    PointPathingCliffLevel( Point(x,y) )

    Also, if you want to make a new point based on another one, the following functions should help:

    PointWithOffset( point orgpos, fixed x, fixed y )

    PointWithOffsetPolar( point orgpos, fixed distance, fixed angle )

    Posted in: Galaxy Scripting
  • 0

    posted a message on Advanced map analysis with pure scripting

    @zeldarules28: Go

    What exactly? For general development updates of the AI, please check www.eagleai.net. I'm posting daily updates...

    Posted in: Galaxy Scripting
  • 0

    posted a message on Custom AI for Melee Games

    To play with a custom AI you can either use the SC2AllIn1 launcher or make a custom map with the new scripts imported.

    Posted in: Galaxy Scripting
  • To post a comment, please or register a new account.