Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-

.galaxy (SCII)

Name: Anonymous 2012-03-02 12:23

What do you guys think of SCII's scripting language .galaxy?

playergroup gv_allPlayers = PlayerGroupAll();
void gf_exampleFunc () {
    text lv_txtPlayer = StringToText("Player ")
    text lv_txt = StringToText(" is a nigger.");
    int  lv_i;

    while(lv_i <= c_maxPlayers) {
        UIDisplayMessage(gv_allPlayers, c_messageAreaDebug, lv_txtPlayer + IntToText(lv_i) + lv_txt);
        lv_i += 1;
    }
}

Name: Anonymous 2012-03-02 12:25

Adding it to the shitty toy languages thread as we speak.

Name: Anonymous 2012-03-02 12:27

Should I stop using prefixes so much btw?

lv_ is local variable
gf_ is global function
gv_ is global variable
c_ is constant
lp_ is local parameter
gt_ is game trigger
etc.

I think I should only use c_ and gv_ probably, and I usually neglect using gf_ or gt_ when naming my functions. Prefixes are not necessary at all I just use them because from what I've seen from the GUI generated code it uses them.

Name: Anonymous 2012-03-02 12:31

Name: Anonymous 2012-03-02 12:35

>>4
amidoinitritenow?

playergroup gv_allPlayers = PlayerGroupAll();
void exampleFunc () {
    text txtPlayer = StringToText("Player ")
    text txt = StringToText(" is a nigger.");
    int  i;

    while(i <= c_maxPlayers) {
        UIDisplayMessage(gv_allPlayers, c_messageAreaDebug, lv_txtPlayer + IntToText(i) + txt);
        i += 1;
    }
}

Name: Anonymous 2012-03-02 12:36

>>5
text txtPlayer

No.

Name: Anonymous 2012-03-02 12:37

Oh shit I forgot that function names don't normally use camelCase, that's just for variables.

Name: Anonymous 2012-03-02 12:39

>>6
whataboutnaow?

playergroup gv_allPlayers = PlayerGroupAll();
void exampleFunc () {
    text txt = StringToText("Player ")
    text txt2 = StringToText(" is a nigger.");
    int  i;

    while(i <= c_maxPlayers) {
        UIDisplayMessage(gv_allPlayers, c_messageAreaDebug, txt + IntToText(i) + txt2);
        i += 1;
    }
}

Name: Anonymous 2012-03-02 12:43

>>8
It's alright, but you should give your variables more meaningful names.

gv_playergroup might be better as playersInGame or just allPlayers.
text txt would be better as text playerName.
text txt2 it's hard to tell what this does from the name. text msg would be better.

Name: Anonymous 2012-03-02 12:50

playergroup is the name for a kind of variable in .galaxy

void ExampleFunc () {
    text playerName = StringToText("Player ");
    text msg = StringToText(" is a nigger.");
    int  i;

    while(i < c_maxPlayers) {
        UIDisplayMessage(gv_allPlayers, c_messageAreaDebug, playerName + IntToText(i) + msg);
        i += 1;
    }
}

I could also do it this way:

void ExampleFunc2 () {
    text msg = StringToText(" is a nigger.");
    int  i;

    while(i < c_maxPlayers) {
        UIDisplayMessage(gv_allPlayers, c_messageAreaDebug, PlayerName(i) + msg); //PlayerName shows the players name instead of like I had it before where it says "Player " then the number of the player.
        i += 1;
    }
}

I changed the <= to < because c_maxPlayers = 16 but player 16 is an invalid player you only ever get when you kill something with the script instead of a unit being killed by a players effect, unit, or whatever ingame.

Name: Anonymous 2012-03-02 12:52

Perfected?

playergroup allPlayers = PlayerGroupAll();
void ExampleFunc () {
    text msg = StringToText(" is a nigger.");
    int  i;

    while(i < c_maxPlayers) {
        UIDisplayMessage(allPlayers, c_messageAreaDebug, PlayerName(i) + msg); //PlayerName shows the players name instead of like I had it before where it says "Player " then the number of the player.
        i += 1;
    }
}

So how come .galaxy is a shit language? If I learn a proper language what should I be using? C++?

Name: Anonymous 2012-03-02 12:56

Normally I have all the player names saved at map init to an array btw, one array with colour and the other without.

Name: Anonymous 2012-03-02 12:57

>>11
Learn how to match up braces buddy.
Like this

playergroup allPlayers = PlayerGroupAll();
void ExampleFunc ()
{
    text msg = StringToText(" is a nigger.");
    int  i;

    while(i < c_maxPlayers)
    {
        UIDisplayMessage(allPlayers, c_messageAreaDebug, PlayerName(i) + msg); //PlayerName shows the players name instead of like I had it before where it says "Player " then the number of the player.
        i += 1;
    }
}

Name: Anonymous 2012-03-02 13:03

>>13
That makes my code very long though and there's this retarded limit we have on how many lines of code we can have at max because Activision-blizzard herps hard. How did you use syntax hilighting?

http://us.battle.net/sc2/en/forum/topic/3082083704
http://us.battle.net/sc2/en/forum/topic/3053757933

Name: Anonymous 2012-03-02 13:04

>>11
.galaxy is most likely just a set of header files written in C++, so you're already using the master race language.

Name: Anonymous 2012-03-02 13:10

>>14
BBCode: http://www.bbcode.org/reference.php

What is the LOC limit?

Name: Anonymous 2012-03-02 13:10

>>15
This is a comment taken from the .natives list

// A02  Well, it might.  But it's also a simply explained rule.  No one will remember the
//      alternative, which is something like actors/scopes created by ActorCreate, and create
//      messages sent by the user.  It also leads to simpler, less bug-prone C++ code on my end. :)

>dat C++
:D

Name: Anonymous 2012-03-02 13:15

>>16
I am not sure what a LOC limit is.

www.google.ca/search?q=LOC+limit+.galaxy+SC2

Name: Anonymous 2012-03-02 13:19

>>18
I'm pretty sure it means "lines of code".

Name: Anonymous 2012-03-02 13:29

http://www.sc2mapster.com/forums/development/galaxy-scripting-and-trigger-lib/16997-imported-script-limit/


I don't think there's a limit on lines of code...

I'll post my entire map script here later (if possible, might have to reset my router to factory defaults when getting home...)


It's about 82,000 characters long. Maybe some of you can help steer me on the right path and avoid doing stupid stuff I am probably doing.

Name: Anonymous 2012-03-02 13:38

Btw, the minimum wait time for a timer or a pause in a thread is 0.0625 and every wait is a multiple of that.

Any idea why is it 0.0625 (1/16 of a second) specifically?

Name: Anonymous 2012-03-02 13:48

>>20
Then do this >>13 .

Name: Anonymous 2012-03-02 13:49

it looks like a crippled C

it's shit

Name: Anonymous 2012-03-02 13:57

The most important point from the wikipedia article:

Most of the time, knowing the use of a variable implies knowing its type. Furthermore, if the usage of a variable is not known, it cannot be deduced from its type.

The job of the variable name is to describe the role of the variable. If your name is descriptive enough, you shouldn't need to explicitly indicate the datatype. In my opinion, if a variable name feels like it could use a type identifier, it means the semantics chosen are not accurately describing the variable's role.

Note that this is not usually the case with object instances, because the name they'd be borrowing from (the class being instantiated) would have also been named using these same criteria -- hence the "type" will have additional semantic meaning.

Name: Anonymous 2012-03-02 14:39

//==================================================================================================
//
// Generated Map Script
//
// Name:   Blue Physics
// Author: BlueBerryWizard
//
//==================================================================================================
include "TriggerLibs/NativeLib"

//--------------------------------------------------------------------------------------------------
// Library Initialization
//--------------------------------------------------------------------------------------------------
void InitLibs () {
    libNtve_InitLib();
}

//--------------------------------------------------------------------------------------------------
// Custom Script: Map Constants
//--------------------------------------------------------------------------------------------------
// ALLIANCE CONSTANTS
const int           c_allianceEnemy     = 5;
const int           c_allianceAlly      = 2; // Includes pushable & shared vision
// PROJECTILE CONSTANTS
const string        c_projectile        = "Projectile";
const string        c_projModelDefault  = "LaserTurretWeapon";
const string        c_projModelBolt     = "AcidSpinesWeapon";
const string        c_projModelRocket   = "BacklashRocketsLMWeapon";
const string        c_projTimedLifeBuff = "ProjTimedLife";
// ABILITIES
const string        c_projFireAbility   = "AttackGround";
const string        c_jumpAbility       = "Jump";
// DAMAGE EFFECTS
const string        c_damageProjectile  = "DamageProjectile";
const string        c_damageNormal      = "DamageNormal";
// INDEX CONSTANTS
const int           c_uIndex            = 1;
const int           c_IndexArraySize    = 8193;
// MISC
const int           gv_maxPlayers       = 14;
const fixed         c_mapVersionNum     = 0.11;
const string        c_mapInfoString     = "<c val=\"49FAF6\">Physics simulation<c val=\"43C5F4\"> v" + FixedToString(c_mapVersionNum, 2) + "</n><s val=\"ModCenterSize14Bold\"><c val=\"2E99FA\">BlueBerryWizard@gmail.com";

//--------------------------------------------------------------------------------------------------
// Custom Script: Map Variables
//--------------------------------------------------------------------------------------------------
// Player groups
playergroup             gv_allPlayers           = PlayerGroupAll();
playergroup             gv_activePlayers        = PlayerGroupActive();
// Player names & attributes
color[16]               gv_playerColor;
text[16]                gv_playerName;
text[16]                gv_playerNameColored;
// Unit Attributes
bool[c_IndexArraySize]  gv_unitIndex;
int[c_IndexArraySize]   gv_uWeapon;
// Test
unit                    gv_volcanoMarine;

//--------------------------------------------------------------------------------------------------
// Custom Script: Terrain Gen Variables
//--------------------------------------------------------------------------------------------------
int gv_terrainDialog;
int gv_terrainLabel;

//--------------------------------------------------------------------------------------------------
// Custom Script: Physics Variables
//--------------------------------------------------------------------------------------------------
//---------- Configurable Constants ----------
const fixed  c_physicsTimerInterval = 0.05;
const fixed  c_gravity              = 9.8;
const string c_gravityBehavior      = "Gravity";
const string c_collideBehaviour     = "Collide";
const string c_jumpBehavior         = "Jump";
fixed        c_friction             = 0.765;
//--------------------------------------------
// Position
fixed[c_IndexArraySize] gv_posX;
fixed[c_IndexArraySize] gv_posY;
fixed[c_IndexArraySize] gv_posZ;
// Velocity
fixed[c_IndexArraySize] gv_velX;
fixed[c_IndexArraySize] gv_velY;
fixed[c_IndexArraySize] gv_velZ;
// Acceleration
fixed[c_IndexArraySize] gv_accelX;
fixed[c_IndexArraySize] gv_accelY;
fixed[c_IndexArraySize] gv_accelZ;
// Physics behaviours
int[c_IndexArraySize]   gv_phyBehvSet;
// Projectile Attributes
fixed[c_IndexArraySize] gv_projDmg;
// Physics unit group
unitgroup   gv_physicsUG    = UnitGroupEmpty();
// Physics trigger and timer
trigger     gt_physics      = TriggerCreate("gt_Physics_Func");
timer       gv_physicsTimer = TimerCreate();

Name: Anonymous 2012-03-02 14:40

//--------------------------------------------------------------------------------------------------
// Custom Script: Physics Behaviours Table
//--------------------------------------------------------------------------------------------------
// --------------------- Physics Behaviour Table ---------------------
const int c_phyBehvArraySize = 4;
bool[c_phyBehvArraySize] gv_useGravity;
bool[c_phyBehvArraySize] gv_useBounce;
bool[c_phyBehvArraySize] gv_bounceEndDie;
bool[c_phyBehvArraySize] gv_slideEndDie;
// ------------------- Physics Behaviour Table End -------------------
void gt_MapLoadPhysicsBehaviour_Init () {
    // Default physics behaviour set
    gv_useGravity[0]    = true;
    gv_useBounce[0]     = true;
    gv_slideEndDie[0]   = false;
    gv_bounceEndDie[0]  = false;
    // Physics behaviours for ball gun 1 & 2
    gv_useGravity[1]    = true;
    gv_useBounce[1]     = true;
    gv_slideEndDie[1]   = true;
    gv_bounceEndDie[1]  = false;
    // Rocket launcher & grenade launcher
    gv_useGravity[2]    = true;
    gv_useBounce[2]     = false;
    gv_slideEndDie[2]   = true;
    gv_bounceEndDie[2]  = true;
    // Assault rifle
    gv_useGravity[3]    = false;
    gv_useBounce[3]     = false;
    gv_slideEndDie[3]   = true;
    gv_bounceEndDie[3]  = true;
}

