• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

SC2's jass replacement (preview)

Status
Not open for further replies.
JASS:
//==================================================================================================
//  Zerg Melee AI
//==================================================================================================

include "TriggerLibs/Zerg0"

//--------------------------------------------------------------------------------------------------
//  Counter-Attack Units
//--------------------------------------------------------------------------------------------------
static void InitCounters (int player) {
//xxx lots of old data -- needs to be totally redone
    // versus Protoss
    AICounterUnit(player, c_PU_Zealot,              1.00, c_ZU_Baneling);
    AICounterUnit(player, c_PU_Stalker,             1.00, c_ZU_Roach);
    AICounterUnit(player, c_PU_Immortal,            8.00, c_ZU_Zergling);
    AICounterUnit(player, c_PU_HighTemplar,         2.00, c_ZU_Roach);
    AICounterUnit(player, c_PU_Disruptor,           4.00, c_ZU_Zergling);
    AICounterUnit(player, c_PU_Archon,              4.00, c_ZU_Zergling);
    AICounterUnit(player, c_PU_Archon,              2.00, c_ZU_Hydralisk);
    AICounterUnit(player, c_PU_Archon,              2.00, c_ZU_Roach);
    AICounterUnit(player, c_PU_Colossus,            1.00, c_ZU_Mutalisk);
    AICounterUnit(player, c_PU_VoidRay,             2.00, c_ZU_Corruptor);
    AICounterUnit(player, c_PU_VoidRay,             1.00, c_ZU_Mutalisk);
    AICounterUnit(player, c_PU_Phoenix,             2.00, c_ZU_Hydralisk);
    AICounterUnit(player, c_PU_Carrier,             2.00, c_ZU_Hydralisk);
    AICounterUnit(player, c_PU_Carrier,             2.00, c_ZU_Corruptor);

    // versus Terran
    AICounterUnit(player, c_TU_Marine,              0.60, c_ZU_Baneling);
    AICounterUnit(player, c_TU_Marauder,            3.00, c_ZU_Zergling);
    AICounterUnit(player, c_TU_Hellion,             0.60, c_ZU_Roach);
    AICounterUnit(player, c_TU_Ghost,               6.00, c_ZU_Zergling);
    AICounterUnit(player, c_TU_SiegeTank_Alias,     6.00, c_ZU_Zergling);
    AICounterUnit(player, c_TU_Reaper,              0.30, c_ZU_Mutalisk);
    AICounterUnit(player, c_TU_Thor,               12.00, c_ZU_Zergling);
    AICounterUnit(player, c_TU_Banshee,             0.50, c_ZU_Mutalisk);
    AICounterUnit(player, c_TU_BattlecruiserClass,  2.00, c_ZU_Corruptor);
    AICounterUnit(player, c_TU_BattlecruiserClass,  2.00, c_ZU_Hydralisk);

    // versus Zerg
    AICounterUnit(player, c_ZU_Zergling,            0.25, c_ZU_Baneling);
    AICounterUnit(player, c_ZU_Baneling,            0.25, c_ZU_Lurker);
    AICounterUnit(player, c_ZU_Roach,               3.00, c_ZU_Zergling);
    AICounterUnit(player, c_ZU_Hydralisk,           1.00, c_ZU_Hydralisk);
    AICounterUnit(player, c_ZU_Lurker,              1.50, c_ZU_Hydralisk);
    AICounterUnit(player, c_ZU_Mutalisk,            0.50, c_ZU_Mutalisk);
    AICounterUnit(player, c_ZU_Mutalisk,            0.50, c_ZU_Corruptor);
    AICounterUnit(player, c_ZU_Corruptor,           1.00, c_ZU_Corruptor);
    AICounterUnit(player, c_ZU_BroodLord,       0.50, c_ZU_Corruptor);
}

//--------------------------------------------------------------------------------------------------
//  ZergSubStateName
//--------------------------------------------------------------------------------------------------
string ZergSubStateName (int state) {
    // TODO Call the individual difficulties to return a real substate name
    return "-" + IntToString(state) + "-";
}

//--------------------------------------------------------------------------------------------------
//  DebugCallbackZerg
//--------------------------------------------------------------------------------------------------
void DebugCallbackZerg (int player) {
    DebugAI("=====ZERG=====\n");
    DebugMelee(player);
    DebugAI("e_mainState = "        + MainStateName(AIState(player, e_mainState))           +
            ", e_mainSubState = "   + ZergSubStateName(AIState(player, e_mainSubState))     +
            ", e_attackState = "    + AttackStateName(AIState(player, e_attackState))
    );
}

