• 0

    posted a message on Adding to Unit Group (help!)

    Hi everyone, I humbly come to you asking for your godlike expertise in the galaxy realm.

    I have the following four actions:

    Unit - Create 1 Civilian (Male) for player 14 at (Random point in (Playable map area)) using default facing (No Options)
    Debug - Display (Name of (Unit type of (Last created unit))) as debug output using Type 1, and Do display it in the game window
    Unit Group - Add (Last created unit) to Wandering Civilians 
    Debug - Display (Text((Number of Living units in Wandering Civilians ))) as debug output using Type 1, and Do display it in the game window
    

    The goal here: add my newly created unit to the Wandering Civilians group.

    It displays "Civilian" and "0" at runtime.

    My question is, why does it display 0? If I just added it to the group, wouldn't that group have at least 1? I know the LastCreatedUnit() was set properly, because it displays "Civilian", so I'm almost positive that its the Add Unit To Unit Group action that's not doing its job.

    Any help would be greatly appreciated!

    - Evan

    Posted in: Triggers
  • 0

    posted a message on Getting started with creating units

    Also, when I try to save, I get a syntax error on this code:

    // Trigger: Zombie Spawn
    //--------------------------------------------------------------------------------------------------
    bool gt_ZombieSpawn_Func (bool testConds, bool runActions) {
        // Actions
        if (!runActions) {
            return true;
        }
    
        const int array_count = 5;
        int i = 0;
        point[array_count] t;
    

    In my actions, my Custom Script action has the code in the previous post, but this generated code has a if (!runActions) { ... } which is put before my variable declarations. I know variable declarations are supposed to be the first in the function, but I can't modify the text window that shows me this generated code. What should I do?

    Thanks,

    - Evan

    Posted in: Galaxy Scripting
  • 0

    posted a message on Getting started with creating units

    Wow, that link is a gold mine! Thank you so much!

    const int array_count = 5;
    int i = 0;
    point[array_count] t;
    
    t[0] = DataTableGetPoint(true, "Zombie Spawn 1");
    t[1] = DataTableGetPoint(true, "Zombie Spawn 2");
    t[2] = DataTableGetPoint(true, "Zombie Spawn 3");
    t[3] = DataTableGetPoint(true, "Zombie Spawn 4");
    t[4] = DataTableGetPoint(true, "Zombie Spawn 5");
    
    while (i < array_count) {
    	unitgroup newUnitGroup = UnitCreate(1, "Zealot", 0, 15, t[i], 270.0f);
    	unit newUnit = UnitGroupUnit(newUnitGroup, 1);
    
    	abilCmd attackAbility = abilCmd("attack");
    	order attackOrder = order(attackAbility);
    	UnitIssueOrder(newUnit, attackOrder, 0);
    
        i += 1;
    }
    

    1. I figured out that there are such things as "point groups" that seem to be similar to my point array. I found how to get a unit out of a unit group, UnitGroupUnit(), but there's no PointGroupPoint(), or any PointGroup functions for that matter. Is there something I'm missing about point groups?

    2. How did you know that 0 was okay for the third parameter in UnitCreate? Where can I find some information on what create style means?

    3. The last parameter for UnitIssueOrder is int inQueueType. Where can I find a more indepth reference of the UnitIssueOrder function, so I can know that it's okay to put 0 in there?

    4. Does my usage of abilCmd look right? It seems awkward that to do something as simple as attacking I need two intermediate objects like that.

    5. I saw in that link that UnitCreate returned a unitgroup. In my catching of its return type, I declared a unitgroup. Is that a reference or a copy? In C that would be a copy and I'd probably be in trouble.

    Thanks so much for your help!

    Posted in: Galaxy Scripting
  • 0

    posted a message on Getting started with creating units

    Hi all, I've been searching and experimenting for a while and I'm having trouble with the galaxy editor. Here's what I have so far:

    const int array_count = 5;
    int i = 0;
    int[array_count] t;
    
    t[0] = DataTableGetPoint(true, "Zombie Spawn 1");
    t[1] = DataTableGetPoint(true, "Zombie Spawn 2");
    t[2] = DataTableGetPoint(true, "Zombie Spawn 3");
    t[3] = DataTableGetPoint(true, "Zombie Spawn 4");
    t[4] = DataTableGetPoint(true, "Zombie Spawn 5");
    
    while (i < 5) {
    
        // Unit - Create 1 Zealot for player 15 at [hoping to use t[i] here] using default facing (No Options)
        // Unit - Order (Last created unit) to ( Attack targeting (Closest unit to (Position of (Last created unit)) in (Any units in (Entire map) owned by player Any Player matching Excluded: Self, with at most Any Amount))) (Replace Existing Orders)
        i += 1;
    }
    

    The comments inside the while loop are what I'm having trouble with. Those comments came from actions, which I'm trying to translate into galaxy script.

    My end goal here is to create one zealot at each of my points, and tell them to attack the nearest enemy unit. Can anyone help me out? There's so many things I'm lost on in this.

    Thanks a bunch,

    - Evan

    Posted in: Galaxy Scripting
  • To post a comment, please or register a new account.