//--------------------------------------------------------------------------------------------------
// Custom Script: Weapons Table
//--------------------------------------------------------------------------------------------------
// --------------------- Weapons Table ---------------------
const int c_weaponArraySize = 10;
// Weapon Info
string[c_weaponArraySize]   gv_weaponName;
string[c_weaponArraySize]   gv_weaponAmmoUsed;
// Weapon Art
string[c_weaponArraySize]   gv_weaponProjModel;
string[c_weaponArraySize]   gv_weaponProjDeathModel;
string[c_weaponArraySize]   gv_weaponProjTint;
// Weapon Projectile Attributes
fixed[c_weaponArraySize]    gv_weaponProjSize;
fixed[c_weaponArraySize]    gv_weaponProjSpeedMin;
fixed[c_weaponArraySize]    gv_weaponProjSpeedMax; // Should be same as above if not using an arc
fixed[c_weaponArraySize]    gv_weaponProjZVel;
fixed[c_weaponArraySize]    gv_weaponDamage;
fixed[c_weaponArraySize]    gv_weaponTimedLife;
int[c_weaponArraySize]      gv_weaponPhyBehvSet;
// Weapon Attributes
int[c_weaponArraySize]      gv_weaponProjPerShot;
fixed[c_weaponArraySize]    gv_weaponSpray;
fixed[c_weaponArraySize]    gv_weaponSprayZ;
fixed[c_weaponArraySize]    gv_weaponInterval;
// ------- Weapons -------
// Configured below the table.
const int c_ballGunID        = 1;
const int c_ballGun2ID       = 2;
const int c_rocketLauncherID = 3;
// ------------------- Weapons Table End -------------------
void gt_MapLoadWeapons_Init () {
    int i;
    // ------- Weapons -------
    // Total weapons: 6
    // Ball Gun
    i += 1;
    gv_weaponName[i]            = "Ball Gun";
    gv_weaponAmmoUsed[i]        = "Ball";
    gv_weaponProjModel[i]       = "ShapeGolfball";
    gv_weaponProjDeathModel[i]  = "TossGrenadeImpact";
    gv_weaponProjTint[i]        = "55,185,155";
    gv_weaponProjSize[i]        = 100;
    gv_weaponProjSpeedMin[i]    = 2.65;
    gv_weaponProjSpeedMax[i]    = 12.0;
    gv_weaponProjZVel[i]        = 20.0;
    gv_weaponDamage[i]          = 15.0;
    gv_weaponProjPerShot[i]     = 5;
    gv_weaponSpray[i]           = 5.0;
    gv_weaponSprayZ[i]          = 5.0;
    gv_weaponInterval[i]        = 0.2;
    gv_weaponTimedLife[i]       = 30.0;
    gv_weaponPhyBehvSet[i]      = 1;
    // Ball Gun 2
    i += 1;
    gv_weaponName[i]            = "Ball Gun 2";
    gv_weaponAmmoUsed[i]        = "Ball";
    gv_weaponProjModel[i]       = "ShapeSphere";
    gv_weaponProjDeathModel[i]  = "TossGrenadeImpact";
    gv_weaponProjTint[i]        = "80,210,255";
    gv_weaponProjSize[i]        = 50;
    gv_weaponProjSpeedMin[i]    = 0.2;
    gv_weaponProjSpeedMax[i]    = 16.0;
    gv_weaponProjZVel[i]        = 10.0;
    gv_weaponDamage[i]          = 7.5;
    gv_weaponProjPerShot[i]     = 1;
    gv_weaponSpray[i]           = 5.0;
    gv_weaponSprayZ[i]          = 5.0;
    gv_weaponInterval[i]        = 0.1;
    gv_weaponTimedLife[i]       = 30.0;
    gv_weaponPhyBehvSet[i]      = 0;
    // Rocket Launcher
    i += 1;
    gv_weaponName[i]            = "Rocket Launcher";
    gv_weaponAmmoUsed[i]        = "Rocket";
    gv_weaponProjModel[i]       = "BacklashRocketsLMWeapon";
    gv_weaponProjDeathModel[i]  = "ObliterateExplosion";
    gv_weaponProjTint[i]        = "255,225,255";
    gv_weaponProjSize[i]        = 150;
    gv_weaponProjSpeedMin[i]    = 15.0;
    gv_weaponProjSpeedMax[i]    = 15.0;
    gv_weaponProjZVel[i]        = 0.5;
    gv_weaponDamage[i]          = 100.0;
    gv_weaponProjPerShot[i]     = 1;
    gv_weaponSpray[i]           = 0.0;
    gv_weaponSprayZ[i]          = 0.0;
    gv_weaponInterval[i]        = 0.1;
    gv_weaponTimedLife[i]       = 30.0;
    gv_weaponPhyBehvSet[i]      = 2;
    // AK-47 Assault Rifle
    i += 1;
    gv_weaponName[i]            = "AK-47 Assault Rifle";
    gv_weaponAmmoUsed[i]        = "Rifle";
    gv_weaponProjModel[i]       = "SwannWeapon";
    gv_weaponProjDeathModel[i]  = "ObliterateExplosion";
    gv_weaponProjTint[i]        = "255,225,255";
    gv_weaponProjSize[i]        = 40;
    gv_weaponProjSpeedMin[i]    = 20.0;
    gv_weaponProjSpeedMax[i]    = 20.0;
    gv_weaponProjZVel[i]        = 0.0;
    gv_weaponDamage[i]          = 60.0;
    gv_weaponProjPerShot[i]     = 30;
    gv_weaponSpray[i]           = 8.0;
    gv_weaponSprayZ[i]          = 1.0;
    gv_weaponInterval[i]        = 0.1;
    gv_weaponTimedLife[i]       = 10.0;
    gv_weaponPhyBehvSet[i]      = 3;
    // Grenade Launcher
    i += 1;
    gv_weaponName[i]            = "Grenade Launcher";
    gv_weaponAmmoUsed[i]        = "Grenade";
    gv_weaponProjModel[i]       = "TossGrenadeWeapon";
    gv_weaponProjDeathModel[i]  = "ObliterateExplosion";
    gv_weaponProjTint[i]        = "255,225,255";
    gv_weaponProjSize[i]        = 100;
    gv_weaponProjSpeedMin[i]    = 0.2;
    gv_weaponProjSpeedMax[i]    = 5.0;
    gv_weaponProjZVel[i]        = 6.0;
    gv_weaponDamage[i]          = 300.0;
    gv_weaponProjPerShot[i]     = 1;
    gv_weaponSpray[i]           = 0.0;
    gv_weaponSprayZ[i]          = 0.0;
    gv_weaponInterval[i]        = 0.0;
    gv_weaponTimedLife[i]       = 30.0;
    gv_weaponPhyBehvSet[i]      = 2;
    // Volcano
    i += 1;
    gv_weaponName[i]            = "Volcano";
    gv_weaponAmmoUsed[i]        = "Magma";
    gv_weaponProjModel[i]       = "LavaSplashBig";
    gv_weaponProjDeathModel[i]  = "LavaSplashBig";
    gv_weaponProjTint[i]        = "255,255,255";
    gv_weaponProjSize[i]        = 100;
    gv_weaponProjSpeedMin[i]    = 0.2;
    gv_weaponProjSpeedMax[i]    = 12.0;
    gv_weaponProjZVel[i]        = 12.0;
    gv_weaponDamage[i]          = 15.0;
    gv_weaponProjPerShot[i]     = 3;
    gv_weaponSpray[i]           = 7.5;
    gv_weaponSprayZ[i]          = 5.0;
    gv_weaponInterval[i]        = 0.15;
    gv_weaponTimedLife[i]       = 30.0;
    gv_weaponPhyBehvSet[i]      = 1;
}

Name: Anonymous 2012-03-02 14:41

//--------------------------------------------------------------------------------------------------
// Custom Script: Trigger Globals
//--------------------------------------------------------------------------------------------------
// TRIGGER VARIABLES
trigger gt_onMessage        = TriggerCreate("gt_onMessage_Func");
trigger gt_onButtonPress    = TriggerCreate("gt_onButtonPress_Func");
trigger gt_onAbilityCommand = TriggerCreate("gt_onAbilityCommand_Func");
trigger gt_onJump           = TriggerCreate("gt_onJump_Func");
//trigger gt_onOrder          = TriggerCreate("gt_onOrder_Func");
trigger gt_onDeath          = TriggerCreate("gt_onDeath_Func");
trigger gt_onDamage         = TriggerCreate("gt_onDamage_Func");
// Map Load
trigger gt_MapLoad          = TriggerCreate("gt_MapLoad_Func");
// Vote Triggers
trigger gt_onVote           = TriggerCreate("gt_onVote_Func");
trigger gt_voteCountdown    = TriggerCreate("gt_voteCountdown_Func");

//--------------------------------------------------------------------------------------------------
// Custom Script: Debug Msg
//--------------------------------------------------------------------------------------------------
void DebugMsg (string lp_msg) {
    UIDisplayMessage(gv_allPlayers, c_messageAreaDebug, StringToText(lp_msg));
}

//--------------------------------------------------------------------------------------------------
// Custom Script: Index Unit
//--------------------------------------------------------------------------------------------------
int IndexUnit (unit lp_unit) {
    int lv_i = 1;
    while(gv_unitIndex[lv_i]) {
        if (lv_i > 8190) {
            DebugMsg("<c val=\"FF0000\">WARNING:</c> Stack overload.");
            break;
        }
        lv_i += 1;
    }
    gv_unitIndex[lv_i] = true;
    UnitSetCustomValue(lp_unit, c_uIndex, lv_i);
    //DebugMsg("<c val=\"FF0000\">CV:</c> " + IntToString(lv_i));
    return lv_i;
}

//--------------------------------------------------------------------------------------------------
// Custom Script: Custom Value
//--------------------------------------------------------------------------------------------------
int gf_CV (unit lp_unit) {
    return FixedToInt(UnitGetCustomValue(lp_unit, c_uIndex));
}

//--------------------------------------------------------------------------------------------------
// Custom Script: Ally Player
//--------------------------------------------------------------------------------------------------
// Function to set a player to be allied to another player.
void AllyPlayer (int lp_player1, int lp_player2, bool lp_ally) {   
    PlayerSetAlliance(lp_player1, c_allianceIdPassive, lp_player2, lp_ally);
    PlayerSetAlliance(lp_player1, c_allianceIdVision, lp_player2, lp_ally);
    //PlayerSetAlliance(lp_player1, c_allianceIdChat, lp_player2, lp_ally);
    PlayerSetAlliance(lp_player1, c_allianceIdTrade, lp_player2, lp_ally);
    PlayerSetAlliance(lp_player1, c_allianceIdPushable, lp_player2, lp_ally);
    PlayerSetAlliance(lp_player1, c_allianceIdSeekHelp, lp_player2, lp_ally);
    PlayerSetAlliance(lp_player1, c_allianceIdGiveHelp, lp_player2, lp_ally);
}

//--------------------------------------------------------------------------------------------------
// Custom Script: Apply Physics
//--------------------------------------------------------------------------------------------------
void ApplyPhysics (unit lp_unit, int lp_index, point lp_pos, point lp_posOffset, int lp_phyBehvSet) {
    // Position coordinates
    gv_posX[lp_index] = PointGetX(lp_pos);
    gv_posY[lp_index] = PointGetY(lp_pos);
    gv_posZ[lp_index] = PointGetHeight(lp_pos);
    // Velocity values
    gv_velX[lp_index] = PointGetX(lp_posOffset) - gv_posX[lp_index];
    gv_velY[lp_index] = PointGetY(lp_posOffset) - gv_posY[lp_index];
    gv_velZ[lp_index] = PointGetHeight(lp_posOffset) - gv_posZ[lp_index];
    // Acceleration values (set to default)
    gv_accelX[lp_index] = 0.0;
    gv_accelY[lp_index] = 0.0;
    gv_accelZ[lp_index] = 0.0;
    // Behaviours that apply under certain physics events
    gv_phyBehvSet[lp_index] = lp_phyBehvSet;
    // Physics unit group
    UnitGroupAdd(gv_physicsUG, lp_unit);
    // Projectile Collide Behaviour (already on projectiles by default)
    // UnitBehaviorAdd(lp_unit, c_collideBehaviour, lp_unit, 1);
}
void ApplyVelocity (int lp_index, fixed lp_accelerationX, fixed lp_accelerationY, fixed lp_accelerationZ) {
    // Acceleration values
    gv_accelX[lp_index] = lp_accelerationX;
    gv_accelY[lp_index] = lp_accelerationY;
    gv_accelZ[lp_index] = lp_accelerationZ;
}

//--------------------------------------------------------------------------------------------------
// Custom Script: Projectile Create
//--------------------------------------------------------------------------------------------------
int gf_ProjectileCreate (unit lp_projectile, string lp_model, fixed lp_speed, fixed lp_damage, fixed lp_size, string lp_tint) {
    // Projectile Custom Value
    int lv_cv = IndexUnit(lp_projectile);
   
    // Projectile Art
    ActorSend(ActorFromScope(ActorScopeFromUnit(lp_projectile), "::Main"), "ModelSwap {" + lp_model + "} {" + IntToString(0) + "}");
    ActorSend(ActorFromScope(ActorScopeFromUnit(lp_projectile), "::Death"), "ModelSwap {" + lp_model + "} {" + IntToString(0) + "}"); // Does not work
    ActorSend(ActorFromScope(ActorScopeFromUnit(lp_projectile), "::Main"), "SetTintColor " + lp_tint);
    UnitSetScale(lp_projectile, lp_size, lp_size, lp_size);
   
    // Projectile Attributes
    gv_projDmg[lv_cv] = lp_damage;
    UnitSetPropertyFixed(lp_projectile, c_unitPropMovementSpeed, lp_speed);
   
    return lv_cv;
}

//--------------------------------------------------------------------------------------------------
// Custom Script: Physics Unit Create
//--------------------------------------------------------------------------------------------------
unit PhysicsUnitCreate(string lp_unitType, int lp_player, point lp_point, fixed lp_heightOffset, int lp_weapon) {
        fixed lv_zw = WorldHeight(c_heightMapGround, lp_point) + lp_heightOffset;
        unit lv_u;
        int  lv_cv;
        UnitCreate(1, lp_unitType, c_unitCreateIgnorePlacement, lp_player, lp_point, RandomFixed(0, 360));
        lv_u = UnitLastCreated();
        IndexUnit(lv_u);
        lv_cv = FixedToInt(UnitGetCustomValue(lv_u, c_uIndex));
        gv_uWeapon[lv_cv] = lp_weapon;
        // Drop the unit from air.
        PointSetHeight(lp_point, lv_zw);
        UnitSetHeight(lv_u, lp_heightOffset, 0.0);
        ApplyPhysics(lv_u, lv_cv, lp_point, lp_point, 0);
        UnitGroupAdd(gv_physicsUG, lv_u);
        return lv_u;
}