//--------------------------------------------------------------------------------------------------
//  AINewUnitZerg
//--------------------------------------------------------------------------------------------------
void AINewUnitZerg (int player, unit u) {
    wave w;
    string type = UnitGetType(u);

    // ignored units
    //
    if (type == c_ZU_Larva || 
        type == c_ZU_Broodling ||
        type == c_ZU_Mantaling) {
        return;
    }
    if (UnitTypeTestAttribute(type, c_unitAttributeStructure)) {
        return;
    }
    if (UnitTypeTestFlag(type, c_unitFlagWorker)) {
        return;
    }

    // units that stay near home
    //
    if (type == c_ZB_SpineCrawler || type == c_ZB_SporeCrawler) {
        AIWaveAddUnitPriority(AIWaveGet(player, c_waveHome), u, c_prioWavePeon);
        return;
    }
    if (type == c_ZU_Queen) {
        AIWaveAddUnitPriority(AIWaveGet(player, c_waveHome), u, c_prioWavePeon);
        return;
    }
    
    // detector
    //
    if (type == c_ZU_Overseer) {
        AINewDetector(player, u, true);
        return;
    }

    // extra scout units
    //
    if (type == c_ZU_Overlord || type == c_ZU_OverlordCocoon ) {
        AIAddToExtraScoutGroup(player, u);
        return;
    }

    // clear obstacle units
    //
    if (AIWaveNeedClearObsUnits(player)) {
        if (type == c_ZU_Zergling || type == c_ZU_Roach || type == c_ZU_Hydralisk) {
            AIMergeUnit(player, u, AIWaveGet(player, c_waveClearObs));
            return;
        }
    }

    // main wave units
    //
    AINewUnitDefault(player, u);
}

//--------------------------------------------------------------------------------------------------
//  AIGetScoutZerg
//--------------------------------------------------------------------------------------------------
unit AIGetScoutZerg (int player, int index, unit prev) {    
    unit seer;

    if (!AIGetFlag(player, e_flagsScouting)) {
        return c_nullUnit;
    }
    if (UnitGetType(prev) == c_ZU_Overseer) {
        return prev;
    }   
    seer = AIGrabUnit(player, c_ZU_Overseer, c_prioScout, null);
    if (seer) {
        return seer;
    }
    if (prev) {
        return prev;
    }
    if (AIGetFlag(player, e_flagsLateScout)) {
        return c_nullUnit;
    }
    return AIGrabUnit(player, c_ZU_Overlord, c_prioScout, null);
}

//--------------------------------------------------------------------------------------------------
//  AIEarlyDefScoutZerg
//--------------------------------------------------------------------------------------------------
unit AIEarlyDefScoutZerg (int player, unit prev) {
    unit obs;
    
    if (!AIGetFlag(player, e_flagsEarlyDefScout)) {
        return c_nullUnit;
    }
    if (UnitGetType(prev) == c_ZU_Overseer) {
        return prev;
    }
    obs = AIGrabUnit(player, c_ZU_Overseer, c_prioScout, null);
    if (obs) {
        return obs;
    }
    if (UnitGetType(prev) == c_ZU_Zergling) {
        return prev;
    }
    obs = AIGrabUnit(player, c_ZU_Zergling, c_prioScout, null);
    if (obs) {
        return obs;
    }
    if (prev) {
        return prev;
    }
    return AIGrabUnit(player, c_ZU_Drone, c_prioScout, null);
}


//--------------------------------------------------------------------------------------------------
//  AIWaveThinkZerg
//--------------------------------------------------------------------------------------------------
void AIWaveThinkZerg (int player, wave w, int type) {
    AIWaveThinkDefault(player, w, type);
}

//--------------------------------------------------------------------------------------------------
//  Zerg Init
//--------------------------------------------------------------------------------------------------
static void ZergInit (int player) {
    int state;

    InitCounters(player);
    AISetNumScouts(player, 1);
    AISetFlag(player, e_flagsScouting, true);
    AISetFlag(player, e_flagsEarlyDefScout, false);
    AIReqCountAsBuiltObject(player, c_ZU_Larva);
    AITechCountFixupSingle(player, c_ZB_HydraliskDen, c_ZB_LurkerDen);
    AITechCountFixupSingle(player, c_ZB_Spire, c_ZB_GreaterSpire);
    AITechCountFixupInOrder(player, c_ZB_Hatchery, c_ZB_Lair, c_ZB_Hive);
    AISetCreepBuilding(player, c_ZB_CreepTumor, "ZergBuildingNotOnCreep");

    if (AIGetGroundStartLocs(PlayerStartLocation(player)) > 0) {
        state = AIDiffEnum(player, e_mainState_OpenGnd0);
    }
    else {
        state = AIDiffEnum(player, e_mainState_OpenAir0);
    }
    AISetMainState(player, state, e_mainSubState_Unset);
}

