• 0

    posted a message on Moving region detecting unit

    Thank you again, it's seems interesting to use the radius instead of using the region, I can't test it for the moment but I'll try that soon and give you a feedback.

    Posted in: Triggers
  • 0

    posted a message on Moving region detecting unit

    Thanks for the reply, i'll try that.

    Posted in: Triggers
  • 0

    posted a message on Moving region detecting unit

    Hello everyone,

    I'm trying to get a queen creates tumor when ever its possible, but with a region stuck to it wich check if there's is already a tumor in it. The queen moving to random direction except when it leaves the creep, in wich case she's go back in the direction of the hive.

    The first part works fine, the queen, move and create tumor when it got 20 energy, but for a reason that I ignore, it sometimes create tumor near a previous one. My region is big enough I think (8.0), but it doesn't seems to detect the presence of the tumor.

    This is my script, hope someone can help me to figure out what's going wrong.

    include "TriggerLibs/NativeLib"
    
    //--------------------------------------------------------------------------------------------------
    // Library Initialization
    //--------------------------------------------------------------------------------------------------
    void InitLibs () {
        libNtve_InitLib();
    }
    
    //--------------------------------------------------------------------------------------------------
    // Global Variables
    //--------------------------------------------------------------------------------------------------
    point gv_queen_008_Position;
    bool gv_tumor_Check;
    
    void InitGlobals () {
        gv_queen_008_Position = null;
        gv_tumor_Check = false;
    }
    
    //--------------------------------------------------------------------------------------------------
    // Trigger Variables
    //--------------------------------------------------------------------------------------------------
    trigger gt_Tumor_Check;
    trigger gt_Create_Tumor;
    
    //--------------------------------------------------------------------------------------------------
    // Trigger: Tumor_Check
    //--------------------------------------------------------------------------------------------------
    bool gt_Tumor_Check_Func (bool testConds, bool runActions) {
        // Actions
        if (!runActions) {
            return true;
        }
    
        UnitGroupLoopBegin(UnitGroup(null, c_playerAny, RegionFromId(2), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
        while (!UnitGroupLoopDone()) {
            if ((UnitGetType(UnitGroupLoopCurrent()) == "CreepTumor")) {
                gv_tumor_Check = true;
            }
            else {
                gv_tumor_Check = false;
            }
            UnitGroupLoopStep();
        }
        UnitGroupLoopEnd();
        return true;
    }
    
    //--------------------------------------------------------------------------------------------------
    void gt_Tumor_Check_Init () {
        gt_Tumor_Check = TriggerCreate("gt_Tumor_Check_Func");
        TriggerAddEventTimePeriodic(gt_Tumor_Check, 0.5, c_timeGame);
    }
    
    //--------------------------------------------------------------------------------------------------
    // Trigger: Create_Tumor
    //--------------------------------------------------------------------------------------------------
    bool gt_Create_Tumor_Func (bool testConds, bool runActions) {
        // Actions
        if (!runActions) {
            return true;
        }
    
        UnitGroupLoopBegin(UnitGroupFromId(1));
        while (!UnitGroupLoopDone()) {
            gv_queen_008_Position = UnitGetPosition(UnitGroupLoopCurrent());
            RegionSetCenter(RegionFromId(2), gv_queen_008_Position);
            if ((CreepIsPresent(gv_queen_008_Position) == true)) {
                UnitIssueOrder(UnitGroupLoopCurrent(), OrderTargetingPoint(AbilityCommand("move", 0), RegionRandomPoint(RegionPlayableMap())), c_orderQueueReplace);
                if ((gv_tumor_Check == false)) {
                    UnitIssueOrder(UnitGroupLoopCurrent(), OrderTargetingPoint(AbilityCommand("QueenBuild", 0), gv_queen_008_Position), c_orderQueueReplace);
                }
                else {
                }
            }
            else {
                UnitIssueOrder(UnitGroupLoopCurrent(), OrderTargetingPoint(AbilityCommand("move", 0), RegionGetCenter(RegionFromId(1))), c_orderQueueReplace);
            }
            UnitGroupLoopStep();
        }
        UnitGroupLoopEnd();
        return true;
    }
    
    //--------------------------------------------------------------------------------------------------
    void gt_Create_Tumor_Init () {
        gt_Create_Tumor = TriggerCreate("gt_Create_Tumor_Func");
        TriggerAddEventTimePeriodic(gt_Create_Tumor, 3.0, c_timeGame);
    }
    
    //--------------------------------------------------------------------------------------------------
    // Trigger Initialization
    //--------------------------------------------------------------------------------------------------
    void InitTriggers () {
        gt_Tumor_Check_Init();
        gt_Create_Tumor_Init();
    }
    
    //--------------------------------------------------------------------------------------------------
    // Map Initialization
    //--------------------------------------------------------------------------------------------------
    void InitMap () {
        InitLibs();
        InitGlobals();
        InitTriggers();
    }
    
    Posted in: Triggers
  • 0

    posted a message on Help! If player owns unit type in region > Do this

    Delete post

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