Name: Anonymous 2012-03-02 14:42

//--------------------------------------------------------------------------------------------------
// Custom Script: Weapon Fire
//--------------------------------------------------------------------------------------------------
void gf_WeaponFire (unit lp_weaponUser, int lp_weaponType, point lp_pointA, point lp_pointB) {
    fixed       lv_angle    = AngleBetweenPoints(lp_pointA, lp_pointB);
    fixed       lv_distance = DistanceBetweenPoints(lp_pointA, lp_pointB)*0.475;
    point       lv_pt;
    int         lv_p        = UnitGetOwner(lp_weaponUser);
    fixed       lv_z        = UnitGetHeight(lp_weaponUser);
    fixed       lv_zwA      = WorldHeight(c_heightMapGround, lp_pointA) + lv_z;
    fixed       lv_zwB      = WorldHeight(c_heightMapGround, lp_pointB);
    int         lv_cv;
    unit        lv_u;
    int         lv_i;
   
    if (lv_distance > gv_weaponProjSpeedMax[lp_weaponType]) {
        lv_distance = gv_weaponProjSpeedMax[lp_weaponType];
    } else if (lv_distance < gv_weaponProjSpeedMin[lp_weaponType]) {
        lv_distance = gv_weaponProjSpeedMin[lp_weaponType];
    }
   
    PointSetHeight(lp_pointA, lv_zwA + 0.5);
   
    while(lv_i < gv_weaponProjPerShot[lp_weaponType]) {
        if (gv_weaponInterval[lp_weaponType] > 0.0) {
            Wait(gv_weaponInterval[lp_weaponType], c_timeReal);
        }
        UnitCreate(1, c_projectile, 0, lv_p, lp_pointA, lv_angle);
        lv_u  = UnitLastCreated();
        UnitSetHeight(lv_u, 0.5 + lv_z, 0.0);
       
        lv_cv = gf_ProjectileCreate(lv_u, gv_weaponProjModel[lp_weaponType], lv_distance, gv_weaponDamage[lp_weaponType],
        gv_weaponProjSize[lp_weaponType], gv_weaponProjTint[lp_weaponType]);
       
        lv_pt = PointWithOffsetPolar(lp_pointA, lv_distance, lv_angle + RandomFixed(-gv_weaponSpray[lp_weaponType], gv_weaponSpray[lp_weaponType]));
        // Added Z adjustments based on height of point A and point B, the height of the unit, and z spray
        PointSetHeight(lv_pt, lv_zwB + 0.5 + RandomFixed(-gv_weaponSprayZ[lp_weaponType], gv_weaponSprayZ[lp_weaponType]));
        ApplyPhysics(lv_u, lv_cv, lp_pointA, lv_pt, gv_weaponPhyBehvSet[lp_weaponType]);
        //gv_accelZ[lv_cv] = gv_weaponProjZAccel[lp_weaponType];
        gv_velZ[lv_cv] += gv_weaponProjZVel[lp_weaponType];
       
        if (gv_weaponTimedLife[lp_weaponType] > 0.0) {
            UnitBehaviorAdd(lv_u, c_projTimedLifeBuff, lv_u, 1);
            UnitBehaviorSetDuration(lv_u, c_projTimedLifeBuff, gv_weaponTimedLife[lp_weaponType]);
        }
        lv_i += 1;
    }
}

//--------------------------------------------------------------------------------------------------
// Custom Script: Physics
//--------------------------------------------------------------------------------------------------
bool gt_Physics_Func (bool testConds, bool runActions) {
    int     lv_i = 1;
    unit    lv_u = UnitGroupUnit(gv_physicsUG, lv_i);
    int     lv_cv;
    point   lv_pt;
    fixed   lv_zw; // terrain-height displacement
    fixed   lv_slide;
    fixed   lv_xOffset;
    fixed   lv_yOffset;
   
    while(lv_u != null) {
        lv_cv = FixedToInt(UnitGetCustomValue(lv_u, c_uIndex));
        // Add gravity to acceleration
        if (gv_useGravity[gv_phyBehvSet[lv_cv]]) {
            gv_accelZ[lv_cv] += -(c_gravity*c_physicsTimerInterval);
        }
        // Add acceleration to velocity
        gv_velX[lv_cv] += (gv_accelX[lv_cv]*c_physicsTimerInterval);
        gv_velY[lv_cv] += (gv_accelY[lv_cv]*c_physicsTimerInterval);
        gv_velZ[lv_cv] += (gv_accelZ[lv_cv]*c_physicsTimerInterval);
        // Add velocity to position coordinates
        gv_posX[lv_cv] += (gv_velX[lv_cv]*c_physicsTimerInterval);
        gv_posY[lv_cv] += (gv_velY[lv_cv]*c_physicsTimerInterval);
        gv_posZ[lv_cv] += (gv_velZ[lv_cv]*c_physicsTimerInterval);
        // Set the position
        if (UnitGetType(lv_u) == c_projectile) {
            lv_pt = Point(gv_posX[lv_cv], gv_posY[lv_cv]);
        } else {
            lv_pt = UnitGetPosition(lv_u);
        }
        // Check world height
        lv_zw = WorldHeight(c_heightMapGround, lv_pt);
        // On terrain-collide
        if (gv_posZ[lv_cv] <= lv_zw && gv_useBounce[gv_phyBehvSet[lv_cv]]) {
            // ------- Bounce
            gv_posZ[lv_cv] = lv_zw;
            gv_accelZ[lv_cv] = (gv_accelZ[lv_cv]*0.5);
            gv_velZ[lv_cv] = -(gv_velZ[lv_cv]*0.5);
            gv_velZ[lv_cv] += (gv_accelZ[lv_cv]*c_physicsTimerInterval);
            gv_posZ[lv_cv] += (gv_velZ[lv_cv]*c_physicsTimerInterval);
        }
        if (gv_posZ[lv_cv] <= lv_zw + 0.1) {
            // ------- Friction
            gv_accelX[lv_cv] = gv_velX[lv_cv]*c_friction;
            gv_accelY[lv_cv] = gv_velY[lv_cv]*c_friction;
            gv_velX[lv_cv] = gv_velX[lv_cv]*c_friction;
            gv_velY[lv_cv] = gv_velY[lv_cv]*c_friction;
            // ------- Sliding
            lv_slide   = WorldHeight(c_heightMapGround, PointWithOffset(lv_pt, -1.0, 0.0));
            lv_xOffset = -(lv_zw - lv_slide)*2*c_physicsTimerInterval;
            lv_slide   = WorldHeight(c_heightMapGround, PointWithOffset(lv_pt, 0.0, -1.0));
            lv_yOffset = -(lv_zw - lv_slide)*2*c_physicsTimerInterval;
            gv_accelX[lv_cv] += lv_xOffset;
            gv_accelY[lv_cv] += lv_yOffset;
            // Add sliding
            lv_pt = PointWithOffset(lv_pt, lv_xOffset, lv_yOffset);
            gv_posZ[lv_cv] = WorldHeight(c_heightMapGround, lv_pt);
            // Kill if very weak bounce
            if (gv_bounceEndDie[gv_phyBehvSet[lv_cv]]) {
                UnitKill(lv_u);
            } else if (gv_velX[lv_cv] < 0.1 && gv_velX[lv_cv] > -0.1 && gv_velY[lv_cv] < 0.1 && gv_velY[lv_cv] > -0.1) {
                // Kill if sliding no more
                if (gv_slideEndDie[gv_phyBehvSet[lv_cv]]) {
                    UnitKill(lv_u);
                }
            }
        }
       
        UnitSetPosition(lv_u, lv_pt, true);
        // Subtract terrain height so the unit ignores terrain height during its movement
        UnitSetHeight(lv_u, gv_posZ[lv_cv] - lv_zw, c_physicsTimerInterval);
       
        lv_i += 1;
        lv_u  = UnitGroupUnit(gv_physicsUG, lv_i);
    }
   
    return true;
}
// Register Physics Timer Event
void gt_Physics_Init () {
    TimerStart(gv_physicsTimer, 0.0, true, c_timeReal);
    TriggerAddEventTimer(gt_physics, gv_physicsTimer);
}

Name: Anonymous 2012-03-02 14:42

//--------------------------------------------------------------------------------------------------
// Custom Script: Terrain Generator
//--------------------------------------------------------------------------------------------------
void gf_TerrainGenerator (int lp_trees, string lp_unitType, string lp_genType1) {
    //const string lv_genType1 = "Cactus";
    int lv_i;
    int lv_i2;
    unit lv_u;
    text lv_txt;
   
    DialogSetVisible(gv_terrainDialog, gv_allPlayers, true);
    while(lv_i < lp_trees/10) {
        lv_i2 = 0;
        while(lv_i2 < lp_trees/100) {
            UnitCreate(1, lp_unitType, c_unitCreateIgnorePlacement, 0, Point(RandomFixed(0, 256), RandomFixed(0, 256)), RandomFixed(0, 360));
            lv_u = UnitLastCreated();
            ActorSend(ActorFromScope(ActorScopeFromUnit(lv_u), "::Main"), "ModelSwap {" + lp_genType1 + "} {" + IntToString(RandomInt(0, 5)) + "}");
            lv_i2 += 1;
        }
        Wait(0.0, c_timeReal);
        lv_i += 1;
        lv_txt = StringToText("<c val=\"FFAA56\">" + lp_genType1 + "<c val=\"4F3D89\"> " + IntToString(lv_i) + "% <c val=\"FFAA56\">generated.");
        DialogControlSetPropertyAsText(gv_terrainLabel, c_triggerControlPropertyText, gv_allPlayers, StringToText("<s val=\"ModCenterSize20Bold\">") + lv_txt);
    }
   
    lv_i = 0;
    while(lv_i < 40) {
        UnitCreate(1, "ExplodingBarrelLarge", c_unitCreateIgnorePlacement, 0, Point(RandomFixed(20, 236), RandomFixed(20, 236)), RandomFixed(0, 360));
        lv_i += 1;
    }
   
    lv_i = 0;
    while(lv_i < 3) {
        Wait(0.25, c_timeReal);
        lv_txt = StringToText("<c val=\"AFFA56\">" + lp_genType1 + "<c val=\"4F3D89\"> 100% <c val=\"AFFA56\">generated.");
        DialogControlSetPropertyAsText(gv_terrainLabel, c_triggerControlPropertyText, gv_allPlayers, StringToText("<s val=\"ModCenterSize20Bold\">") + lv_txt);
        Wait(0.25, c_timeReal);
        lv_txt = StringToText("<c val=\"FFAA56\">" + lp_genType1 + "<c val=\"4F3D89\"> 100% <c val=\"FFAA56\">generated.");
        DialogControlSetPropertyAsText(gv_terrainLabel, c_triggerControlPropertyText, gv_allPlayers, StringToText("<s val=\"ModCenterSize20Bold\">") + lv_txt);
        lv_i += 1;
    }
    DialogSetVisible(gv_terrainDialog, gv_allPlayers, false);
}

//--------------------------------------------------------------------------------------------------
// Custom Script: Terrain Dialog Create
//--------------------------------------------------------------------------------------------------
void gt_TerrainDialogCreate_Func () {
    const int   lv_width    = 800;
    const int   lv_height   = 35;
    const int   lv_anchor   = c_anchorCenter;
    const int   lv_offsetX  = 0;
    const int   lv_offsetY  = 0;
    const bool  lv_modal    = false;
    const string lv_bgImage = "Assets\\Textures\\blank.dds";
    const string lv_style   = "<s val=\"ModCenterSize20Bold\">";
   
    text        lv_txt;
   
    gv_terrainDialog = DialogCreate(lv_width, lv_height, lv_anchor, lv_offsetX, lv_offsetY, lv_modal);
    DialogSetImage(gv_terrainDialog, lv_bgImage);
    DialogSetVisible(gv_terrainDialog, gv_allPlayers, false);
   
    gv_terrainLabel = DialogControlCreate(gv_terrainDialog, c_triggerControlTypeLabel);
    DialogControlSetSize(gv_terrainLabel, gv_allPlayers, lv_width, lv_height);
    DialogControlSetPosition(gv_terrainLabel, gv_allPlayers, c_anchorBottom, 0, 0);
    lv_txt = StringToText("<c val=\"FFAA56\">Generating ???");
    DialogControlSetPropertyAsText(gv_terrainLabel, c_triggerControlPropertyText, gv_allPlayers, StringToText(lv_style) + lv_txt);
    DialogControlSetPropertyAsString(gv_terrainLabel, c_triggerControlPropertyStyle, gv_allPlayers, "CenterJustified");
    DialogControlSetVisible(gv_terrainLabel, gv_allPlayers, true);
}

Name: Anonymous 2012-03-02 14:43