//--------------------------------------------------------------------------------------------------
//  AIMeleeZerg
//--------------------------------------------------------------------------------------------------
void AIMeleeZerg (int player) {
    int mainState = AIState(player, e_mainState);

    if (mainState == e_mainState_Init)              { ZergInit(player);       }

    else if (mainState == e_mainState_OpenGnd0)     { ZergOpenGnd0(player);   }
    //else if (mainState == e_mainState_OpenGnd1)     { ZergOpenGnd1(player);   }
    //else if (mainState == e_mainState_OpenGnd2)     { ZergOpenGnd2(player);   }
    //else if (mainState == e_mainState_OpenGnd3)     { ZergOpenGnd3(player);   }
    //else if (mainState == e_mainState_OpenGnd4)     { ZergOpenGnd4(player);   }
    //else if (mainState == e_mainState_OpenGnd5)     { ZergOpenGnd5(player);   }

    else if (mainState == e_mainState_OpenAir0)     { ZergOpenAir0(player);   }
    //else if (mainState == e_mainState_OpenAir1)     { ZergOpenAir1(player);   }
    //else if (mainState == e_mainState_OpenAir2)     { ZergOpenAir2(player);   }
    //else if (mainState == e_mainState_OpenAir3)     { ZergOpenAir3(player);   }
    //else if (mainState == e_mainState_OpenAir4)     { ZergOpenAir4(player);   }
    //else if (mainState == e_mainState_OpenAir5)     { ZergOpenAir5(player);   }

    else if (mainState == e_mainState_Mid0)         { ZergMid0(player);       }
    //else if (mainState == e_mainState_Mid1)         { ZergMid1(player);       }
    //else if (mainState == e_mainState_Mid2)         { ZergMid2(player);       }
    //else if (mainState == e_mainState_Mid3)         { ZergMid3(player);       }
    //else if (mainState == e_mainState_Mid4)         { ZergMid4(player);       }
    //else if (mainState == e_mainState_Mid5)         { ZergMid5(player);       }

    else if (mainState == e_mainState_Late0)        { ZergLate0(player);      }
    //else if (mainState == e_mainState_Late1)        { ZergLate1(player);      }
    //else if (mainState == e_mainState_Late2)        { ZergLate2(player);      }
    //else if (mainState == e_mainState_Late3)        { ZergLate3(player);      }
    //else if (mainState == e_mainState_Late4)        { ZergLate4(player);      }
    //else if (mainState == e_mainState_Late5)        { ZergLate5(player);      }

    else if (mainState == e_mainState_Off)          { EndMeleeScript(player); }
    else if (mainState == e_mainState_Disabled)     {                         }
    
    else { ErrorMeleeScript(player, "Invalid mainState"); }
}

:D
 
looks like c and all that jass

lol.

Anyway, this is sweet. Pretty similar to Jass but it also has several differences. You don't need call/sets anymore. If-then-else blocks are denoted by
JASS:
if bool {
blah funcs 
}
else {
blah funcs
}
Or it can be a one-liner:
JASS:
if bool { blah func }

Loops are denoted by "while", just like C, java, etc.
It is also sweet that you can use multiple lines for parameters and others:
JASS:
func ( param 1
    param 2
    param 3 );

Fun.

EDIT: Sadly I2S is IntToString(int) =( More typing.
 
Level 9
Joined
Nov 28, 2008
Messages
704
lol.

JASS:
if bool {
blah funcs 
}
else {
blah funcs
}
Or it can be a one-liner:
JASS:
if bool { blah func }

Actually, they seem to have copied C in that it has to be:

JASS:
if (bool)
{
   //Soemthing.
}

As in, required brackets. How annoying. Also, semicolons are the devil. They took the bad features of C and kept them. :/

Otherwise, good ol C (hopefully with structs included?).
 
Level 9
Joined
Nov 28, 2008
Messages
704
Pointers would be nice, but I guess they allow too much Hax0rz, what with direct memory access and everything...

Otherwise, looking great! I can't wait until it's out...

They probably wouldnt let you have direct access though... I could see a handle based system for everything myself. Sadly.

I'm hoping for structs so no more 8191 limits. Or if not structs, dynamic arrays.

this is like zinc. )

No, Zinc is like C which is like this.
 
The good thing about this is that it basically teaches C-like syntax so people who'd use galaxy as their first programming language could move right on to another language like C++, C#, java, etc.


I wish there were for loops though.

Also I wonder if this is legal:

JASS:
if (bool)
    // do something
else
    // something else

i.e. without the {} if it's just one line. Since you can do that in C and stuff.
 
Level 3
Joined
Mar 24, 2008
Messages
60
Question: I always read about how GUI is bad and inefficient so I'm really interested in learning the language for SC2 but have no prior coding experience. Should I just try to find tutorials on C or C++ or? Do you have any recommendations? I've been reading a couple online tutorials on C++ but I am having a hard time getting into it, mainly because the "hello world" kind of stuff just feels flat at the moment. Should I just be more patient with it or what?
 
