//==================================================================================================
//
// Generated Map Script
//
// Name: Just Another StarCraft II Map
// Author: Unknown Author
//
//==================================================================================================
include "TriggerLibs/NativeLib"
//--------------------------------------------------------------------------------------------------
// Library Initialization
//--------------------------------------------------------------------------------------------------
void InitLibs () {
libNtve_InitLib();
}
//--------------------------------------------------------------------------------------------------
// Global Variables
//--------------------------------------------------------------------------------------------------
int[16] gv_fixed15gv_playerTowersCount;
void InitGlobals () {
int init_i;
init_i = 0;
while (init_i <= 15) {
gv_fixed15gv_playerTowersCount[init_i] = 0;
init_i = init_i + 1;
}
}
//--------------------------------------------------------------------------------------------------
// Trigger Variables
//--------------------------------------------------------------------------------------------------
trigger gt_MeleeInitialization;
trigger gt_Teamcolor;
trigger gt_Team;
trigger gt_Team2;
//--------------------------------------------------------------------------------------------------
// Custom Script: Resources to each player
//--------------------------------------------------------------------------------------------------
const fixed c_towerIncomeUpdateInterval = 1.0;
const fixed c_towerIncome = 1.0;
trigger gt_TowerIncome = TriggerCreate("gt_TowerIncome_Func");
trigger gt_TowerIncome = TriggerCreate("gt_TowerIncomeUpdate_Func");
fixed[fixed[14] gv_playerTowersCount] gv_playerTowersCount;
bool gt_TowerIncomeUpdate_Func (bool testConds, bool runActions) {
int lv_i;
while (lv_i fixed[14] gv_playerTowersCount <= number_of_players_in_your_map_goes_here) {
PlayerModifyPropertyFixed(lv_i, c_playerPropMinerals, c_playerPropOperAdd, c_towerIncome);
lv_i += 1;
}
return true;
}
// Players play in two teams and I have created two player groups.
// Players can control Xel naga towers scattered around the map.
// Every interval of game time each member in both team gains
// resources depending on how many towers they control.
bool gt_TowerIncome_Func (bool testConds, bool runActions) {
// ------------------------- Interface -------------------------
const string lv_tower = "XelNagaTower";
const int lv_income = 1;
// Set the tower string to your tower ID, I probably have it set
// right already (look that up in the data manager). The income
// is how much of the given resource is earned per tower.
// -------------------------------------------------------------
unit lv_u = EventUnit();
string lv_ut = UnitGetType(lv_u);
int lv_p1 = EventUnitOwnerOld();
int lv_p2 = EventUnitOwnerNew();
if (lv_ut != lv_tower) {
return true;
}
gv_playerTowersCount[lv_p1] += -1;
gv_playerTowersCount[lv_p2] += 1;
return true;
}
//--------------------------------------------------------------------------------------------------
void gt_TowerIncome_Init () {
// Register Unit Ownership Change Event
TriggerAddEventUnitChangeOwner(gt_TowerIncome, null);
TriggerAddEventTimePeriodic(gt_TowerIncomeUpdate, c_towerIncomeUpdateInterval, c_timeReal);
//--------------------------------------------------------------------------------------------------
// Custom Script Initialization
//--------------------------------------------------------------------------------------------------
void InitCustomScript () {
}
//--------------------------------------------------------------------------------------------------
// Trigger: Melee Initialization
//--------------------------------------------------------------------------------------------------
bool gt_MeleeInitialization_Func (bool testConds, bool runActions) {
// Actions
if (!runActions) {
return true;
}
MeleeInitUnits();
MeleeInitAI();
MeleeInitOptions();
return true;
}
//--------------------------------------------------------------------------------------------------
void gt_MeleeInitialization_Init () {
gt_MeleeInitialization = TriggerCreate("gt_MeleeInitialization_Func");
TriggerAddEventMapInit(gt_MeleeInitialization);
}
//--------------------------------------------------------------------------------------------------
// Trigger: Team color
//--------------------------------------------------------------------------------------------------
bool gt_Teamcolor_Func (bool testConds, bool runActions) {
// Actions
if (!runActions) {
return true;
}
PlayerSetColorIndex(1, 1, true);
PlayerSetColorIndex(2, 1, true);
PlayerSetColorIndex(3, 1, true);
PlayerSetColorIndex(4, 1, true);
PlayerSetColorIndex(5, 1, true);
PlayerSetColorIndex(6, 1, true);
PlayerSetColorIndex(7, 1, true);
PlayerSetColorIndex(8, 2, true);
PlayerSetColorIndex(9, 2, true);
PlayerSetColorIndex(10, 2, true);
PlayerSetColorIndex(11, 2, true);
PlayerSetColorIndex(12, 2, true);
PlayerSetColorIndex(13, 2, true);
PlayerSetColorIndex(14, 2, true);
return true;
}
//--------------------------------------------------------------------------------------------------
void gt_Teamcolor_Init () {
gt_Teamcolor = TriggerCreate("gt_Teamcolor_Func");
TriggerAddEventMapInit(gt_Teamcolor);
}
//--------------------------------------------------------------------------------------------------
// Trigger: Team
//--------------------------------------------------------------------------------------------------
bool gt_Team_Func (bool testConds, bool runActions) {
// Variable Declarations
playergroup lv_team1;
// Variable Initialization
lv_team1 = PlayerGroupEmpty();
// Actions
if (!runActions) {
return true;
}
PlayerGroupAdd(lv_team1, 1);
PlayerGroupAdd(lv_team1, 2);
PlayerGroupAdd(lv_team1, 3);
PlayerGroupAdd(lv_team1, 4);
PlayerGroupAdd(lv_team1, 5);
PlayerGroupAdd(lv_team1, 6);
PlayerGroupAdd(lv_team1, 7);
libNtve_gf_SetPlayerGroupAlliance(lv_team1, 1);
return true;
}
//--------------------------------------------------------------------------------------------------
void gt_Team_Init () {
gt_Team = TriggerCreate("gt_Team_Func");
TriggerAddEventMapInit(gt_Team);
}
//--------------------------------------------------------------------------------------------------
// Trigger: Team 2
//--------------------------------------------------------------------------------------------------
bool gt_Team2_Func (bool testConds, bool runActions) {
// Variable Declarations
playergroup lv_Team2;
// Variable Initialization
lv_Team2 = PlayerGroupEmpty();
// Actions
if (!runActions) {
return true;
}
PlayerGroupAdd(lv_Team2, 8);
PlayerGroupAdd(lv_Team2, 9);
PlayerGroupAdd(lv_Team2, 10);
PlayerGroupAdd(lv_Team2, 11);
PlayerGroupAdd(lv_Team2, 12);
PlayerGroupAdd(lv_Team2, 13);
PlayerGroupAdd(lv_Team2, 14);
libNtve_gf_SetPlayerGroupAlliance(lv_Team2, 1);
return true;
}
//--------------------------------------------------------------------------------------------------
void gt_Team2_Init () {
gt_Team2 = TriggerCreate("gt_Team2_Func");
TriggerAddEventMapInit(gt_Team2);
}
//--------------------------------------------------------------------------------------------------
// Trigger Initialization
//--------------------------------------------------------------------------------------------------
void InitTriggers () {
gt_MeleeInitialization_Init();
gt_Teamcolor_Init();
gt_Team_Init();
gt_Team2_Init();
}
//--------------------------------------------------------------------------------------------------
// Map Initialization
//--------------------------------------------------------------------------------------------------
void InitMap () {
InitLibs();
InitGlobals();
InitCustomScript();
InitTriggers();
}