//--------------------------------------------------------------------------------------------------
// Custom Script: Supplies Variables
//--------------------------------------------------------------------------------------------------
const int c_orderSuppliesButtonCount = 16;
int         gv_orderSuppliesDialog;
int         gv_orderSuppliesLabel;
int[3]      gv_orderSuppliesInnerLabel;
int         gv_orderSuppliesInnerFrame;
int         gv_orderSuppliesFieldImage;
int[16][2]  gv_orderSuppliesButton;
int[16][3]  gv_orderSuppliesButtonLabel;
int         gv_orderSuppliesButtonArrow;
int         gv_orderSuppliesTotalCostTitle;
int         gv_orderSuppliesTotalCostLabel;
int         gv_orderSuppliesPurchase;
int         gv_orderSuppliesPurchaseLabel;
int         gv_orderSuppliesClear;
int         gv_orderSuppliesClearLabel;
const string gv_bg2                 = "UI Dialog Frame (Blue) 4.tga";//"Assets\\Textures\\ui_glue_listboxselection_over_terran.dds";
const string gv_img                 = "UI Dialog Frame (Blue).tga";//"Assets\\Textures\\ui_ingame_help_glossary_racebuttonframe.dds";
const string gv_img2                = "UI Button 3.tga";
const string gv_fieldImg            = "Assets\\Textures\\ui_ingame_help_glossary_racebuttonframe.dds";
const int c_orderSuppliesCount      = 30;
string[c_orderSuppliesCount]        gv_orderSuppliesUnit;
int[c_orderSuppliesCount][16]       gv_orderSuppliesQuantity;
fixed[16]                           gv_orderSuppliesTotalCost;

//--------------------------------------------------------------------------------------------------
// Custom Script: Purchase Supplies
//--------------------------------------------------------------------------------------------------
void gf_PurchaseSupplies (int lp_player) {
    playergroup lv_pg       = PlayerGroupSingle(lp_player);
    fixed       lv_minerals;
    fixed       lv_cost;
    text        lv_txt;
    point       lv_pt       = CameraGetTarget(lp_player);
    int         lv_i;
    int         lv_i2;
   
    while (lv_i < c_orderSuppliesCount) {
        lv_minerals = PlayerGetPropertyFixed(lp_player, c_playerPropMinerals);
        // The cost is (quantity * default-price) of unit being ordered.
        lv_cost = (gv_orderSuppliesQuantity[lv_i][lp_player] * UnitTypeGetCost(gv_orderSuppliesUnit[lv_i], c_unitCostMinerals));
        // If they can't pay, don't order the item.
        if (lv_minerals >= lv_cost) {
            PlayerModifyPropertyFixed(lp_player, c_playerPropMinerals, c_playerPropOperSubtract, lv_cost);
            //UnitCreate(gv_orderSuppliesQuantity[lv_i][lp_player], gv_orderSuppliesUnit[lv_i], c_unitCreateIgnorePlacement, lp_player, CameraGetTarget(lp_player), RandomFixed(0, 360));
            lv_i2 = 0;
            while(lv_i2 < gv_orderSuppliesQuantity[lv_i][lp_player]) {
                PhysicsUnitCreate(gv_orderSuppliesUnit[lv_i], lp_player, lv_pt, RandomFixed(5.0, 10.0), RandomInt(1, 5));
                lv_i2 += 1;
            }
            gv_orderSuppliesTotalCost[lp_player] += -lv_cost;
            gv_orderSuppliesQuantity[lv_i][lp_player] = 0;
            lv_txt = StringToText("<s val=\"ModCenterSize12Bold\"><c val=\"07E6DE\">") + IntToText(gv_orderSuppliesQuantity[lv_i][lp_player]);
            DialogControlSetPropertyAsText(gv_orderSuppliesButtonLabel[lv_i][1], c_triggerControlPropertyText, lv_pg, lv_txt);
            lv_cost = UnitTypeGetCost(gv_orderSuppliesUnit[lv_i], c_unitCostMinerals);
            lv_txt = StringToText("<s val=\"ModCenterSize12Bold\"><c val=\"49B308\">$") + FixedToText(lv_cost, 2);
            DialogControlSetPropertyAsText(gv_orderSuppliesButtonLabel[lv_i][2], c_triggerControlPropertyText, lv_pg, lv_txt);
            lv_txt = StringToText("<s val=\"ModCenterSize12Bold\"><c val=\"59F328\">$") + FixedToText(gv_orderSuppliesTotalCost[lp_player], 2);
            DialogControlSetPropertyAsText(gv_orderSuppliesTotalCostLabel, c_triggerControlPropertyText, lv_pg, lv_txt);
        }
        lv_i += 1;
    }
}

//--------------------------------------------------------------------------------------------------
// Custom Script: Clear Supplies Orders
//--------------------------------------------------------------------------------------------------
void gf_ClearSuppliesOrders (int lp_player) {
    playergroup lv_pg       = PlayerGroupSingle(lp_player);
    fixed       lv_minerals;
    fixed       lv_cost;
    text        lv_txt;
    int         lv_i;
   
    gv_orderSuppliesTotalCost[lp_player] = 0;
    while (lv_i < c_orderSuppliesCount) {
        gv_orderSuppliesQuantity[lv_i][lp_player] = 0;
        lv_txt = StringToText("<s val=\"ModCenterSize12Bold\"><c val=\"07E6DE\">") + IntToText(gv_orderSuppliesQuantity[lv_i][lp_player]);
        DialogControlSetPropertyAsText(gv_orderSuppliesButtonLabel[lv_i][1], c_triggerControlPropertyText, lv_pg, lv_txt);
        lv_cost = UnitTypeGetCost(gv_orderSuppliesUnit[lv_i], c_unitCostMinerals);
        lv_txt = StringToText("<s val=\"ModCenterSize12Bold\"><c val=\"49B308\">$") + FixedToText(lv_cost, 2);
        DialogControlSetPropertyAsText(gv_orderSuppliesButtonLabel[lv_i][2], c_triggerControlPropertyText, lv_pg, lv_txt);
        lv_txt = StringToText("<s val=\"ModCenterSize12Bold\"><c val=\"889988\">$") + FixedToText(gv_orderSuppliesTotalCost[lp_player], 2);
        DialogControlSetPropertyAsText(gv_orderSuppliesTotalCostLabel, c_triggerControlPropertyText, lv_pg, lv_txt);
        lv_i += 1;
    }
}

//--------------------------------------------------------------------------------------------------
// Custom Script: Order Supplies
//--------------------------------------------------------------------------------------------------
void gf_OrderSupplies (int lp_dialogControl, int lp_player, int lp_option, int lp_increment) {
    playergroup lv_pg       = PlayerGroupSingle(lp_player);
    fixed       lv_minerals = UnitTypeGetCost(gv_orderSuppliesUnit[lp_option], c_unitCostMinerals);
    fixed       lv_cost;
    text        lv_txt;
   
    gv_orderSuppliesQuantity[lp_option][lp_player] += 1*lp_increment;
    if (gv_orderSuppliesQuantity[lp_option][lp_player] < 0) {
        gv_orderSuppliesQuantity[lp_option][lp_player] = 0;
        lp_increment = 0;
    }
    gv_orderSuppliesTotalCost[lp_player] += lv_minerals*lp_increment;
    lv_cost = (gv_orderSuppliesQuantity[lp_option][lp_player] * lv_minerals);
    lv_txt = StringToText("<s val=\"ModCenterSize12Bold\"><c val=\"07E6DE\">") + IntToText(gv_orderSuppliesQuantity[lp_option][lp_player]);
    DialogControlSetPropertyAsText(gv_orderSuppliesButtonLabel[lp_option][1], c_triggerControlPropertyText, lv_pg, lv_txt);
    lv_txt = StringToText("<s val=\"ModCenterSize12Bold\"><c val=\"59F328\">$") + FixedToText(lv_cost, 2);
    DialogControlSetPropertyAsText(gv_orderSuppliesButtonLabel[lp_option][2], c_triggerControlPropertyText, lv_pg, lv_txt);
    lv_txt = StringToText("<s val=\"ModCenterSize12Bold\"><c val=\"59F328\">$") + FixedToText(gv_orderSuppliesTotalCost[lp_player], 2);
    DialogControlSetPropertyAsText(gv_orderSuppliesTotalCostLabel, c_triggerControlPropertyText, lv_pg, lv_txt);
}

Name: Anonymous 2012-03-02 14:44