Level 9
Joined
Nov 28, 2008
Messages
704
No reason not to learn a programming language. Go ahead and learn C/C++ if you want. In fact, ignore C, go straight to C++ because no one likes C because it has no classes.

If C/C++ are too much for you, perhaps try Visual Basic if you can get it off of Microsoft. As far as I know, they offer free express editions so why not? Visual Basic is incredibly english-like, even if it has more than a few flaws.

If you are feeling like hello world is a bit "flat"... yeah. Basically all programming languages are, especially C++, until you start getting advanced enough. Again, I highly recommend Visual Basic for starting out because it offers you a way to create a simple window, which is way better then a C++ console just to make you feel like you are getting somewhere.
 

Ralle

Owner
Level 79
Joined
Oct 6, 2004
Messages
10,212
Question: I always read about how GUI is bad and inefficient so I'm really interested in learning the language for SC2 but have no prior coding experience. Should I just try to find tutorials on C or C++ or? Do you have any recommendations? I've been reading a couple online tutorials on C++ but I am having a hard time getting into it, mainly because the "hello world" kind of stuff just feels flat at the moment. Should I just be more patient with it or what?
I am pretty sure that Galaxy code is a function-programming language. So C would be good. But you seem so far behind that any knowledge would benefit you when this game comes out.
So how is the function library? Is it good? Does it pop up automaticly while writing the code like TESH did? Does it even detect for example struct members and methods of user defined structs/functions?

This would make the beginning phase of SC2 mapping ALOT faster.
We don't know yet. The actual editor hasn't been released yet. All this information is simply based on SC2's AI scripts and so on.
 
Wooooow, We slow this down..
Will there be any GuI? cuz I can't live whitout it...

Yeah, I remember hearing that there will be a GUI. It is designed for starter/beginner mapmakers so that they can get used to the Galaxy editor. I hope they try to incorporate more natives into GUI instead of tons of swap functions this time. =P
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,287
So far from data being sent to me I have managed to identify these AI natives and some trigger natives. Still looking and as I do not have the beta I have to rely on pieces people send me.

