In an attempt to set up an AI, I started off by writing some functions just to test... Here they are
The file is included in Protoss.GALAXY...
And I call them here...
They work as intended as they are above, but then I decided to try to make them function for building, the game doesn't take... Here's what I was attempting to do....
I beleive I need to set a state before I can start calling stock functions, or I need to call them from another place.. I tried alot of different things, but I can't figure it out. Anyone have an explaination on setting up an entry for this kind of call. I would really appreciate any help
Code Select
//==================================================================================================
// My Functions
//==================================================================================================
void Message(int player, string msg){
int i = FixedToInt(AIGetTime());
msg = PlayerRace(player) + " " + IntToString(player) + msg + " Time = " + IntToString(i);
UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, StringToText(msg));
}
void One(int player){
string msg = "Func One";
Message(player, msg);
}
void Two(int player){
string msg = "Func Two";
Message(player, msg);
}
void Three(int player){
string msg = "Func Three";
Message(player, msg);
}
The file is included in Protoss.GALAXY...
Code Select
//==================================================================================================
// Protoss Melee AI
//==================================================================================================
include "TriggerLibs/Protoss0"
include "TriggerLibs/MyProtoss"
//-----------------------------------------------------------------------------------
// Counter-Attack Units
//-----------------------------------------------------------------------------------
And I call them here...
Code Select
//-----------------------------------------------------------------------------------
// AIMeleeProt
//-----------------------------------------------------------------------------------
void AIMeleeProt (int player) {
int mainState = AIState(player, e_mainState);
if (mainState == e_mainState_Init) { ProtossInit(player); }
One(player);
Twoplayer);
Three(player);
}
They work as intended as they are above, but then I decided to try to make them function for building, the game doesn't take... Here's what I was attempting to do....
Code Select
//==================================================================================================
// My Functions
//==================================================================================================
void Message(int player, string msg){
int i = FixedToInt(AIGetTime());
msg = PlayerRace(player) + " " + IntToString(player) + msg + " Time = " + IntToString(i);
UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, StringToText(msg));
}
void One(int player){
AIClearStock(player);
if(AITechCount(player, c_PU_Probe, c_techCountCompleteOnly) < 8){
AISetStock(player, 8, c_PU_Probe);
}
string msg = "Func One";
Message(player, msg);
}
void Two(int player){
AIClearStock(player);
if(AITechCount(player, c_PU_Probe, c_techCountCompleteOnly) >= 8){
AISetStock(player, 1, c_PB_Pylon);
AISetStock(player, 1, c_PB_Assimilator);
AISetGasPeonCountOverride(player, c_townMain, 3);
}
string msg = "Func Two";
Message(player, msg);
}
void Three(int player){
AIClearStock(player);
if(AITechCount(player, c_PU_Probe, c_techCountCompleteOnly) >= 8
&& AITechCount(player, c_PB_Pylon, c_techCountCompleteOnly) >= 1
&& AITechCount(player, c_PB_Assimilator, c_techCountCompleteOnly) >= 1){
AISetStock(player, 1, c_PB_Gateway);
AISetStock(player, 2, c_PB_Pylon);
AISetStock(player, 11, c_PU_Probe);
}
string msg = "Func Three";
Message(player, msg);
}
I beleive I need to set a state before I can start calling stock functions, or I need to call them from another place.. I tried alot of different things, but I can't figure it out. Anyone have an explaination on setting up an entry for this kind of call. I would really appreciate any help