//--------------------------------------------------------------------------------------------------
// Custom Script: Order Supplies Dialog Create
//--------------------------------------------------------------------------------------------------
void gt_OrderSuppliesDialogCreate_Func () {
    const int   lv_width    = 400 + 22;
    const int   lv_height   = 600;
    const int   lv_anchor   = c_anchorLeft;
    const int   lv_offsetX  = 25;
    const int   lv_offsetY  = 0;
    const bool  lv_modal    = false;
    const string lv_bgImage = gv_bg2;
    const string lv_style   = "<s val=\"ModCenterSize16Bold\">";
   
    text        lv_labelStyle       = StringToText("<s val=\"ModCenterSize12Bold\">");
    text        lv_innerLabelStyle  = StringToText("<s val=\"ModCenterSize16Bold\">");
    text        lv_txt;
    int         lv_i;
    int         lv_i2;
   
    gv_orderSuppliesDialog = DialogCreate(lv_width, lv_height, lv_anchor, lv_offsetX, lv_offsetY, lv_modal);
    DialogSetImage(gv_orderSuppliesDialog, lv_bgImage);
    DialogSetVisible(gv_orderSuppliesDialog, gv_allPlayers, false);
   
    gv_orderSuppliesLabel = DialogControlCreate(gv_orderSuppliesDialog, c_triggerControlTypeLabel);
    DialogControlSetSize(gv_orderSuppliesLabel, gv_allPlayers, lv_width, lv_height);
    DialogControlSetPosition(gv_orderSuppliesLabel, gv_allPlayers, c_anchorBottom, 0, -24);
    lv_txt = StringToText("<c val=\"E7E6DE\">Order Supplies</n><s val=\"ModCenterSize12Bold\"><c val=\"F93328\">Select items and reinforcements to</n>have delivered by dropship.");
    DialogControlSetPropertyAsText(gv_orderSuppliesLabel, c_triggerControlPropertyText, gv_allPlayers, StringToText(lv_style) + lv_txt);
    DialogControlSetPropertyAsString(gv_orderSuppliesLabel, c_triggerControlPropertyStyle, gv_allPlayers, "CenterJustified");
    DialogControlSetVisible(gv_orderSuppliesLabel, gv_allPlayers, true);
   
    //gv_orderSuppliesLabel = DialogControlCreate(gv_orderSuppliesDialog, c_triggerControlTypeEditBox);
    //DialogControlSetSize(gv_orderSuppliesLabel, gv_allPlayers, 256, 48);
    //DialogControlSetPosition(gv_orderSuppliesLabel, gv_allPlayers, c_anchorBottom, 0, 24);
    //DialogControlSetVisible(gv_orderSuppliesLabel, gv_allPlayers, true);
   
    gv_orderSuppliesInnerFrame = DialogControlCreate(gv_orderSuppliesDialog, c_triggerControlTypeImage);
    DialogControlSetPropertyAsString(gv_orderSuppliesInnerFrame, c_triggerControlPropertyImage, gv_allPlayers, gv_img);
    DialogControlSetPropertyAsInt(gv_orderSuppliesInnerFrame, c_triggerControlPropertyImageType, gv_allPlayers, c_triggerImageTypeBorder);
    DialogControlSetSize(gv_orderSuppliesInnerFrame, gv_allPlayers, lv_width - 48, lv_height - 188); //352, 412);
    DialogControlSetPosition(gv_orderSuppliesInnerFrame, gv_allPlayers, c_anchorTop, 0, 92);
    DialogControlSetVisible(gv_orderSuppliesInnerFrame, gv_allPlayers, true);
   
    // Total Cost Title
    gv_orderSuppliesTotalCostTitle = DialogControlCreate(gv_orderSuppliesDialog, c_triggerControlTypeLabel);
    DialogControlSetSize(gv_orderSuppliesTotalCostTitle, gv_allPlayers, 144, 36);
    DialogControlSetPosition(gv_orderSuppliesTotalCostTitle, gv_allPlayers, c_anchorBottomLeft, 24, 40);
    lv_txt = StringToText("<c val=\"38A03A\">Total Cost");
    DialogControlSetPropertyAsText(gv_orderSuppliesTotalCostTitle, c_triggerControlPropertyText, gv_allPlayers, lv_innerLabelStyle + lv_txt);
    DialogControlSetPropertyAsString(gv_orderSuppliesTotalCostTitle, c_triggerControlPropertyStyle, gv_allPlayers, "CenterJustified");
    DialogControlSetVisible(gv_orderSuppliesTotalCostTitle, gv_allPlayers, true);
   
    // Total Cost Label
    gv_orderSuppliesTotalCostLabel = DialogControlCreate(gv_orderSuppliesDialog, c_triggerControlTypeLabel);
    DialogControlSetSize(gv_orderSuppliesTotalCostLabel, gv_allPlayers, 144, 36);
    DialogControlSetPosition(gv_orderSuppliesTotalCostLabel, gv_allPlayers, c_anchorBottomLeft, 24, 19);
    lv_txt = lv_labelStyle + StringToText("<c val=\"889988\">$0.00");
    DialogControlSetPropertyAsText(gv_orderSuppliesTotalCostLabel, c_triggerControlPropertyText, gv_allPlayers, lv_txt);
    DialogControlSetPropertyAsString(gv_orderSuppliesTotalCostLabel, c_triggerControlPropertyStyle, gv_allPlayers, "CenterJustified");
    DialogControlSetVisible(gv_orderSuppliesTotalCostLabel, gv_allPlayers, true);
   
    gv_orderSuppliesPurchase = DialogControlCreate(gv_orderSuppliesDialog, c_triggerControlTypeButton);
    //DialogControlSetPropertyAsString(gv_orderSuppliesPurchase, c_triggerControlPropertyImage, gv_allPlayers, gv_img);
    DialogControlSetPropertyAsInt(gv_orderSuppliesPurchase, c_triggerControlPropertyImageType, gv_allPlayers, c_triggerImageTypeBorder);
    DialogControlSetSize(gv_orderSuppliesPurchase, gv_allPlayers, 144, 36);
    DialogControlSetPosition(gv_orderSuppliesPurchase, gv_allPlayers, c_anchorBottomRight, 24, 48);
    DialogControlSetVisible(gv_orderSuppliesPurchase, gv_allPlayers, true);
    gv_orderSuppliesPurchaseLabel = DialogControlCreate(gv_orderSuppliesDialog, c_triggerControlTypeLabel);
    DialogControlSetSize(gv_orderSuppliesPurchaseLabel, gv_allPlayers, 144, 36);
    DialogControlSetPosition(gv_orderSuppliesPurchaseLabel, gv_allPlayers, c_anchorBottomRight, 24, 40);
    lv_txt = StringToText("<c val=\"38A03A\">Purchase");
    DialogControlSetPropertyAsText(gv_orderSuppliesPurchaseLabel, c_triggerControlPropertyText, gv_allPlayers, lv_innerLabelStyle + lv_txt);
    DialogControlSetPropertyAsString(gv_orderSuppliesPurchaseLabel, c_triggerControlPropertyStyle, gv_allPlayers, "CenterJustified");
    DialogControlSetVisible(gv_orderSuppliesPurchaseLabel, gv_allPlayers, true);
   
    gv_orderSuppliesClear = DialogControlCreate(gv_orderSuppliesDialog, c_triggerControlTypeButton);
    //DialogControlSetPropertyAsString(gv_orderSuppliesClear, c_triggerControlPropertyImage, gv_allPlayers, gv_img);
    DialogControlSetPropertyAsInt(gv_orderSuppliesClear, c_triggerControlPropertyImageType, gv_allPlayers, c_triggerImageTypeBorder);
    DialogControlSetSize(gv_orderSuppliesClear, gv_allPlayers, 144, 36);
    DialogControlSetPosition(gv_orderSuppliesClear, gv_allPlayers, c_anchorBottomRight, 24, 10);
    DialogControlSetVisible(gv_orderSuppliesClear, gv_allPlayers, true);
    gv_orderSuppliesClearLabel = DialogControlCreate(gv_orderSuppliesDialog, c_triggerControlTypeLabel);
    DialogControlSetSize(gv_orderSuppliesClearLabel, gv_allPlayers, 144, 36);
    DialogControlSetPosition(gv_orderSuppliesClearLabel, gv_allPlayers, c_anchorBottomRight, 24, 2);
    lv_txt = StringToText("<c val=\"38A03A\">Clear");
    DialogControlSetPropertyAsText(gv_orderSuppliesClearLabel, c_triggerControlPropertyText, gv_allPlayers, lv_innerLabelStyle + lv_txt);
    DialogControlSetPropertyAsString(gv_orderSuppliesClearLabel, c_triggerControlPropertyStyle, gv_allPlayers, "CenterJustified");
    DialogControlSetVisible(gv_orderSuppliesClearLabel, gv_allPlayers, true);
   
    while(lv_i < 3) {
        gv_orderSuppliesInnerLabel[lv_i] = DialogControlCreate(gv_orderSuppliesDialog, c_triggerControlTypeLabel);
        DialogControlSetSize(gv_orderSuppliesInnerLabel[lv_i], gv_allPlayers, 298, 20);
        DialogControlSetPosition(gv_orderSuppliesInnerLabel[lv_i], gv_allPlayers, c_anchorTopLeft, 36, 107);

Name: Anonymous 2012-03-02 14:44

DialogControlSetVisible(gv_orderSuppliesInnerLabel[lv_i], gv_allPlayers, true);
        lv_i +=1;
    }
    lv_txt = StringToText("<c val=\"E7B6AE\">Unit");
    DialogControlSetPropertyAsText(gv_orderSuppliesInnerLabel[0], c_triggerControlPropertyText, gv_allPlayers, lv_innerLabelStyle + lv_txt);
    lv_txt = StringToText("<c val=\"B7C6DE\">Quantity");
    DialogControlSetPropertyAsText(gv_orderSuppliesInnerLabel[1], c_triggerControlPropertyText, gv_allPlayers, lv_innerLabelStyle + lv_txt);
    lv_txt = StringToText("<c val=\"B7E6AE\">Cost");
    DialogControlSetPropertyAsText(gv_orderSuppliesInnerLabel[2], c_triggerControlPropertyText, gv_allPlayers, lv_innerLabelStyle + lv_txt);
   
    DialogControlSetPropertyAsString(gv_orderSuppliesInnerLabel[0], c_triggerControlPropertyStyle, gv_allPlayers, "LeftJustified");
    DialogControlSetPropertyAsString(gv_orderSuppliesInnerLabel[1], c_triggerControlPropertyStyle, gv_allPlayers, "CenterJustified");
    DialogControlSetPropertyAsString(gv_orderSuppliesInnerLabel[2], c_triggerControlPropertyStyle, gv_allPlayers, "RightJustified");
   
    gv_orderSuppliesUnit[0] = "Marine";
    gv_orderSuppliesUnit[1] = "CargoTruckUnitBarrels";
    gv_orderSuppliesUnit[2] = "CargoTruckUnitFlatbed";
    gv_orderSuppliesUnit[3] = "CargoTruckUnitTrailer";
    gv_orderSuppliesUnit[4] = "CivilianFemale";
    gv_orderSuppliesUnit[5] = "Civilian";
    gv_orderSuppliesUnit[6] = "CruiserBike";
    gv_orderSuppliesUnit[7] = "DumpTruck";
    gv_orderSuppliesUnit[8] = "Firebat";
    gv_orderSuppliesUnit[9] = "FlatbedTruck";
    gv_orderSuppliesUnit[10] = "TruckFlatbedUnit";
    gv_orderSuppliesUnit[11] = "TruckSemiUnit";
    gv_orderSuppliesUnit[12] = "CargoTruckUnitBarrels";
    gv_orderSuppliesUnit[13] = "Ghost";
    gv_orderSuppliesUnit[14] = "Goliath";
    gv_orderSuppliesUnit[15] = "Hellion";
    gv_orderSuppliesUnit[16] = "ColonistTransport";
   
    lv_i = 0;
    while(lv_i < 16) {
        lv_i2 = 0;
        while(lv_i2 < 2) {
            gv_orderSuppliesButton[lv_i][lv_i2] = DialogControlCreate(gv_orderSuppliesDialog, c_triggerControlTypeButton);
            DialogControlSetPropertyAsString(gv_orderSuppliesButton[lv_i][lv_i2], c_triggerControlPropertyImage, gv_allPlayers, gv_img2);
            DialogControlSetPropertyAsString(gv_orderSuppliesButton[lv_i][lv_i2], c_triggerControlPropertyHoverImage, gv_allPlayers, gv_img2);
            DialogControlSetPropertyAsInt(gv_orderSuppliesButton[lv_i][lv_i2], c_triggerControlPropertyImageType, gv_allPlayers, c_triggerImageTypeNormal);
            DialogControlSetSize(gv_orderSuppliesButton[lv_i][lv_i2], gv_allPlayers, 18, 18);
            DialogControlSetPosition(gv_orderSuppliesButton[lv_i][lv_i2], gv_allPlayers, c_anchorTopRight, 36 + (lv_i2*22), 130 + (lv_i*22));
            DialogControlSetVisible(gv_orderSuppliesButton[lv_i][lv_i2], gv_allPlayers, true);
           
            gv_orderSuppliesButtonArrow = DialogControlCreate(gv_orderSuppliesDialog, c_triggerControlTypeLabel);
            DialogControlSetSize(gv_orderSuppliesButtonArrow, gv_allPlayers, 18, 18);
            DialogControlSetPosition(gv_orderSuppliesButtonArrow, gv_allPlayers, c_anchorTopRight, 36 + (lv_i2*22), 129 + (lv_i*22));
            DialogControlSetVisible(gv_orderSuppliesButtonArrow, gv_allPlayers, true);
            if (lv_i2 == 0) {
                lv_txt = StringToText("<c val=\"13F40C\">+");
            } else {
                lv_txt = StringToText("<c val=\"E3140C\">-");
            }
            DialogControlSetPropertyAsText(gv_orderSuppliesButtonArrow, c_triggerControlPropertyText, gv_allPlayers, lv_labelStyle + lv_txt);
            DialogControlSetPropertyAsString(gv_orderSuppliesButtonArrow, c_triggerControlPropertyStyle, gv_allPlayers, "CenterJustified");
            lv_i2 += 1;
        }
       
        gv_orderSuppliesFieldImage = DialogControlCreate(gv_orderSuppliesDialog, c_triggerControlTypeImage);
        DialogControlSetPropertyAsString(gv_orderSuppliesFieldImage, c_triggerControlPropertyImage, gv_allPlayers, gv_fieldImg);
        DialogControlSetPropertyAsInt(gv_orderSuppliesFieldImage, c_triggerControlPropertyImageType, gv_allPlayers, c_triggerImageTypeBorder);
        DialogControlSetSize(gv_orderSuppliesFieldImage, gv_allPlayers, 300, 20);
        DialogControlSetPosition(gv_orderSuppliesFieldImage, gv_allPlayers, c_anchorTopLeft, 36, 130 + (lv_i*22));
        DialogControlSetVisible(gv_orderSuppliesFieldImage, gv_allPlayers, true);
       
        lv_i2 = 0;
        while(lv_i2 < 3) {
            gv_orderSuppliesButtonLabel[lv_i][lv_i2] = DialogControlCreate(gv_orderSuppliesDialog, c_triggerControlTypeLabel);
            DialogControlSetSize(gv_orderSuppliesButtonLabel[lv_i][lv_i2], gv_allPlayers, 298, 18);
            DialogControlSetPosition(gv_orderSuppliesButtonLabel[lv_i][lv_i2], gv_allPlayers, c_anchorTopLeft, 36, 129 + (lv_i*22));
            DialogControlSetVisible(gv_orderSuppliesButtonLabel[lv_i][lv_i2], gv_allPlayers, true);
            lv_i2 += 1;
        }
        lv_txt = StringToText("<c val=\"E7E6DE\">") + UnitTypeGetName(gv_orderSuppliesUnit[lv_i]);
        DialogControlSetPropertyAsText(gv_orderSuppliesButtonLabel[lv_i][0], c_triggerControlPropertyText, gv_allPlayers, lv_labelStyle + lv_txt);
        lv_txt = StringToText("<c val=\"07E6DE\"> 0");
        DialogControlSetPropertyAsText(gv_orderSuppliesButtonLabel[lv_i][1], c_triggerControlPropertyText, gv_allPlayers, lv_labelStyle + lv_txt);
        lv_txt = StringToText("<c val=\"49B308\">$") + FixedToText(UnitTypeGetCost(gv_orderSuppliesUnit[lv_i], c_unitCostMinerals), 2);
        DialogControlSetPropertyAsText(gv_orderSuppliesButtonLabel[lv_i][2], c_triggerControlPropertyText, gv_allPlayers, lv_labelStyle + lv_txt);
       
        DialogControlSetPropertyAsString(gv_orderSuppliesButtonLabel[lv_i][0], c_triggerControlPropertyStyle, gv_allPlayers, "LeftJustified");
        DialogControlSetPropertyAsString(gv_orderSuppliesButtonLabel[lv_i][1], c_triggerControlPropertyStyle, gv_allPlayers, "CenterJustified");
        DialogControlSetPropertyAsString(gv_orderSuppliesButtonLabel[lv_i][2], c_triggerControlPropertyStyle, gv_allPlayers, "RightJustified");
        lv_i += 1;
    }
}

Name: Anonymous 2012-03-02 14:45

//--------------------------------------------------------------------------------------------------
// Custom Script: Vote Variables
//--------------------------------------------------------------------------------------------------
const string                c_voteBg                = "Assets\\Textures\\ui_voicechat_background_talkeritem.dds";
const string                c_voteOptionButton      = "Assets\\Textures\\ui_battle_missionbuttonicon_normalpressed.dds";
const string                c_voteOptionButtonHover = "Assets\\Textures\\ui_battle_missionbuttonicon_normaloverpressedover.dds";
const int                   c_voteOptionsCount      = 30;
int                         gv_voteMenuDialog;
int                         gv_voteMenuTitle;
int[c_voteOptionsCount]     gv_voteMenuLabel;
int[c_voteOptionsCount]     gv_voteMenuButton;
int[c_voteOptionsCount]     gv_voteLabel;
text[c_voteOptionsCount]    gv_optionButtonText;
timer                       gv_voteTimer = TimerCreate();
timer                       gv_voteCountdownTimer = TimerCreate();
int                         gv_voteMenuTimerLabel;
bool[16]                    gv_hasVoted;
int[c_voteOptionsCount]     gv_votesFor;
int[c_voteOptionsCount]     gv_votedFor;
int                         gv_votesCast;
int                         gv_votingPlayers = PlayerGroupCount(PlayerGroupActive());
int                         gv_voteOptionsCount;
string                      gv_votingOn;