//AI
native void AIStart (int player, bool isCampaign, int apm);
native bool AIGivingUp (int player);
native void AIGoodGame (int player);
native bool AIIsCampaign (int player);
native void AISetAPM (int player, int apm);
native unit AIGrabUnit (int player, string aliasUnitType, int prio, point location);
native int AIState (int player, int index);
native void AISetSpecificState (int player, int index, int state);
native void AISetAllStates (int player, int state);
native void AISetFlag (int player, int index, bool state);
native bool AIGetFlag (int player, int index);
native void AITechFlag (int player, int index, int count, string what, int state);
native void AIResetUserData (int player);
native void AISetUserString (int player, int index, string data);
native string AIGetUserString (int player, int index);
native void AISetUserInt (int player, int index, int data);
native int AIGetUserInt (int player, int index);
native void AIAddStringInt (int player, string data, int change);
native fixed AIGetTime ();
native int AIGetTotalStartLocs ();
native int AIGetGroundStartLocs (point loc);
native int AIGetAirStartLocs (point loc);
native int AIGetTotalTownLocs ();
native int AIGetGroundTownLocs (point loc);
native int AIGetAirTownLocs (point loc);
native int AIRandomVal (int player, int which);
native void AINewChooseSubState (int player, int which, int min, int max, int defaultSubState);
native void AISetSubStateChance (int subState, int chance);
native int AIChooseSubState ();
native bool AIWantsMultipleTransport (int player);
native void AISetWantsMultipleTransport (int player, bool enable);
native int AIGetNumMobileTransports (int player);
native point AIGetBestCreepSpot (int player, unit creator, fixed createRadius);
native void AIAddDetectionDanger (int player, string unitType);
native bool AIDefaultSuspectDetectionDanger (int player);
native bool AIAnyWorkersFleeingNearby (int player, point loc, fixed radius);
native int AIGetNumEnemies (int player);
native int AIGetNumAllies (int player);
native point AIPlacementNearbyFindTest (int player, point loc, fixed range, string unitType);
native void AIAddToExtraScoutGroup (int player, unit u);
native bool AIOfferNewScout (int player, unit u);
native bool AIAnyAllyAttacking (int player);
native point AIBestAllyAttackPoint (int player, wave w);
native bool AIAnyAllyNeedsDefending (int player);
native point AIBestAllyDefendPoint (int player, wave w);
native void AIGlobalSuicide (int player);
native wave AIUnitGetWave (unit u);
native unitgroup AIWaveGetUnits (wave w);
native unitgroup AIGetAllEscorts (unit u);
native unitgroup AIGetAllEscortsGroup (unitgroup ug);
native void AIRemoveUnitFromAnyWaves (unit u);
native void AIRemoveGroupFromAnyWaves (unitgroup ug);
native unitgroup AIGetUnitsInWavesWithTarget (int player, wavetarget target);
native bool AIIsScriptControlled (unit u);
native void AISetUnitScriptControlled (unit u, bool enable);
native void AISetGroupScriptControlled (unitgroup ug, bool enable);
native bool AIIsSuicideUnit (unit u);
native void AISetUnitSuicide (unit u, bool enable);
native void AISetGroupSuicide (unitgroup ug, bool enable);
native bool AIIsNotUsableInWaves (unit u);
native void AISetUnitNotUsableInWaves (unit u, bool enable);
native void AISetGroupNotUsableInWaves (unitgroup ug, bool enable);
native void AISetWantsToUpgrade (unit u);
native void AIInitCampaignTowns (int player);
native void AIInitCampaignHarvest (int player);
native void AIDeclareTown (int player, int town, point center);
native int AIGetMainTown (int player);
native void AISetMainTown (int player, int maintown);
native void AIUpdateMainTown (int player);
native int AIGetTownState (int player, int town);
native fixed AIGetTownEstablishedTime (int player, int town);
native point AIGetTownLocation (int player, int town);
native int AIGetClosestTown (int player, point location);
native int AIGetNextUnusedTownSlot (int player);
native int AIGetBuildingCountInTown (int player, int town, string aliasUnitType, int countMask);
native bool AIIsTownHarvestRunning (int player, int town);
native void AIHarvest (int player, int town);
native void AIHarvestRate (int player, int rate);
native void AIHarvestBonus (int player, fixed bonus);
native void AISetGasPeonCountOverride (int player, int town, int desiredGasCount);
native int AIGetCurPeonCount (int player, int town);
native int AIGetMinPeonCount (int player, int town);
native int AIGetMaxPeonCount (int player, int town);
native int AIGetMineralAmountLeft (int player, int town);
native int AIGetGasAmountLeft (int player, int town);
native int AIGetMineralNumSpots (int player, int town);
native int AIGetRawGasNumSpots (int player, int town);
native point AIGetGatherLocation (int player, int town);//xxx remove old functions
native point AIGetGatherDefLocation (int player, int town);
native int AIExpand (int player, point searchStart, string firstBuilding);
native unitgroup AIGetTownThreats (int player, int town);
native unit AIGetObstruction (int player);
native bool AIHasNearbyOpenExpansion (int player);
native void AIScout (int player);
native void AISetNumScouts (int player, int num);
native void AISetScoutTimes (int player, int starts, int obstructed, int resources, int other);
native point AIGetNextScoutLoc (int player);
native void AIClearCampaignScout (int player);
native void AIBuild (int player, int priority, int town, string aliasUnitType, int count, int flags);
native void AITrain (int player, int priority, int town, string aliasUnitType, int count);
native void AIResearch (int player, int priority, int town, string aliasUpgradeType);
native void AIMakeAlways (int player, int priority, int town, string aliasType, int count);
native void AIMakeOnce (int player, int priority, int town, string aliasType, int count);
native void AIClearBuildQueue (int player);
native void AIClearTrainQueue (int player);
native void AIClearResearchQueue (int player);
native bool AIHasRes (int player, int minerals, int gas);
native int AITechCount (int player, string aliasType, int countMask);
native void AITechCountFixupSingle (int player, string baseUnit, string upgradeOne);
native void AITechCountFixupEither (int player, string baseUnit, string upgradeOne, string upgradeTwo);
native void AITechCountFixupInOrder (int player, string baseUnit, string upgradeOne, string upgradeTwo);
native int AIKnownUnitCount (int player, int testPlayerId, string aliasUnitType);
native void AIResetCounterUnits (int player);
native void AICounterUnit (int player, string seeWhat, fixed factor, string makeWhat);
native int AICounterUnits (int player, int testPlayerId, string makeWhat);
native point AIGetRallyPoint (unit u);
native void AISetPowerBuilding (int player, string building);
native void AISetCreepBuilding (int player, string building, string noCreepBehavior);
native void AIClearStock (int player);
native void AIEnableStock (int player);
native void AISetStockEx (int player, int town, int count, string aliasType, int buildFlags, int stockFlags);
native void AISetStock (int player, int count, string aliasType);
native void AISetStockOpt (int player, int count, string aliasType);
native void AISetStockUnitNext (int player, int count, string aliasUnitType, bool when);
native bool AISetStockTown (int player, string aliasUnitTypeTH, string aliasUnitTypeGas);
native bool AISetStockExpand (int player, string aliasUnitTypeTH, int count);
native void AISetStockExtra (int player, int count, string aliasUnitType, int minerals);
native void AISetStockFarms (int player, string aliasUnitType, bool onlyNeeded);
native void AISetStockPeons (int player, int max, string aliasUnitType, bool onlyMinPeons, bool peonMode);
native void AINewTechStock (int player);
native void AITechStockAdd (string upgradeType);
native void AISetStockTechNext (int player);
native void AIDefaultEconomy (int player, string hall, string gas, string food, string peon, int cap, bool peonMode);
native void AIDefaultExpansion (int player, string hall, int minerals, int gas, int expandFlags);
native void AIClearLimitTech (int player);
native void AILimitTech (int player, int totalMin, int totalGas, int buildingMin, int buildingGas, int upgradeMin, int upgradeGas);
native void AIImportantTech (int player, string aliasType);
native void AILimitStockLarva (int player, string aliasType);
native bool AIHasStock (int player);
native bool AIHasStockFromTown (int player, int town);
native void AIRemoveStockFromTown (int player, int town);
native int AIDefaultGetObjectType (int player, string aliasType);
native string AIDefaultGetMaker (int player, string aliasType);
native string AIDefaultGetFirstMissingReq (int player, string aliasType);
native string AIDefaultGetFirstUnfinishedReq (int player, string aliasType);
native int AIDefaultGetFullMakeTime (int player, string aliasType);
native string AIGetBaseName (string aliasType);
native string AIGetBuildAtName (string aliasType);
native void AIReqCountAsBuiltObject (int player, string aliasType);
native void AIReqAddSpecialMaker (string objType, string makerType, string abilName, int abilIndex);
native void AIBaseThink (unit who, unitgroup candidates);
native bool AIEvalTacticalData (unit who, string data);
native int AICast (unit u, order o, marker m, bool retreat);
native int AICastFlee (unit who, unit from, int distance, marker mark);
native bool AINearbyUnits (int player, string unitType, point p, fixed range, int requiredCount);
native unitgroup AIFindUnits (int player, string unitType, point p, fixed range, int inMaxCount);
native bool AISameCommand (unit u1, unit u2);
native unit AILastAttacker (unit u);
native int AILastAttack (unit u);
native bool AIControlWantsToMove (unit u);
native bool AIControlForceToMove (unit u);
native bool AIControlWantsToUnburrow (unit u);
native bool AIControlWantsToBurrow (unit u);
native bool AIControlForceUnburrow (unit u);
native bool AIUnitIsInCombat (unit u);
native bool AIIsIgnoredByWave (unit u);
native void AISetIgnoredByWave (unit u, bool enable);
native point AIGetHomePosition (unit u);
native point AIGetCloakedAttacker (int p);
native void AIClearCloakedAttacker (int p, point pt);
native bool AISawCloakedUnit (int p);
native point AIRandomSpawnPoint (
int player,
region r,
fixed minDistFromEnemy,
fixed maxDistFromEnemy,
fixed maxDistFromBuilding
);
native point AIBestTargetPoint (
unitgroup group,
int minHits,
int damageBase,
fixed minScore,
fixed radius,
point from,
fixed range,
int bonusAttri
);
native unit AIDefaultCombatPriority (unit target, unitgroup attackers, unitgroup enemies);
native bool AICloakEvaluate (unit u, fixed minEnergy, fixed maxLife, fixed range);
native bool AICombatTargetProduction (int player, int action);
native bool AICombatTargetDropOffs (int player, int action);
native bool AICombatTargetFood (int player, int action);
native bool AICombatTargetActiveProduction (int player, int action);
native bool AICombatTargetWorkers (int player, int action);
native bool AICombatTargetAllyThreats (int player, int action);
native bool AICombatTargetSelfThreats (int player, int action);
native bool AICombatTargetCurrent (int player, int action);
native bool AICombatTargetAir (int player, int action);
native bool AICombatTargetMovers (int player, int action);
native bool AICombatTargetInjuries (int player, int action);
native bool AICombatTargetInAttackRange (int player, int action);
native bool AICombatTargetThreats (int player, int action);
native bool AICombatTargetHealers (int player, int action);
native bool AICombatTargetSiege (int player, int action);
native bool AICombatTargetAttackers (int player, int action);
native bool AICombatTargetSpecial (int player, int action);
native bool AICombatAvoidTimedUnits (int player, int action);
native bool AICombatAvoidNonThreats (int player, int action);
native bool AICombatAvoidWeakUnits (int player, int action);
native bool AICombatAvoidDisabledUnits (int player, int action);
native void AITransportIgnore (int player, string unitType);
native void AITransportSetPanic (int player, fixed value);
native void AITransportSetReturn (int player, point center);
native waveinfo AIWaveInfoCreate ();
native waveinfo AIWaveInfo (wave w);
native void AIWaveInfoAdd (waveinfo info, string unitType, int count);
native int AIWaveInfoAttack (waveinfo info, int player, point from, wavetarget target, int time);
native int AIWaveInfoSuicide (waveinfo info, int player, point from, wavetarget target, int time);
native int AIWaveInfoScout (waveinfo info, int player, point from, int time);
native string AIWaveToString (wave w);
native text AIWaveToText (wave w);
native wave AIWaveCreate (waveinfo info, int player, point from);
native void AIWaveAddUnit (wave w, unit u);
native void AIWaveAddUnitPriority (wave w, unit u, int prio);
native void AIWaveRemoveUnit (wave w, unit u);
native int AIWaveUnitCount (wave w);
native int AIWaveDetectorCount (wave w);
native void AIWaveSetType (wave w, int type, wavetarget target);
native int AIWaveState (wave w);
native void AIWaveDelete (wave w);
native wavetarget AIWaveTargetUnit (unit u);
native wavetarget AIWaveTargetUnitGroup (unitgroup g);
native wavetarget AIWaveTargetUnitPoint (unit u);
native wavetarget AIWaveTargetPoint (point p);
native wavetarget AIWaveTargetPlayer (playergroup players);
native wavetarget AIWaveTargetMelee (int player);
native wavetarget AIWaveTargetMeleeHarass (int player);
native wavetarget AIWaveTargetMeleeDrop (int player, point dropLoc, point goalLoc);
native wavetarget AIWaveTargetMeleeDefend (int player);
native wavetarget AIWaveTargetMerge (wave w);
native wavetarget AIWaveTargetPatrol (int replaceType);
native wavetarget AIWaveTargetEscort (unitgroup g, int replaceType);
native wavetarget AIWaveTargetEscortNL (unitgroup g, int replaceType);
native wavetarget AIWaveTargetGatherO (int player, int town);
native wavetarget AIWaveTargetGatherD (int player, int town);
native wavetarget AIWaveTargetRegion (region r, int replaceType);
native point AIWaveTargetGatherOPoint (int player, int town);
native point AIWaveTargetGatherDPoint (int player, int town);
native unit AIWaveTargetGetUnit (wavetarget wt);
native unitgroup AIWaveTargetGetUnitGroup (wavetarget wt);
native wavetarget AIWaveHarassRetreat (int player, wave w, fixed range);
native wavetarget AIWaveGetTarget (wave w);
native bool AIWaveIsInCombat (wave w);
native int AIWaveGetTimeInCombat (wave w);
native int AIWaveGetTimeSinceCombat (wave w);
native int AIWaveGetTimeSinceOrdered (wave w);
native int AIWaveGetTimeSinceRetreat (wave w);
native bool AIDefenseThreat (int type, int player, wave w);
native int AIDefenseThreatEval (int type, int player);
native int AIWaveEval (wave w);
native int AIWaveEvalRatio (wave w, fixed range);
native int AIUnitAreaEvalRatio (unit u, fixed range);
native int AIEvalRatio (int player);
native void AIEvalSetCustomIndex (int index);
native int AILastWaveEvalStaticRatio ();
native void AIWaveTargetAddWaypoint (wavetarget wt, point waypoint, bool useTransport, int index);
native void AIWaveTargetClearWaypoints (wavetarget wt);
native wave AIWaveGet (int player, int waveName);
native void AIWaveSet (int player, int waveName, wave waveRef);
native int AIWaveType (wave waveRef);
native void AIWaveMerge (int player, int waveFrom, int waveInto);
native void AIWaveMergeMelee (int player);
native wave WaveLastCreated ();
native point AIGetBestTarget (int player, playergroup enemies, point gatherPoint, int flags);
native bool AIFindDropAttackTarget (int player, point gatherPoint);
native point AILastDropLocation ();
native point AILastDropGoal ();
native fixed AIGetNextDropTimeCheck(int player);
native void AISetNextDropTimeCheck(int player, fixed time);
native int AILastAttackRatio (wave w);
native int AILastAttackStartEval (wave w);
native void AIAttackWaveAddUnits (int difficulty, int count, string unitType);
native int AIAttackWaveSend (int player, int time, bool wait);
native void AIAttackWaveCancel (wave waveRef);
native void AIAttackWaveSetGatherPoint (int player, point gather);
native void AIAttackWaveUseUnit (int player, unit u);
native void AIAttackWaveUseGroup (int player, unitgroup ug);
native void AIAttackWaveAddEscortUnit (int player, unit u, unit escort, fixed offset, fixed angle);
native void AIAttackWaveAddEscortType (int player, string unitType, unit escort, fixed offset, fixed angle);
native void AIAttackWaveSetTargetUnit (int player, unit u);
native void AIAttackWaveSetTargetUnitGroup (int player, unitgroup ug);
native void AIAttackWaveSetTargetUnitPoint (int player, unit u);
native void AIAttackWaveSetTargetPoint (int player, point p);
native void AIAttackWaveSetTargetPlayer (int player, playergroup players);
native void AIAttackWaveSetTargetMelee (int player);
native void AIAttackWaveSetTargetMeleeHarass (int player);
native void AIAttackWaveSetTargetMeleeDrop (int player, point dropLoc, point goalLoc);
native void AIAttackWaveSetTargetMeleeDefend (int player);
native void AIAttackWaveSetTargetMerge (int player, wave w);
native void AIAttackWaveSetTargetPatrol (int player, int replaceType);
native void AIAttackWaveSetTargetEscort (int player, unitgroup g, int replaceType);
native void AIAttackWaveSetTargetEscortNL (int player, unitgroup g, int replaceType);
native void AIAttackWaveSetTargetGatherO (int player, int town);
native void AIAttackWaveSetTargetGatherD (int player, int town);
native void AIAttackWaveSetTargetRegion (int player, region r, int replaceType);
native void AIAttackWaveSetGatherEarlyNoReplace (int player);
native void AIAttackWaveSetKeepAlive (int player);
native void AIAttackWaveAddWaypoint (int player, point waypoint, bool useTransport);
native void AIAttackWaveClearWaypoints (int player);
native void AISetMinimumBullyCount (int count, string unitType, int player);
native void AISetGeneralRebuildCount (int count, bool building, int player);
native void AISetSpecificRebuildCount (int count, string unitType, int player);
native void AISetBullyAttackWavePercent (int percent, int player);
native void AINearestTownLimitWaveGather (int player, bool enable);
native void AINearestTownBullyRebuild (int player, bool enable);
native void AIToggleBulliesInRegion (int player, region reg, bool activate);
native void AIResetBullyRebuildCountsInRegion (int player, region reg);
native void AIClearAllBullies (int player);
native void AIAddBully (int player, string unitType, point loc, int rebuildCount);
native string AIGetBullyType (unit u);

