Jesus4Lyf
Good Idea™
- Reaction score
- 397
Seems silly asking why it doesn't work, but hey, why not...
In my map I have 20 Zerglings owned by player 2, which are successfully enumerated into a group. Unfortunately, when they should be issued an order, nothing happens. The text displays, etc, but the Zerglings just don't move.
Any ideas?
JASS:
//==================================================================================================
//
// Map Script
//
// Name: First TD
// Author: Jesus4Lyf
//
//==================================================================================================
//--------------------------------------------------------------------------------------------------
// Libs
//--------------------------------------------------------------------------------------------------
include "TriggerLibs/NativeLib"
//include "TriggerLibs/natives"
void InitLibs () {
libNtve_InitLib();
}
//--------------------------------------------------------------------------------------------------
// Snippets
//--------------------------------------------------------------------------------------------------
void WriteLine(string message){
UIDisplayMessage(PlayerGroupAll(),c_messageAreaSubtitle,StringToText(message));
}
void WriteError(string message){
WriteLine("ERROR: "+message);
}
unitgroup PlayerUnits(int player){
return AIFindUnits(player,null,Point(0,0),500000,c_noMaxCount);
}
void SpawnThread(string funcName){
TriggerAddEventMapInit(TriggerCreate(funcName));
}
int IssuePointOrder(unit whichUnit, string abilLink, point targPoint) {
abilcmd cmd=AbilityCommand(abilLink,0);
order ord;
if (cmd==c_nullCmd){
WriteError("null abilcmd returned from AbilityCommand(abilLink,0).");
}
ord = Order(cmd);
if (ord==null){
WriteError("null order returned from Order(cmd).");
}
OrderSetPlayer(ord,UnitGetOwner(whichUnit));
OrderSetTargetPoint(ord,targPoint);
if (!UnitOrderIsValid(whichUnit,ord)){
WriteError("order not valid for unit.");
}
return AICast(whichUnit,ord,c_noMarker,c_castHold);
}
void IssuePointOrderGroup(unitgroup src, string abilLink, point targPoint){
int count=UnitGroupCount(src,c_unitCountAll);
while(count>0){
IssuePointOrder(UnitGroupUnit(src,count),abilLink,targPoint);
count-=1;
}
}
// Countdown Timer
int countdownTimer=30;
void onCountdownExpire();
bool threadCountdownUpkeep (bool testConds, bool runActions) {
while(true){
UIDisplayMessage(PlayerGroupAll(),2,StringToText(IntToString(countdownTimer)));
Wait(1,0);
countdownTimer-=1;
if(countdownTimer==0){
onCountdownExpire();
}
}
return true;
}
//--------------------------------------------------------------------------------------------------
// Code
//--------------------------------------------------------------------------------------------------
void onCountdownExpire(){
WriteLine("The Zerglings! They come!");
AIStart(2, false, 4000);
IssuePointOrderGroup(PlayerUnits(2),c_AB_Move,Point(80,80));
}
//--------------------------------------------------------------------------------------------------
// Melee Initialisation
//--------------------------------------------------------------------------------------------------
bool gt_MeleeInitialization_Func (bool testConds, bool runActions) {
MeleeInitResources();
MeleeInitUnits();
MeleeInitAI();
MeleeInitOptions();
return true;
}
//--------------------------------------------------------------------------------------------------
// Trigger Initialisation
//--------------------------------------------------------------------------------------------------
void InitTriggers () {
SpawnThread("gt_MeleeInitialization_Func");
SpawnThread("threadCountdownUpkeep");
}
//--------------------------------------------------------------------------------------------------
// Map Initialisation
//--------------------------------------------------------------------------------------------------
void InitMap(){
InitLibs();
InitTriggers();
}
In my map I have 20 Zerglings owned by player 2, which are successfully enumerated into a group. Unfortunately, when they should be issued an order, nothing happens. The text displays, etc, but the Zerglings just don't move.
Any ideas?