//--------------------------------------------------------------------------------------------------
// Custom Script: Call Vote
//--------------------------------------------------------------------------------------------------
void gf_callVote (string lp_votingOn, fixed lp_timeToVote, string lp_title, string lp_subtitle, int lp_voteOptionsCount) {
    const string    lv_style = "<s val=\"ModCenterSize24Bold\">";
    text            lv_txt;
    int             lv_i;
    // ---------------------------------------------------------------
    // Call the vote
    // ---------------------------------------------------------------
   
    if (TimerGetRemaining(gv_voteTimer) > 0) {
        UIDisplayMessage(gv_allPlayers, c_messageAreaDebug, StringToText("Vote in progress; wait until current vote is over to begin a new vote."));
        return;
    }
    while (lv_i <= 15) {
        gv_hasVoted[lv_i] = false;
        lv_i += 1;
    }
   
    lv_i = 0;
    while (lv_i < c_voteOptionsCount) {
        gv_votesFor[lv_i] = 0;
        lv_i += 1;
    }
   
    gv_votesCast = 0;
    gv_votingOn = lp_votingOn;
    gv_voteOptionsCount = lp_voteOptionsCount;
    TimerStart(gv_voteTimer, lp_timeToVote, false, c_timeReal);
    TimerStart(gv_voteCountdownTimer, 0.1, true, c_timeReal);
   
    // ---------------------------------------------------------------
    // Set up the vote dialog.
    // ---------------------------------------------------------------
   
    // The number of vote options can not exceed the maximum possible.
    if (lp_voteOptionsCount > c_voteOptionsCount) {
        lp_voteOptionsCount = c_voteOptionsCount;
    }
   
    // Resize the dialog depending on the number of options available.
    DialogSetSize(gv_voteMenuDialog, 400, 70 + 70 + (25 * lp_voteOptionsCount));
   
    // Set the title & the subtitle, e.g. "Mode", "Select game mode"
    lv_txt = StringToText("<c val=\"F85F34\">" + lp_title + "</n><s val=\"ModCenterSize20\">" + lp_subtitle);
    DialogControlSetPropertyAsText(gv_voteMenuTitle, c_triggerControlPropertyText, gv_allPlayers, StringToText(lv_style) + lv_txt);
    // Set the timer text.
    lv_txt = StringToText("<c val=\"EA0F3A\">" + FixedToString(TimerGetRemaining(gv_voteTimer), 2) + " seconds left to vote");
    DialogControlSetPropertyAsText(gv_voteMenuTimerLabel, c_triggerControlPropertyText, gv_allPlayers, lv_txt);
   
    lv_i = 0;
    // Label each button accordingly.
    while(lv_i <= lp_voteOptionsCount) {
        lv_txt = gv_optionButtonText[lv_i];
        DialogControlSetPropertyAsText(gv_voteMenuLabel[lv_i], c_triggerControlPropertyText, gv_allPlayers, lv_txt);
        DialogControlSetPropertyAsText(gv_voteLabel[lv_i], c_triggerControlPropertyText, gv_allPlayers, StringToText("<s val=\"ModCenterSize12\">0"));
        // Show buttons (and their labels) that we're using.
        DialogControlSetVisible(gv_voteMenuButton[lv_i], gv_allPlayers, true);
        DialogControlSetVisible(gv_voteMenuLabel[lv_i], gv_allPlayers, true);
        DialogControlSetVisible(gv_voteLabel[lv_i], gv_allPlayers, true);
        lv_i += 1;
    }
    // Hide any buttons (and their labels) we're not using.
    while(lv_i < c_voteOptionsCount) {
        DialogControlSetVisible(gv_voteMenuButton[lv_i], gv_allPlayers, false);
        DialogControlSetVisible(gv_voteMenuLabel[lv_i], gv_allPlayers, false);
        DialogControlSetVisible(gv_voteLabel[lv_i], gv_allPlayers, false);
        lv_i += 1;
    }
   
    // Show the vote dialog.
    DialogSetVisible(gv_voteMenuDialog, gv_allPlayers, true);
}

Name: Anonymous 2012-03-02 14:46

//--------------------------------------------------------------------------------------------------
// Custom Script: On Vote
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
// Selects the option which has been voted for the most; if 2 or more options are tied it picks at
// random between the tied options.
//--------------------------------------------------------------------------------------------------
int gf_SelectVote (int lp_optionsCount) {
    int                     lv_i;
    int                     lv_i2;
    int                     lv_picked;
    int[c_voteOptionsCount] lv_pkd;
    while(lv_i <= lp_optionsCount) {
        if (lv_i2 < gv_votesFor[lv_i]) {    // If the current option being evaluated has more votes than
            lv_i2 = gv_votesFor[lv_i];      // the previous selected one, select the current option.
            lv_picked = lv_i;
        }
        DebugMsg("Option (" + IntToString(lv_i) + ") has " + IntToString(gv_votesFor[lv_i]) + " votes");
        lv_i += 1;
    }
   
    // Find all options which may be tied with the same number of votes as the rest.
    lv_i = 0;
    lv_i2 = -1;
    while(lv_i <= lp_optionsCount) {
        if (gv_votesFor[lv_i] == gv_votesFor[lv_picked]) {
            lv_i2 += 1;
            lv_pkd[lv_i2] = lv_i;
        }
        lv_i += 1;
    }
    // If multiple options are tied with the same number of votes pick one at random.
    lv_picked = lv_pkd[RandomInt(0, lv_i2)];
   
    return lv_picked;
}
//--------------------------------------------------------------------------------------------------
// Tally up the votes when they're ready or the timer has expired and select an option.
// Do whatever based on the option selected here.
//--------------------------------------------------------------------------------------------------
bool gt_onVote_Func (bool testConds, bool runActions) {
    int lv_modeSelected = gf_SelectVote(gv_voteOptionsCount);
    if (gv_votingOn == "Game Mode") {
        //gf_SetUpGame(lv_modeSelected);
    } else if (gv_votingOn == "Kick Player") {
        if (lv_modeSelected < 16) {
            GameOver(lv_modeSelected, c_gameOverDefeat, false, false);
        }
    } else if (gv_votingOn == "Many Options") {
        UnitCreate(1, "Roach", c_unitCreateIgnorePlacement, lv_modeSelected, Point(128 + RandomFixed(-24, 24), 128 + RandomFixed(-24, 24)), RandomFixed(0, 360));
        CameraPan(lv_modeSelected, UnitGetPosition(UnitLastCreated()), 1.0, -1, -1, false);
    }
   
    DebugMsg("Vote Selected: " + IntToString(lv_modeSelected));
    TimerPause(gv_voteCountdownTimer, true);
    DialogSetVisible(gv_voteMenuDialog, gv_allPlayers, false);
    return true;
}
// Timer countdown label shows time left to vote.
bool gt_voteCountdown_Func (bool testConds, bool runActions) {
    text lv_txt = StringToText("<s val=\"ModCenterSize20Bold\"><c val=\"EA0F3A\">" + FixedToString(TimerGetRemaining(gv_voteTimer), 2) + " seconds left to vote");
    DialogControlSetPropertyAsText(gv_voteMenuTimerLabel, c_triggerControlPropertyText, gv_allPlayers, lv_txt);
    return true;
}
//--------------------------------------------------------------------------------------------------
// Register Vote Timer Events
void gt_onVote_Init () {
    TriggerAddEventTimer(gt_onVote, gv_voteTimer);
    TriggerAddEventTimer(gt_voteCountdown, gv_voteCountdownTimer);
}
//--------------------------------------------------------------------------------------------------

//--------------------------------------------------------------------------------------------------
// Custom Script: Vote Configures
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
// Functions that configure a vote, setting the text for each option, start the vote with a certain
// amount of time to vote before it automatically casts the vote, and setting the title / subtitle.
//--------------------------------------------------------------------------------------------------
void gf_VotePickGameMode() {
    gv_optionButtonText[0] = StringToText("Random");
    gv_optionButtonText[1] = StringToText("Team Deathmatch");
    gv_optionButtonText[2] = StringToText("Capture The Flag");
    gv_optionButtonText[3] = StringToText("Survival");
    gv_optionButtonText[4] = StringToText("Bomb The Base");
    gv_optionButtonText[5] = StringToText("Zerg vs Marines");
   
    gf_callVote("Game Mode", 15.0, "Mode", "Select game mode", 5);
}
void gf_VoteKickPlayer() {
    int lv_i;
    while(lv_i <= 15) {
        gv_optionButtonText[lv_i] = gv_playerNameColored[lv_i] + StringToText(" (P") + IntToText(lv_i) + StringToText(")");
        lv_i += 1;
    }
    gv_optionButtonText[16] = StringToText("Do Not Kick Anyone");
    gf_callVote("Kick Player", 30.0, "Kick", "Select player to be kicked", 16);
}
void gf_VoteManyOptions() {
    int lv_i;
    while(lv_i < 30) {
        gv_optionButtonText[lv_i] = StringToText("Option: ") + TextWithColor(IntToText(lv_i + 1), ColorWithAlpha(100 - lv_i*5, lv_i*5, RandomFixed(0, 100), 0));
        lv_i += 1;
    }
    gf_callVote("Many Options", 5.0, "Many Options", "A whole lot of options", 29);
}

//--------------------------------------------------------------------------------------------------
// Custom Script: Vote Cast
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
// This function is what allows players to vote and to switch their vote before the vote expires.
//--------------------------------------------------------------------------------------------------
void gf_VoteCast (int lp_dialogControl, int lp_player) {
    text        lv_style = StringToText("<s val=\"ModCenterSize12\">");
    playergroup lv_pg    = PlayerGroupSingle(lp_player);
    int         lv_i;
   
    gv_votingPlayers = PlayerGroupCount(PlayerGroupActive());
    while(lv_i < c_voteOptionsCount) {
        if (lp_dialogControl == gv_voteMenuButton[lv_i]) {
            if (!gv_hasVoted[lp_player]) {
                gv_votesFor[lv_i] += 1;
                gv_votedFor[lp_player] = lv_i;
                gv_hasVoted[lp_player] = true;
                gv_votesCast += 1;
                if (gv_votesCast == gv_votingPlayers) {
                    TimerStart(gv_voteTimer, 0.0, false, c_timeReal);
                }
            } else {
                gv_votesFor[gv_votedFor[lp_player]] += -1;
                DialogControlSetPropertyAsText(gv_voteLabel[gv_votedFor[lp_player]], c_triggerControlPropertyText, gv_allPlayers, lv_style + IntToText(gv_votesFor[gv_votedFor[lp_player]]));
                gv_votesFor[lv_i] += 1;
                gv_votedFor[lp_player] = lv_i;
                UIDisplayMessage(lv_pg, c_messageAreaDebug, gv_playerNameColored[lp_player] + StringToText(" switched vote."));
            }
            DialogControlSetPropertyAsText(gv_voteLabel[lv_i], c_triggerControlPropertyText, gv_allPlayers, lv_style + IntToText(gv_votesFor[lv_i]));
        }
        lv_i += 1;
    }
}

Name: Anonymous 2012-03-02 14:46

//--------------------------------------------------------------------------------------------------
// Custom Script: Vote Dialog Create
//--------------------------------------------------------------------------------------------------
void gt_VoteDialogCreate_Func () {
    const int   lv_width    = 400;
    const int   lv_height   = 70 + 70 + (25 * c_voteOptionsCount);
    const int   lv_anchor   = c_anchorCenter;
    const int   lv_offsetX  = 0;
    const int   lv_offsetY  = 0;
    const bool  lv_modal    = false;
    const string lv_bgImage = c_voteBg;
    const string lv_style   = "<s val=\"ModCenterSize24Bold\">";
   
    text        lv_txt;
    int         lv_i;
   
    gv_voteMenuDialog = DialogCreate(lv_width, lv_height, lv_anchor, lv_offsetX, lv_offsetY, lv_modal);
    DialogSetImage(gv_voteMenuDialog, lv_bgImage);
    DialogSetVisible(gv_voteMenuDialog, gv_allPlayers, false);
   
    gv_voteMenuTitle = DialogControlCreate(gv_voteMenuDialog, c_triggerControlTypeLabel);
    DialogControlSetSize(gv_voteMenuTitle, gv_allPlayers, lv_width, lv_height);
    DialogControlSetPosition(gv_voteMenuTitle, gv_allPlayers, c_anchorTop, 0, 6);
    lv_txt = StringToText("<c val=\"F85F34\">Title</n><s val=\"ModCenterSize20\">Subtitle");
    DialogControlSetPropertyAsText(gv_voteMenuTitle, c_triggerControlPropertyText, gv_allPlayers, StringToText(lv_style) + lv_txt);
    DialogControlSetPropertyAsString(gv_voteMenuTitle, c_triggerControlPropertyStyle, gv_allPlayers, "CenterJustified");
    DialogControlSetVisible(gv_voteMenuTitle, gv_allPlayers, true);
   
    gv_voteMenuTimerLabel = DialogControlCreate(gv_voteMenuDialog, c_triggerControlTypeLabel);
    DialogControlSetSize(gv_voteMenuTimerLabel, gv_allPlayers, lv_width, 35);
    DialogControlSetPosition(gv_voteMenuTimerLabel, gv_allPlayers, c_anchorBottom, 0, 0);
    lv_txt = StringToText("<c val=\"EA0F3A\">0 seconds left to vote");
    DialogControlSetPropertyAsText(gv_voteMenuTimerLabel, c_triggerControlPropertyText, gv_allPlayers, StringToText("<s val=\"ModCenterSize20Bold\">") + lv_txt);
    DialogControlSetPropertyAsString(gv_voteMenuTimerLabel, c_triggerControlPropertyStyle, gv_allPlayers, "CenterJustified");
    DialogControlSetVisible(gv_voteMenuTimerLabel, gv_allPlayers, true);
   
    while(lv_i < c_voteOptionsCount) {
        gv_voteMenuButton[lv_i] = DialogControlCreate(gv_voteMenuDialog, c_triggerControlTypeButton);
        DialogControlSetSize(gv_voteMenuButton[lv_i], gv_allPlayers, lv_width - 24, 24);
        DialogControlSetPosition(gv_voteMenuButton[lv_i], gv_allPlayers, c_anchorTop, 0, 70 + (25 * lv_i));
        DialogControlSetPropertyAsString(gv_voteMenuButton[lv_i], c_triggerControlPropertyImage, gv_allPlayers, c_voteOptionButton);
        DialogControlSetPropertyAsString(gv_voteMenuButton[lv_i], c_triggerControlPropertyHoverImage, gv_allPlayers, c_voteOptionButtonHover);
        DialogControlSetPropertyAsInt(gv_voteMenuButton[lv_i], c_triggerControlPropertyImageType, gv_allPlayers, c_triggerImageTypeBorder);
       
        gv_voteMenuLabel[lv_i] = DialogControlCreate(gv_voteMenuDialog, c_triggerControlTypeLabel);
        DialogControlSetSize(gv_voteMenuLabel[lv_i], gv_allPlayers, lv_width - 24, 24);
        DialogControlSetPosition(gv_voteMenuLabel[lv_i], gv_allPlayers, c_anchorTop, 0, 73 + (25 * lv_i));
        lv_txt = StringToText("Option " + IntToString(lv_i + 1));
        DialogControlSetPropertyAsText(gv_voteMenuLabel[lv_i], c_triggerControlPropertyText, gv_allPlayers, lv_txt);
        DialogControlSetPropertyAsString(gv_voteMenuLabel[lv_i], c_triggerControlPropertyStyle, gv_allPlayers, "CenterJustified");
        DialogControlSetVisible(gv_voteMenuLabel[lv_i], gv_allPlayers, true);
       
        gv_voteLabel[lv_i] = DialogControlCreate(gv_voteMenuDialog, c_triggerControlTypeLabel);
        DialogControlSetSize(gv_voteLabel[lv_i], gv_allPlayers, lv_width - 24, 24);
        DialogControlSetPosition(gv_voteLabel[lv_i], gv_allPlayers, c_anchorTop, 0, 73 + (25 * lv_i));
        DialogControlSetPropertyAsString(gv_voteLabel[lv_i], c_triggerControlPropertyStyle, gv_allPlayers, "RightJustified");
        DialogControlSetPropertyAsFixed(gv_voteLabel[lv_i], c_triggerControlPropertyValue, gv_allPlayers, 0.0);
        DialogControlSetVisible(gv_voteLabel[lv_i], gv_allPlayers, true);
        lv_i += 1;
    }
}

