• 0

    posted a message on Embedded Loop

    So I got this embedded loop error in my code and I am not sure what causes it. I have tried a lot like making extra variables for the picked units. What I am trying to do is search for units of the type buff around a buff respawn (the unit Powerups). Then if there is a unit nearby the custom value 2 of Powerups should be increasing until it reaches a certain value and respawns another one. Maybe there is an even simpler way of doing it? Sorry for the long post but there was no option to use a spoiler.

    Code

    //--------------------------------------------------------------------------------------------------
    // Trigger: Respawn Buffs
    //--------------------------------------------------------------------------------------------------
    bool gt_RespawnBuffs_Func (bool testConds, bool runActions) {
        // Variable Declarations
        unit lv_buffSpawnerpick;
        unit lv_buffpick;
        int lv_buff;
    
        // Variable Initialization
        lv_buffSpawnerpick = null;
        lv_buffpick = null;
        lv_buff = 0;
    
        // Actions
        if (!runActions) {
            return true;
        }
    
        UnitGroupLoopBegin(UnitGroup(UnitTypeFromString("Powerups"), c_playerAny, RegionEntireMap(), UnitFilter((1 << c_targetFilterPsionic) | (1 << c_targetFilterStructure), 0, 0, 0), 0));
        while (!UnitGroupLoopDone()) {
            lv_buffSpawnerpick = UnitGroupLoopCurrent();
            lv_buff = 0;
            UnitGroupLoopBegin(UnitGroup(UnitTypeFromString("Buff"), c_playerAny, RegionCircle(Point(PointGetX(UnitGetPosition(UnitGroupLoopCurrent())), PointGetY(UnitGetPosition(lv_buffSpawnerpick))), 2.0), UnitFilter((1 << c_targetFilterRobotic) | (1 << c_targetFilterPsionic), 0, 0, 0), 0));
            while (!UnitGroupLoopDone()) {
                lv_buffpick = UnitGroupLoopCurrent();
                lv_buff = 1;
                UnitGroupLoopStep();
            }
            UnitGroupLoopEnd();
            if ((lv_buff == 0)) {
                UnitSetCustomValue(lv_buffSpawnerpick, 2, (UnitGetCustomValue(lv_buffSpawnerpick, 2) + 1.0));
            }
            else {
            }
            if ((UnitGetCustomValue(lv_buffSpawnerpick, 2) >= 8.0)) {
                UnitSetCustomValue(lv_buffSpawnerpick, 2, 0.0);
                libNtve_gf_CreateUnitsWithDefaultFacing(1, "Buff", 0, 15, UnitGetPosition(lv_buffSpawnerpick));
            }
            else {
            }
            UnitGroupLoopStep();
        }
        UnitGroupLoopEnd();
        return true;
    }
    
    //--------------------------------------------------------------------------------------------------
    void gt_RespawnBuffs_Init () {
        gt_RespawnBuffs = TriggerCreate("gt_RespawnBuffs_Func");
        TriggerAddEventTimePeriodic(gt_RespawnBuffs, 1.0, c_timeGame);
    }
    
    //--------------------------------------------------------------------------------------------------
    
    Posted in: Triggers
  • 0

    posted a message on View error line

    Is there a way I can view a specific line in the trigger editor? I don't write my triggers in galaxy so I have the GUI activated and now the ingame error said "...near line 192 in trigger test...", but the trigger test doesn't have 192 lines, so I guess I need to view the source code for all the triggers at once or something. Or any other way to find line 192.

    Posted in: Triggers
  • 0

    posted a message on Function with logarithm

    Thanks for the help.

    can be closed

    Posted in: Triggers
  • 0

    posted a message on Function with logarithm

    For my map I want to set a variable to this function:

    ((log(0.5X+5))^4.5)+1

    My problem is converting it in the GUI of the editor. When looking for math I can only find a logarithm with the base of 2 (Log2) but I need a logarithm with the base of 10. Any input on how I could get this function to work?

    Posted in: Triggers
  • 0

    posted a message on Unit Buff (Effects, Behaviors)

    Thanks I will try this.

    EDIT: Ok it worked :P

    Posted in: Data
  • 0

    posted a message on Unit Buff (Effects, Behaviors)

    So I tried creating this:

    A Dummy unit with the model of a Powerup and 100 HP. When any unit comes close to this unit except for structure and only biological units within a range of 3, it should apply a behavior (dummy buff) which I can use as a condition in triggers, while dealing 100 damage to itself (or better yet just instantly kill itself). The target unit should then get a red tint (Is that even possible? I could only find player colour), and scale to 200% size.

    I tried using a modified medic heal and a set of Apply behavior and Damage to do this, but I always get an error and the unit instantly disappears without applying any buff. (Maybe it targeted the structure on which it spawned, who knows)

    However a solution to this would be much appreciated.

    Posted in: Data
  • 0

    posted a message on Button/Name/ID issue

    I made a dummy ability and gave it to a unit. However, the button will not correctly display the name and tooltip of the abilities. I am very confused right now searching for what might be the problem, since the exact same term "Button/Name/ZergAttack" is listed in the Text Key List ! Here are some screenshots:

    http://www.fotos-hochladen.net/view/unojeh16umirn.jpg

    http://www.fotos-hochladen.net/view/dos0eg8ixu3q2.jpg

    http://www.fotos-hochladen.net/view/tresigr1qev3h9.jpg

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