//TacticalAI
native aifilter AIFilter (int player);
native void AISetFilterAlliance (aifilter filter, int want);
native void AISetFilterMarker (aifilter filter, int min, int max, marker m);
native void AISetFilterSelf (aifilter filter, unit exclude);
native void AISetFilterBits (aifilter filter, unitfilter uf);
native void AISetFilterRange (aifilter filter, unit center, fixed radius);
native void AISetFilterLife (aifilter filter, fixed min, fixed max);
native void AISetFilterLifeLost (aifilter filter, fixed min, fixed max);
native void AISetFilterLifePercent (aifilter filter, fixed min, fixed max);
native void AISetFilterLifeSortReference (aifilter filter, fixed value, fixed distance);
native void AISetFilterLifeMod (aifilter filter, int type, fixed mod);
native void AISetFilterLifePerMarker (aifilter filter, fixed each, marker m);
native void AISetFilterShields (aifilter filter, fixed min, fixed max);
native void AISetFilterPlane (aifilter filter, int plane);
native void AISetFilterCanAttackEnemy (aifilter filter, int enemyGroundCount, int enemyAirCount);
native void AISetFilterCanAttackAlly (aifilter filter, bool groundAllies, bool airAllies);
native void AISetFilterBehaviorCount (aifilter filter, int minBehavior, int maxBehavior, string behaviorType);
native unitgroup AIGetFilterGroup (aifilter filter, unitgroup group);
native unitgroup AIFilterCasters (unitgroup group);
native unitgroup AIFilterPathable (unitgroup group, point inStart);
native unitgroup AIFilterGathering (unitgroup group, int inResource, fixed distance);
native fixed AIUnitGroupStrength (unitgroup inGroup);
native fixed AIAllyEnemyRatio (int player, point p, unitfilter filter, fixed range, fixed minThreshold);
native bool AIIsFollowingUnit (unit aiUnit, string unitType);
native int AIGetPlayerGroup (unitgroup inGroup);
native bool AINearbyPlaneTest (point p, int player, fixed range, int inPlane, int inAlliance);
native void AISetTacticalAttackTargetPoint (unit u, point t);
native void AISetTacticalAttackTargetUnit (unit u, unit t);
native order AIUnitGroupGetValidOrder(unitgroup inGroup, order inOrder, unit caster, bool forwards);

//sc2
native trigger TriggerCreate (string s);
native void TriggerDestroy (trigger t);
native void TriggerExecute (trigger t, bool testConds, bool runActions);
native void TriggerAddEventMapInit (trigger t);
 
Status
Not open for further replies.
Top