Name: Anonymous 2012-03-02 14:47

//--------------------------------------------------------------------------------------------------
// Custom Script: on Message
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
// Ingame chat commands.
//--------------------------------------------------------------------------------------------------
bool gt_onMessage_Func (bool testConds, bool runActions) {
    string          lv_s        = EventChatMessage(false);
    int             lv_p        = EventPlayer();
    int             lv_i;
   
    if (StringSub(lv_s, 1, 5) == "-kick") {
        gf_VoteKickPlayer();
    } else if (StringSub(lv_s, 1, 3) == "-rm") {
        gf_VotePickGameMode();
    } else if (StringSub(lv_s, 1, 13) == "-many options") {
        gf_VoteManyOptions();
    } else if (StringSub(lv_s, 1, 7) == "-frame ") {
        UISetFrameVisible(PlayerGroupSingle(lv_p), StringToInt(StringSub(lv_s, 7, 9)), !UIFrameVisible(lv_p, StringToInt(StringSub(lv_s, 7, 9))));
    } else if (StringSub(lv_s, 1, 8) == "-weapon ") {
        gv_uWeapon[gf_CV(UnitGroupUnit(UnitGroupSelected(lv_p), 1))] = StringToInt(StringSub(lv_s, 8, 10));
    } else if (StringSub(lv_s, 1, 7) == "-spawn ") {
        lv_s = StringSub(lv_s, 7, 77);
        UnitCreate(StringToInt(StringWord(lv_s, 2)), StringWord(lv_s, 1), c_unitCreateIgnorePlacement, lv_p, CameraGetTarget(lv_p), RandomFixed(0, 360));
    } else if (StringSub(lv_s, 1, 6) == "-order") {
        DialogSetVisible(gv_orderSuppliesDialog, PlayerGroupSingle(lv_p), !DialogIsVisible(gv_orderSuppliesDialog, lv_p));
    }else if (StringSub(lv_s, 1, 6) == "-ally ") {
        lv_s = StringSub(lv_s, 6, 8);
        lv_i = StringToInt(lv_s);
        AllyPlayer(lv_p, lv_i, true);
        UIDisplayMessage(gv_allPlayers, c_messageAreaChat, gv_playerNameColored[lv_p] + StringToText(" has <c val=\"00FF00\">allied</c> ") + gv_playerNameColored[lv_i]);
    } else if (StringSub(lv_s, 1, 8) == "-unally ") {
        lv_s = StringSub(lv_s, 8, 10);
        lv_i = StringToInt(lv_s);
        AllyPlayer(lv_p, lv_i, false);
        UIDisplayMessage(gv_allPlayers, c_messageAreaChat, gv_playerNameColored[lv_p] + StringToText(" has <c val=\"FF0000\">unallied</c> ") + gv_playerNameColored[lv_i]);
    }
    return true;
}
//--------------------------------------------------------------------------------------------------
// Register when a player enters a message.
void gt_onMessage_Init () {
    TriggerAddEventChatMessage(gt_onMessage, c_playerAny, "", false);
}
//--------------------------------------------------------------------------------------------------

//--------------------------------------------------------------------------------------------------
// Custom Script: on Button Press
//--------------------------------------------------------------------------------------------------
bool gt_onButtonPress_Func (bool testConds, bool runActions) {
    int         lv_dc   = EventDialogControl();
    int         lv_p    = EventPlayer();
    playergroup lv_pg   = PlayerGroupSingle(lv_p);
    fixed       lv_r;
    int         lv_i;
    int         lv_i2;
   
    while(lv_i < c_voteOptionsCount) {
        if (lv_dc == gv_voteMenuButton[lv_i]) {
            gf_VoteCast(lv_dc, lv_p);
            return true;
        }
        lv_i += 1;
    }
    lv_i = 0;
    while(lv_i < c_orderSuppliesButtonCount) {
        if (lv_dc == gv_orderSuppliesButton[lv_i][0]) {
            gf_OrderSupplies(lv_dc, lv_p, lv_i, 1);
            return true;
        } else if (lv_dc == gv_orderSuppliesButton[lv_i][1]) {
            gf_OrderSupplies(lv_dc, lv_p, lv_i, -1);
            return true;
        }
        lv_i += 1;
    }
    if (lv_dc == gv_orderSuppliesPurchase) {
        gf_PurchaseSupplies(lv_p);
    } else if (lv_dc == gv_orderSuppliesClear) {
        gf_ClearSuppliesOrders(lv_p);
    }
    return true;
}
//--------------------------------------------------------------------------------------------------
void gt_onButtonPress_Init () {
    TriggerAddEventDialogControl(gt_onButtonPress, c_playerAny, c_invalidDialogControlId, c_triggerControlEventTypeClick);
}

//--------------------------------------------------------------------------------------------------
// Custom Script: on Ability Command
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
// Fire projectiles at target point (hotkey = A).
//--------------------------------------------------------------------------------------------------
bool gt_onAbilityCommand_Func (bool testConds, bool runActions) {
    unit        lv_u        = EventUnit();
    point       lv_pt       = UnitGetPosition(lv_u);
    point       lv_ptB      = EventUnitTargetPoint();
    fixed       lv_angle    = AngleBetweenPoints(lv_pt, lv_ptB);
    point       lv_ptA      = PointWithOffsetPolar(lv_pt, 0.75, lv_angle);
    int         lv_cv       = gf_CV(lv_u);
    actor       lv_actor;
   
    lv_actor = libNtve_gf_MainActorofUnit(lv_u);
    libNtve_gf_PlayAnimation(lv_actor, c_animNameDefault, "Attack", 0, c_animTimeDefault);
    libNtve_gf_SetAnimationDuration(lv_actor, c_animNameDefault, gv_weaponInterval[lv_cv]*gv_weaponProjPerShot[lv_cv]);
    libNtve_gf_SetAnimationTimeScale(lv_actor, c_animNameDefault, 1.0);
   
    gf_WeaponFire(lv_u, gv_uWeapon[lv_cv], lv_pt, lv_ptB);
    return true;
}
//--------------------------------------------------------------------------------------------------
// Register the weapon fire ability.
void gt_onAbilityCommand_Init () {
    TriggerAddEventUnitAbility(gt_onAbilityCommand, null, AbilityCommand(c_projFireAbility, 0), c_unitAbilStageExecute, false);
}
//--------------------------------------------------------------------------------------------------

//--------------------------------------------------------------------------------------------------
// Custom Script: on Jump
//--------------------------------------------------------------------------------------------------
bool gt_onJump_Func (bool testConds, bool runActions) {
    unit        lv_u        = EventUnit();
    int         lv_cv       = FixedToInt(UnitGetCustomValue(lv_u, c_uIndex));
   
    if (UnitGetHeight(lv_u) == 0) {
        gv_velZ[lv_cv] += 3.0;
        UnitBehaviorAdd(lv_u, c_jumpBehavior, lv_u, 1);
    } else if (UnitHasBehavior(lv_u, c_jumpBehavior)) {
        gv_velZ[lv_cv] += 5.0;
    }
   
    return true;
}
void gt_onJump_Init () {
    TriggerAddEventUnitAbility(gt_onJump, null, AbilityCommand(c_jumpAbility, 0), c_unitAbilStageExecute, false);
}

Name: Anonymous 2012-03-02 14:47

//--------------------------------------------------------------------------------------------------
// Custom Script: on Death
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
// Recycle the index of units when they're dead.
//--------------------------------------------------------------------------------------------------
bool gt_onDeath_Func (bool testConds, bool runActions) {
    unit    lv_u    = EventUnit();
    int     lv_cv   = FixedToInt(UnitGetCustomValue(lv_u, c_uIndex));
   
    gv_unitIndex[lv_cv] = false;
    return true;
}
//--------------------------------------------------------------------------------------------------
// Register Death Event
void gt_onDeath_Init () {
    TriggerAddEventUnitDied(gt_onDeath, null);
}
//--------------------------------------------------------------------------------------------------

//--------------------------------------------------------------------------------------------------
// Custom Script: on Collide
//--------------------------------------------------------------------------------------------------
bool gt_onDamage_Func (bool testConds, bool runActions) {
    unit    lv_u    = EventUnitDamageSourceUnit(); // Unit dealing damage.
    unit    lv_u2   = EventUnit(); // Unit taking damage.
    string  lv_ut   = UnitGetType(lv_u);
    fixed   lv_hp   = UnitGetPropertyFixed(lv_u, c_unitPropLife, true);
    int     lv_cv   = FixedToInt(UnitGetCustomValue(lv_u, c_uIndex));
    point   lv_ptA  = UnitGetPosition(lv_u);
    point   lv_ptB  = UnitGetPosition(lv_u2);
    fixed   lv_zwA  = WorldHeight(c_heightMapGround, lv_ptA) + UnitGetHeight(lv_u);
    fixed   lv_zwB  = WorldHeight(c_heightMapGround, lv_ptB) + UnitGetHeight(lv_u2);
   
    if (lv_ut == c_projectile) {
        //((a.vel.x + b.vel.x)/4)*-1
        if (lv_zwA - lv_zwB > -0.5 && lv_zwA - lv_zwB < 1.0) {
            // Apply damage when a projectile hits an enemy.
            UnitDamage(lv_u, c_damageNormal, lv_u2, gv_projDmg[lv_cv]);
            UnitKill(lv_u);
        }
    }
   
    return true;
}
//--------------------------------------------------------------------------------------------------
// The unit isn't actually being damaged here... this is done as a way to do unit enums efficiently.
void gt_onDamage_Init () {
    TriggerAddEventUnitDamaged(gt_onDamage, null, c_unitDamageTypeAny, c_unitDamageEither, c_damageProjectile);
}
//--------------------------------------------------------------------------------------------------

//--------------------------------------------------------------------------------------------------
// Custom Script: Player Income
//--------------------------------------------------------------------------------------------------
//---------- Configurable Constants ----------
// The time interval that we add resources to each player.
const fixed c_playerIncomeUpdateInterval = 0.5;
// The income is how much of the given resource is earned per interval.
const fixed c_playerIncome               = 5.0;
//--------------------------------------------
trigger     gt_PlayerIncomeUpdate       = TriggerCreate("gt_PlayerIncomeUpdate_Func");
bool gt_PlayerIncomeUpdate_Func (bool testConds, bool runActions) {
    int lv_i;
   
    while (lv_i <= 15) {
        PlayerModifyPropertyFixed(lv_i, c_playerPropMinerals, c_playerPropOperAdd, c_playerIncome);
        lv_i += 1;
    }
    return true;
}
void gt_PlayerIncome_Init () {
    TriggerAddEventTimePeriodic(gt_PlayerIncomeUpdate, c_playerIncomeUpdateInterval, c_timeReal);
}

//--------------------------------------------------------------------------------------------------
// Custom Script: Map Info Variables
//--------------------------------------------------------------------------------------------------
int gv_mapInfoDialog;
int gv_mapInfoLabel;

//--------------------------------------------------------------------------------------------------
// Custom Script: Map Info Dialog Create
//--------------------------------------------------------------------------------------------------
void gt_MapInfoDialogCreate_Func () {
    const int   lv_width    = 400;
    const int   lv_height   = 38;
    const int   lv_anchor   = c_anchorTopRight;
    const int   lv_offsetX  = 25;
    const int   lv_offsetY  = 326;
    const bool  lv_modal    = false;
    const string lv_bgImage = "Assets\\Textures\\blank.dds";
    const string lv_style   = "<s val=\"ModCenterSize16Bold\">";
   
    text        lv_txt;
   
    gv_mapInfoDialog = DialogCreate(lv_width, lv_height, lv_anchor, lv_offsetX, lv_offsetY, lv_modal);
    DialogSetImage(gv_mapInfoDialog, lv_bgImage);
    DialogSetVisible(gv_mapInfoDialog, gv_allPlayers, true);
   
    gv_mapInfoLabel = DialogControlCreate(gv_mapInfoDialog, c_triggerControlTypeLabel);
    DialogControlSetSize(gv_mapInfoLabel, gv_allPlayers, lv_width, lv_height);
    DialogControlSetPosition(gv_mapInfoLabel, gv_allPlayers, c_anchorBottom, 0, 0);
    lv_txt = StringToText(c_mapInfoString);
    DialogControlSetPropertyAsText(gv_mapInfoLabel, c_triggerControlPropertyText, gv_allPlayers, StringToText(lv_style) + lv_txt);
    DialogControlSetPropertyAsString(gv_mapInfoLabel, c_triggerControlPropertyStyle, gv_allPlayers, "RightJustified");
    DialogControlSetVisible(gv_mapInfoLabel, gv_allPlayers, true);
}

Name: Anonymous 2012-03-02 14:48

//--------------------------------------------------------------------------------------------------
// Custom Script: Map Load
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
// Trigger: Elapsed
//--------------------------------------------------------------------------------------------------
bool gt_MapLoad_Func (bool testConds, bool runActions) {
    int     lv_i = 1;
    int     lv_i2;
    unit    lv_u;
    point   lv_pt;
    fixed   lv_zw;
    int     lv_cv;
   
    // Reveal terrain
    VisEnable(c_visTypeMask, false);
    VisEnable(c_visTypeFog, false);
   
    // Set resource trading timer countdown to 0.
    UISetResourceTradeCountdownTime(0);
   
    // Camera is zoomed out at the start.
    CameraSetValue(1, c_cameraValueDistance, 60.0, 1.0, -1, 10);
   
    while(lv_i <= gv_maxPlayers) {
        // Starting units
        lv_pt = Point(119.5, 170);
        lv_u = PhysicsUnitCreate("Marine", lv_i, lv_pt, 15.0, 2);
       
        UnitGroupAdd(gv_physicsUG, lv_u);
        UnitSelect(lv_u, lv_i, true);
        CameraPan(lv_i, UnitGetPosition(lv_u), 0.0, -1, -1, false);
        UnitControlGroupAddUnit(lv_i, 1, lv_u);
        UnitIssueOrder(lv_u, OrderTargetingPoint(AbilityCommand("move", 0), Point(119.5, 150.0)), c_orderQueueReplace);
       
        // --------- Player properties ---------
        PlayerModifyPropertyFixed(lv_i, c_playerPropMinerals, c_playerPropOperAdd, 1000);
        lv_i2 = 1;
        while(lv_i2 <= gv_maxPlayers) {
            PlayerSetAlliance(lv_i, c_allianceIdChat, lv_i2, true);
            lv_i2 += 1;
        }
        // -------------------------------------
       
        // Check if mapmaker is present in the game.
        if (PlayerHandle(lv_i) == "1-S2-1-1305364") {
            DebugMsg("Mapmaker <c val=\"30C8FA\">ChuckNorris</c> is present in the game.");
        }
       
        lv_i += 1;
    }
   
    Wait(0.5, c_timeReal);
   
    gf_TerrainGenerator(1000, "DestructibleKorhalTree", "MarSaraCactus");
   
    return true;
}
//--------------------------------------------------------------------------------------------------
void gt_MapLoad_Init () {
    int lv_i;
    while(lv_i <= 15) {
        gv_playerColor[lv_i]        = ColorFromIndex(PlayerGetColorIndex(lv_i, false),  c_teamColorDiffuse);
        if (PlayerType(lv_i) != c_playerTypeNone) {
            gv_playerName[lv_i]     = PlayerName(lv_i);
        } else {
            gv_playerName[lv_i]     = StringToText("Computer ") + IntToText(lv_i);
        }
        gv_playerNameColored[lv_i]  = TextWithColor(gv_playerName[lv_i], gv_playerColor[lv_i]);
        lv_i += 1;
    }
    lv_i = c_syncFrameTypeFirst;
    while(lv_i <= c_syncFrameTypeLast) {
        UISetFrameVisible(gv_allPlayers, lv_i, false);
        lv_i += 1;
    }
    UISetFrameVisible(gv_allPlayers, c_syncFrameTypeMenuBar, true);
    UISetFrameVisible(gv_allPlayers, c_syncFrameTypeTeamResourceButton, true);
    UISetFrameVisible(gv_allPlayers, c_syncFrameTypeControlGroupPanel, true);
    UISetFrameVisible(gv_allPlayers, c_syncFrameTypeMinimapPanel, true);
    UISetFrameVisible(gv_allPlayers, c_syncFrameTypeCommandPanel, true);
    UISetBattleNetButtonOffset(gv_allPlayers, 14, 289);
    TriggerAddEventTimeElapsed(gt_MapLoad, 0.5, c_timeGame);
}

//--------------------------------------------------------------------------------------------------
// Custom Script: Slide
//--------------------------------------------------------------------------------------------------
bool gt_Slide_Func (bool testConds, bool runActions) {
    unit    lv_u  = EventUnit();
    point   lv_pt = Point(119.5, 170);
    string  lv_ut = UnitGetType(lv_u);
   
    if (lv_ut != c_projectile) {
        UnitSetPosition(lv_u, lv_pt, false);
    }
    return true;
}
//--------------------------------------------------------------------------------------------------
void gt_Slide_Init () {
    trigger gt_Slide = TriggerCreate("gt_Slide_Func");
    TriggerAddEventUnitRegion(gt_Slide, null, RegionCircle(Point(119.5, 153.0), 2.0), true);
}

//--------------------------------------------------------------------------------------------------
// Custom Script: Volcano
//--------------------------------------------------------------------------------------------------
abilcmd     gv_volcAbilCmd  = AbilityCommand(c_projFireAbility, 0);
point       gv_volcPoint    = Point(127, 110);
fixed       gv_volcAngle    = RandomFixed(0.0, 360.0);
trigger     gt_volcano      = TriggerCreate("gt_Volcano_Func");
timer       gv_volcanoTimer = TimerCreate();
bool gt_Volcano_Func (bool testConds, bool runActions) {
    point lv_pt;
    gv_volcAngle += RandomFixed(0.5, 3.0);
    lv_pt = PointWithOffsetPolar(gv_volcPoint, RandomFixed(0.0, 7.5), RandomFixed(0.0, 360.0));
    UnitIssueOrder(gv_volcanoMarine, OrderTargetingPoint(gv_volcAbilCmd, lv_pt), c_orderQueueReplace);
    return true;
}
void gt_Volcano_Init () {
    UnitCreate(1, "Marine", c_unitCreateIgnorePlacement, 15, Point(127, 110), RandomFixed(0, 360));
    gv_volcanoMarine = UnitLastCreated();
    IndexUnit(gv_volcanoMarine);
    gv_uWeapon[gf_CV(gv_volcanoMarine)] = 6;
    UnitSetPropertyFixed(gv_volcanoMarine, c_unitPropLife, 50000);
    UnitSetPropertyFixed(gv_volcanoMarine, c_unitPropLifeMax, 50000);
    UnitSetPropertyFixed(gv_volcanoMarine, c_unitPropLifeRegen, 10.0);
    TimerStart(gv_volcanoTimer, 0.15, true, c_timeReal);
    TriggerAddEventTimer(gt_volcano, gv_volcanoTimer);
}

Name: Anonymous 2012-03-02 14:48

//--------------------------------------------------------------------------------------------------
// Custom Script Initialization
//--------------------------------------------------------------------------------------------------
void InitCustomScript () {
    gt_MapLoadPhysicsBehaviour_Init();
    gt_MapLoadWeapons_Init();
    gt_Physics_Init();
    gt_TerrainDialogCreate_Func();
    gt_OrderSuppliesDialogCreate_Func();
    gt_onVote_Init();
    gt_onVote_Init();
    gt_VoteDialogCreate_Func();
    gt_onMessage_Init();
    gt_onButtonPress_Init();
    gt_onAbilityCommand_Init();
    gt_onJump_Init();
    gt_onDeath_Init();
    gt_onDamage_Init();
    gt_PlayerIncome_Init();
    gt_MapInfoDialogCreate_Func();
    gt_MapLoad_Init();
    gt_Slide_Init();
    gt_Volcano_Init();
}

//--------------------------------------------------------------------------------------------------
// Map Initialization
//--------------------------------------------------------------------------------------------------
void InitMap () {
    InitLibs();
    InitCustomScript();
}

Name: Anonymous 2012-03-02 14:49

[/i]That is my entire map script :D[/i]

Name: Anonymous 2012-03-02 15:33

You guys notice how I make "tables" out of arrays?

What am I doing there? Is that proper?

Name: Anonymous 2012-03-02 15:35

>>40
looks shite.

Name: Anonymous 2012-03-02 15:41

>>42
Well wat do? My script is very fast & I'm considered really skilled relative to the average mapmaker who just uses GUI or some shit...

Name: Anonymous 2012-03-02 16:01

If you're "really skilled", why are you asking for our opinions? No matter how good you get at making maps with a shitty scripting language, that's all you'll ever be able to do. Make shitty maps. Don't bother learning the "good" way to do things, because no matter what you do, it will be shit.

Name: Anonymous 2012-03-02 16:07

>>44
You didn't pay attention to my use of relative did you? Of course I'm total shit compared to actual programmers. Also why do you hate SCII custom maps so much or do you assume my maps are shit while others are not?

y u hatin'?

Name: Anonymous 2012-03-02 16:11

Oh and also considered.

I feel like a massive faggot right now in the presence of you programming gods.

Name: Anonymous 2012-03-02 16:40

not enough closures

Name: Anonymous 2012-03-02 16:44

>>47
What are closures?

Name: Anonymous 2012-03-02 16:52

>>46
1. You are a massive faggot and we love you for it. In the butt.

2. The true programming gods on this board will not participate in conversations like this. They scoot around in buried threads from over a year ago, trading inscrutable secret messages and exchanging sage wisdom beyond the reach of mortal eyes. Look up to them, yes, but know that they are out of reach to us as well.

3. Programming is not actually valuable. Problem solving is. A good problem solver with no experience programming will quickly become a good programmer, especially if he has to work with other people's code. A bad problem solver will be a bad programmer even after a lifetime of experience. Prioritize accordingly.

4. It's good that you're asking questions but always remember that the people you ask will often turn out to be blithering idiots, or more likely just have no useful input on your problem. The latter is helped by making sure you ask good questions.

5.          ∧_∧   / ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄
          ( ´∀`) < COOL FREE RINGTONES!
        /    |    \________
       /       .|     
       / "⌒ヽ |.イ |
   __ |   .ノ | || |__
  .    ノく__つ∪∪   \
   _((_________\
    ̄ ̄ヽつ ̄ ̄ ̄ ̄ ̄ ̄ | | ̄
   ___________| |
    ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄| |

Name: Anonymous 2012-03-02 16:57

>>3
So if it's not a local or a global variable, what is it?
You'd think that one would be redundant when the other exists.

Name: Anonymous 2012-03-02 17:04

I just made this while the thread was going and it works; spawns zerglings all over the map edges. Now I'll need to script them an AI.

//--------------------------------------------------------------------------------------------------
// Custom Script: Wave Spawn Blue
//--------------------------------------------------------------------------------------------------
region  PlayableMap     = RegionPlayableMap();
point   PlayableMapMin  = RegionGetBoundsMin(PlayableMap);
point   PlayableMapMax  = RegionGetBoundsMax(PlayableMap);
fixed   PMMinX          = PointGetX(PlayableMapMin);
fixed   PMMinY          = PointGetY(PlayableMapMin);
fixed   PMMaxX          = PointGetX(PlayableMapMax);
fixed   PMMaxY          = PointGetY(PlayableMapMax);

bool gt_WaveSpawnBlue_Func (bool testConds, bool runActions) {
    point   pt;
    int     i = RandomInt(0, 3);
    if (i == 0) {
        pt = Point(PMMinX, RandomFixed(PMMinY, PMMaxY));
    } else if (i == 1) {
        pt = Point(PMMaxX, RandomFixed(PMMinY, PMMaxY));
    } else if (i == 2) {
        pt = Point(RandomFixed(PMMinX, PMMaxX), PMMinY);
    } else if (i == 3) {
        pt = Point(RandomFixed(PMMinX, PMMaxX), PMMaxY);
    }
   
    UnitCreate(1, "Zergling", 0, 15, pt, RandomFixed(0, 360));
    return true;
}

trigger gt_WaveSpawnBlue = TriggerCreate("gt_WaveSpawnBlue_Func");
void gt_WaveSpawnBlue_Init () {
    TriggerAddEventTimePeriodic(gt_WaveSpawnBlue, 1.0, c_timeReal);
}

Name: Anonymous 2012-03-02 17:08

>>50
Maybe I should drop the use of the lv_ prefix for locals but continue with the prefixes for globals... or are you talking about c_ vs gv_? It's not very clear to me which prefix you're proclaiming to be redundant. Could be a parameter if it's not a local or global variable. That's about it though.

Name: Anonymous 2012-03-02 17:09

>>52
I'm claiming that either one will obsolete as long as the other is being used. Keeping the global one would be better though.

Name: Anonymous 2012-03-02 17:10

Forgot to remove the gt_ prefix from my previous script I just made, it's there because I copypasted an older script (template) then rewrote it to save time.

Name: Anonymous 2012-03-02 17:16

>>53
Like this?

region  gv_PlayableMap     = RegionPlayableMap();
point   gv_PlayableMapMin  = RegionGetBoundsMin(PlayableMap);
point   gv_PlayableMapMax  = RegionGetBoundsMax(PlayableMap);
fixed   gv_PMMinX          = PointGetX(PlayableMapMin);
fixed   gv_PMMinY          = PointGetY(PlayableMapMin);
fixed   gv_PMMaxX          = PointGetX(PlayableMapMax);
fixed   gv_PMMaxY          = PointGetY(PlayableMapMax);
const fixed waveSpawnTimer = 1.0;

Don't change these.
Name: Email:
Entire Thread Thread List