[Project] Third Person Shooter

Discussion in 'Starcraft 2 (SC2) Editor Help' started by wingdnosring, May 10, 2010.

  1. wingdnosring

    wingdnosring New Member

    Ratings:
    +16 / 0 / -0
    What? I've listened to your suggestions. I compiled everything into a library as you said for version 6. And in 7, I'm doing more to make it user-friendly so its easier to share with others. That was your suggestion.

    You also talked to me about custom values occassionally getting wiped out. After that talk I worked on removing all but the most necessary custom values.

    I listen. I haven't used many of your systems, but I listen. Also, don't get me wrong. The main reason I don't use your systems is because I don't understand them. GUI is my limit, unfortunately.
     
  2. onisagi

    onisagi New Member

    Ratings:
    +6 / 0 / -0
    oh ya? honestly, i've never really looked too deeply into how efficient the gui converts stuff into galaxy. I just assumed that a programming language is quite hard to be truly turned into a gui click fest. But since galaxy is relatively simple and limited to its specific uses its possible.

    Anyone can program, but not everyone can optimize their code to run as fast as possible. If coding in galaxy can shave even a little bit off run times, it's well worth it, imho, even if you can't feel the change.

    But if you mean wing doesn't provide enough for people to help him, its true.. You also have to take into account this mite be a huge learning experience for him, and people need to start somewhere. He's working hard to comment all his stuff and make it all user-friendly.

    Granted that last problem was just too long, i didn't really have the time to break down all the code. I was partly hoping someone else would help out, and if nobody did, i'd find some time this week to look at it.

    And serra, your advice to him was to use your indexing system? He probably should. But i think he went in a whole different way after you suggested the issue with his previous implementation. So he did take your advice, and made a big change because of it. You seem to be amongst the best in this forum, i agree that people should try to heed your advice, but its up to each person to create his own path from your advice.

    Don't give up on this project just yet. its got potential.
     
  3. SerraAvenger

    SerraAvenger Cuz I can

    Ratings:
    +236 / 0 / -0
    This has got nothing to do with the galaxy specs. It has to do with the GUI specs, and those are awesome. Completely compiling back is rather difficult though. Especially due to the function/action specs, which are completely unecessary.

    One of many. I had at least three occasions in this thread where I said something and the next post said _exactly_ the same. My posts weren't even commented.
    Amongst other hints (which were completely ignored) were:
    Serra: Checked cam distance and stuff?
    Next post: I think it has to do with cam distance.
    S: the for loop does exactly that
    NP: Instead of picking all units in a unit group, run a for each integer loop that goes from 1 to the number of units in your group.
    Thanks for the flowers, though.
    S: Externalise similar code into a single action?
    Two posts later: sections that repeat... make it call an action or another trigger to do the work.
    You see, it is tedious for me to keep posting stuff and getting ignored. I haven't given up on the project, but I've given up on the people maintaining the project. Actually not even that, or I wouldn't have posted this! I tend to rather not waste resources if possible.
    Thanks for the flowers, though.

    Which should be your main reason to use them, instead of trying to find a workaround for yourself. If you don't understand my way, how would you ever get a better one?
    You're supposed to get others to do the work you yourself can't.
    I do go over bridges although I can't build them, nor understand why they hold me, you see?
    If I could just build my own bridges, I wouldn't have to use those that already exist and build bridges which are perfect to my needs.
    And if you don't understand the way a system works, you are supposed to ask for help. Btw, this doesn't count for my libraries only - it is valid for J4Ls libraries just as well.

    It doesn't, and I don't even think so. Optimize where necessary. If you don't feel the difference, don't put money (=time) into it. Don't optimize, use good algorithms. Even the most perfectly optimized ASM bubblesort will never outdo a poorly written ruby quicksort on large input of data.

    well best wishes and good luck on this project,
    Dave
     
  4. wingdnosring

    wingdnosring New Member

    Ratings:
    +16 / 0 / -0
    Yeah I'm working on the commenting. But honestly, some of my triggers would be difficult to follow, even if I commented every single line.

    I apologize if you feel your posts weren't being responded to properly. Yes, this is a huge learning experience for me. I could do some cool stuff in warcraft, but I neve attempted to create a customizable system like this that works for so many players at the same time.

    I wasn't stealing your thunder on this one, I was simply providing more information for the guy who asked the question. Depending how new he is to the galaxy editor, he may not have known of the Index option and therefore not understood that loops could be used the same way. I was expanding on your answer, not stealing it.

    After this I immediately started work on externalizing things. And I'm still working on that currently. I keep trying to make each individual trigger smaller as I go.

    As for not using your systems, I'm not opposed to people giving me new ways to look at things. I took Onisagi's grenade code with no complaints. It looked like it might work, so I implemented it and tested it myself. The problem with your examples is that they are in galaxy script, which I don't even know how to implement, let alone customize to suit my needs. I understand what you're saying, but I want to learn as I make this and if I simply implement something and have no idea what it does, I'm bound to use it wrong.

    As for my last problem...I knew as soon as I posted it that it was way too long, but I thought I'd head to bed and see if anybody had input overnight. If I knew what to look for based on the "Nested Iteration Detected" error message, I coudl probably find the issue myself.

    Any ideas on what that message means? It seems very specific.
     
  5. onisagi

    onisagi New Member

    Ratings:
    +6 / 0 / -0
    I guess sera felt like people were interrupting him?

    Alot of times people will elaborate on what someone says, if people notice the op not responding to the answer in front of him, probably cuz he didnt quite understand. Just a few posts ago i tried to explain about the grammar text feature to wing like three times? And seemingly ignored... until i finally see his post say that he doesn't understand what i mean... somehow i was able to answer the question 3 seperate times, without anyone jumping in and taking the cheese. But that normally doesn't happen in a forum environment.

    I don't like to make enemies... sorry if i snatched any of your flowers accidentally, no harm intended. Just trying to help the community in my own way. I've taken interest in seeing FPS/3PS evolve, so thats why i seem to help wing quite often.

    No one person can possibly know everything there is to know. Projects like this are littered with problems to be solved that may be beneficial to many. I would hate it if wing loses out on some quality help, becuz of a misunderstanding.

    wing: never seen that error. you should really make small changes at a time, so you know what happened to cause it.
     
  6. wingdnosring

    wingdnosring New Member

    Ratings:
    +16 / 0 / -0
    Yeah sorry about the grammar thing. I actually knew what you were talking about but you said the word 'interface' which made me think there was something more to it. As you said, it was just a misunderstanding. I commented nearly every line of some of the larger triggers yesterday. It's still cluttered, but maybe people can understand what the heck I'm doing once version 7 gets uploaded.

    This is the section that produces the iteration:

    Code:
    General - For each integer GroupLoop from 1 to (Number of Living units in PotentialTargetsGroup) with increment 1, do (Actions)
                                        Actions
                                            General - If (Conditions) then do (Actions) else do (Actions)
                                                If
                                                    (Determine Open Target((Unit GroupLoop from PotentialTargetsGroup), (Picked unit))) == true
                                                Then
                                                    Unit - Remove 1 NullCoverHidingBuff from (Picked unit)
                                                    Unit - Add 1 NullCoverAimingBuff to (Picked unit) from (Owner of (Picked unit))
                                                    Unit - Enable the Attack ability for (Picked unit)
                                                    Unit - Order (Picked unit) to ( Attack (Unit GroupLoop from PotentialTargetsGroup)) (Replace Existing Orders)
                                                    UI - Display "Open Target" and play Marine_DeathFXSilentKill for (All players)
                                                    Variable - Set FoundTarget = true
                                                    General - Break
                                                Else
    I believe it's in there somewhere. I thought it might be the custom function Determine Open Target, but I don't have a problem with it outside of this trigger.
     
  7. SerraAvenger

    SerraAvenger Cuz I can

    Ratings:
    +236 / 0 / -0
    A simple quote is often enough. And I don't know about the forum environment you come from, but in this forum you usually say "what XYZ means is that" or "Do what XYZ is saying" when someone in the thread actually had the answer already.
    Just not responding will stop people getting interested.
    That's why I said: You need to change your attitude/posting behaviour.

    @wing: What I don't understand is the picked unit in the if statement. Please show more context.

    EDIT:
    Also show the compiled code.
     
  8. wingdnosring

    wingdnosring New Member

    Ratings:
    +16 / 0 / -0
    The larger context is on the last page. It's that massive trigger I posted. The picked unit refers to the unit group at the beginning of the trigger. Basically, it grabs the all enemies within 15 range of the user and changes their current behavior. This may sound like a nooby question, but how would I go about posting the compiled code?

    [Edit]: I have an opinion questoin for you guys too. I recently added in a bunch of new variables for weapons that will allow people to add/alter recoil rings around their weapon's aim. If you've played any popular shooters recently, you've probably noticed similar effects. Basically, the longer you shoot without a break in your fire, or if you're moving, your accuracy is decreased and the image in the center of the screen becomes larger. So if you offload an entire assault rifle clip in one go, your accuracy becomes the same as if you weren't aiming at all. But here's my question:

    The idea behind systems like these is to encourage firing in quick, controlled bursts, instead of spraying bullets everywhere. I've found that even if the zoom image ends up covering the entire screen, most shots still end up near the center. This is because my variation is determined by a random real between -bullet variation to +bullet variation. So naturally, 50% of all shots will be within the center area. Would it be wise of me to alter the code so that it favors higher numbers, so that most bullets end up near the outside of the recoil ring? Or would that just be frustrating?
     
  9. SerraAvenger

    SerraAvenger Cuz I can

    Ratings:
    +236 / 0 / -0
    >how would I go about posting the compiled code?
    Press Ctrl+F11 or search for "Compile All" or something in trigger editor.
    Then search for your function and cnp the result. Be sure to use code/jass tags.

    >variation
    I don't really know how your bullets work.
    I usually use vector arithmetics.

    You might want to look at this:
    http://www.thehelper.net/forums/showpost.php?p=578001&postcount=24
    Is what my attachment looks like the way it works? Please clarify
     

    Attached Files:

  10. wingdnosring

    wingdnosring New Member

    Ratings:
    +16 / 0 / -0
    JASS:
    bool libwtps_gf_DetermineOpenTarget (unit lp_target, unit lp_attacker) {
        int autoC89B9D1B_as;
        int autoC89B9D1B_ae;
        int autoC89B9D1B_ai;
    
        // Variable Declarations
        int lv_loop;
        point lv_instantCheckPoint;
        fixed lv_angleOfAttack;
        fixed lv_height;
        fixed lv_distance;
        fixed lv_numberofRuns;
        unitgroup lv_potentialColGroup;
        unitgroup lv_potentialColRemovalGroup;
        fixed lv_targetHeight;
    
        // Variable Initialization
        lv_loop = 0;
        lv_instantCheckPoint = UnitGetPosition(lp_attacker);
        lv_angleOfAttack = AngleBetweenPoints(lv_instantCheckPoint, UnitGetPosition(lp_target));
        lv_height = (0.5 + (WorldHeight(c_heightMapGround, UnitGetPosition(lp_attacker)) + UnitGetHeight(lp_attacker)));
        lv_distance = DistanceBetweenPoints(UnitGetPosition(lp_target), lv_instantCheckPoint);
        lv_numberofRuns = (lv_distance / 1.5);
        lv_potentialColGroup = UnitGroupEmpty();
        lv_potentialColRemovalGroup = UnitGroupEmpty();
        lv_targetHeight = 0.0;
    
        // Implementation
        autoC89B9D1B_as = 1;
        autoC89B9D1B_ae = MaxI(FixedToInt((lv_distance / 1.5)), 1);
        autoC89B9D1B_ai = 1;
        lv_loop = autoC89B9D1B_as;
        if (autoC89B9D1B_ai > 0 || (autoC89B9D1B_ai == 0 && autoC89B9D1B_as < autoC89B9D1B_ae)) {
            while (lv_loop <= autoC89B9D1B_ae) {
                if ((lv_height > WorldHeight(c_heightMapGround, lv_instantCheckPoint))) {
                    lv_height=lv_height + (((WorldHeight(c_heightMapGround, UnitGetPosition(lp_attacker)) + UnitGetHeight(lp_attacker)) - (WorldHeight(c_heightMapGround, UnitGetPosition(lp_target)) + UnitGetHeight(lp_target))) / lv_numberofRuns);
                    lv_instantCheckPoint = PointWithOffsetPolar(lv_instantCheckPoint, 1.5, lv_angleOfAttack);
                    libNtve_gf_CreateActorAtPoint("GenericBloodSplatter3", libNtve_gf_PointWithZOffset(lv_instantCheckPoint, lv_height));
                    lv_potentialColGroup = UnitGroupAlliance(UnitGetOwner(lp_attacker), c_unitAllianceEnemy, RegionCircle(lv_instantCheckPoint, 3.0), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32)) | (1 << (c_targetFilterInvulnerable - 32))), 0);
                    libNtve_gf_AddUnitGroupToUnitGroup(UnitGroup(null, c_playerAny, RegionCircle(lv_instantCheckPoint, 3.0), UnitFilter((1 << c_targetFilterDestructible), 0, 0, 0), 0), lv_potentialColGroup);
                    if ((UnitGroupCount(lv_potentialColGroup, c_unitCountAlive) >= 1)) {
                        UnitGroupLoopBegin(lv_potentialColGroup);
                        while (!UnitGroupLoopDone()) {
                            if ((UnitHasBehavior(UnitGroupUnit(lv_potentialColGroup, lv_loop), "NullCoverBuff") == true)) {
                                lv_targetHeight = (UnitTypeGetProperty(UnitGetType(UnitGroupUnit(lv_potentialColGroup, lv_loop)), c_unitPropSuppliesUsed) / 20.0);
                            }
                            else {
                                lv_targetHeight = (UnitTypeGetProperty(UnitGetType(UnitGroupUnit(lv_potentialColGroup, lv_loop)), c_unitPropSuppliesUsed) / 10.0);
                            }
                            if (((UnitGroupUnit(lv_potentialColGroup, lv_loop) == null) || (DistanceBetweenPoints(lv_instantCheckPoint, UnitGetPosition(UnitGroupUnit(lv_potentialColGroup, lv_loop))) > (UnitTypeGetProperty(UnitGetType(UnitGroupUnit(lv_potentialColGroup, lv_loop)), c_unitPropRadius) * 2.0)) || (AbsF(((UnitGetHeight(UnitGroupUnit(lv_potentialColGroup, lv_loop)) + WorldHeight(c_heightMapGround, UnitGetPosition(UnitGroupUnit(lv_potentialColGroup, lv_loop)))) - lv_height)) > lv_targetHeight) || (lv_height < (UnitGetHeight(UnitGroupUnit(lv_potentialColGroup, lv_loop)) + WorldHeight(c_heightMapGround, UnitGetPosition(UnitGroupUnit(lv_potentialColGroup, lv_loop))))) || (UnitTestState(UnitGroupUnit(lv_potentialColGroup, lv_loop), c_unitStateIsDead) == true))) {
                            }
                            else {
                                if ((UnitTypeTestFlag(UnitGetType(UnitGroupUnit(lv_potentialColGroup, lv_loop)), c_unitFlagDestructible) == true)) {
                                    return false;
                                    return false;
                                }
                                else {
                                    return true;
                                    return false;
                                }
                            }
                            UnitGroupLoopStep();
                        }
                        UnitGroupLoopEnd();
                    }
                    else {
                    }
                    Wait(0.0, c_timeGame);
                }
                else {
                    return false;
                }
                lv_loop = lv_loop + autoC89B9D1B_ai;
            }
        }
        else if (autoC89B9D1B_ai < 0 || (autoC89B9D1B_ai == 0 && autoC89B9D1B_ae < autoC89B9D1B_as)) {
            while (lv_loop >= autoC89B9D1B_ae) {
                if ((lv_height > WorldHeight(c_heightMapGround, lv_instantCheckPoint))) {
                    lv_height=lv_height + (((WorldHeight(c_heightMapGround, UnitGetPosition(lp_attacker)) + UnitGetHeight(lp_attacker)) - (WorldHeight(c_heightMapGround, UnitGetPosition(lp_target)) + UnitGetHeight(lp_target))) / lv_numberofRuns);
                    lv_instantCheckPoint = PointWithOffsetPolar(lv_instantCheckPoint, 1.5, lv_angleOfAttack);
                    libNtve_gf_CreateActorAtPoint("GenericBloodSplatter3", libNtve_gf_PointWithZOffset(lv_instantCheckPoint, lv_height));
                    lv_potentialColGroup = UnitGroupAlliance(UnitGetOwner(lp_attacker), c_unitAllianceEnemy, RegionCircle(lv_instantCheckPoint, 3.0), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32)) | (1 << (c_targetFilterInvulnerable - 32))), 0);
                    libNtve_gf_AddUnitGroupToUnitGroup(UnitGroup(null, c_playerAny, RegionCircle(lv_instantCheckPoint, 3.0), UnitFilter((1 << c_targetFilterDestructible), 0, 0, 0), 0), lv_potentialColGroup);
                    if ((UnitGroupCount(lv_potentialColGroup, c_unitCountAlive) >= 1)) {
                        UnitGroupLoopBegin(lv_potentialColGroup);
                        while (!UnitGroupLoopDone()) {
                            if ((UnitHasBehavior(UnitGroupUnit(lv_potentialColGroup, lv_loop), "NullCoverBuff") == true)) {
                                lv_targetHeight = (UnitTypeGetProperty(UnitGetType(UnitGroupUnit(lv_potentialColGroup, lv_loop)), c_unitPropSuppliesUsed) / 20.0);
                            }
                            else {
                                lv_targetHeight = (UnitTypeGetProperty(UnitGetType(UnitGroupUnit(lv_potentialColGroup, lv_loop)), c_unitPropSuppliesUsed) / 10.0);
                            }
                            if (((UnitGroupUnit(lv_potentialColGroup, lv_loop) == null) || (DistanceBetweenPoints(lv_instantCheckPoint, UnitGetPosition(UnitGroupUnit(lv_potentialColGroup, lv_loop))) > (UnitTypeGetProperty(UnitGetType(UnitGroupUnit(lv_potentialColGroup, lv_loop)), c_unitPropRadius) * 2.0)) || (AbsF(((UnitGetHeight(UnitGroupUnit(lv_potentialColGroup, lv_loop)) + WorldHeight(c_heightMapGround, UnitGetPosition(UnitGroupUnit(lv_potentialColGroup, lv_loop)))) - lv_height)) > lv_targetHeight) || (lv_height < (UnitGetHeight(UnitGroupUnit(lv_potentialColGroup, lv_loop)) + WorldHeight(c_heightMapGround, UnitGetPosition(UnitGroupUnit(lv_potentialColGroup, lv_loop))))) || (UnitTestState(UnitGroupUnit(lv_potentialColGroup, lv_loop), c_unitStateIsDead) == true))) {
                            }
                            else {
                                if ((UnitTypeTestFlag(UnitGetType(UnitGroupUnit(lv_potentialColGroup, lv_loop)), c_unitFlagDestructible) == true)) {
                                    return false;
                                    return false;
                                }
                                else {
                                    return true;
                                    return false;
                                }
                            }
                            UnitGroupLoopStep();
                        }
                        UnitGroupLoopEnd();
                    }
                    else {
                    }
                    Wait(0.0, c_timeGame);
                }
                else {
                    return false;
                }
                lv_loop = lv_loop + autoC89B9D1B_ai;
            }
        }
        return false;
    }


    What a mess. That's the function "Determine Open Target" I'm actually part way through simplifying the collision detection within it as we speak. I assume that's the function you wanted me to compile and post? Or did you mean the huge trigger I posted on the last page?

    That image is close to my bullet variation. I create the missile unit, then order it to a point x distance away at the facing angle of the unit + a random real from negative bullet variation to positive bullet variation. Then I alter its height to match the camera pitch over 5 seconds + another random real from negative bullet variation to positive bullet variation. It actually forms squares/rectangles rather than circles, but you can't tell in game since, you'd only see that if you got a max or min value in conjunction with another max or min value.

    "Bullet Variation" is determined by the value put into the "Create Weapon" function by the user. Obviously some other factors apply. Enemies have higher or lower variation depending on the "Set Enemy Accuracy" function and allies always fire with 80% optimum accuracy. The user's variation is altered depending on recoil, hipfire vs aiming, and the base bullet variation value.
     
  11. SerraAvenger

    SerraAvenger Cuz I can

    Ratings:
    +236 / 0 / -0
    kinda = )
    I believe your problem lies here though:

    JASS:
    UnitGroupLoopBegin(lv_potentialColGroup);

    Could you please compile the other thing, too? Might it be that you're using nested UnitGroupLoops?
    That's a good thing to do!

    gtg2bed now, hardly slept this day... I'll answer b4 friday for sure.
    Best wishes,
    David
     
  12. wingdnosring

    wingdnosring New Member

    Ratings:
    +16 / 0 / -0
    Thanks. It seems like I've rewritten each large trigger about ten times over already, yet every time, I find more areas to cut down on. Custom Actions/Functions are life savers.

    Alright, here's the compiled trigger. Beware...it's long...this is a trigger I plan on cutting down a ton once I'm sure its working.

    JASS:
    //--------------------------------------------------------------------------------------------------
    // Trigger: Set Enemy State
    //--------------------------------------------------------------------------------------------------
    bool libwtps_gt_SetEnemyState_Func (bool testConds, bool runActions) {
        int auto39F37D32_as;
        int auto39F37D32_ae;
        int auto39F37D32_ai;
        int autoC3DF3D1D_as;
        int autoC3DF3D1D_ae;
        int autoC3DF3D1D_ai;
    
        // Variable Declarations
        unitgroup lv_closeEnemyGroup;
        unitgroup lv_potentialTargetsGroup;
        int lv_groupLoop;
        bool lv_foundTarget;
    
        // Variable Initialization
        lv_closeEnemyGroup = UnitGroupEmpty();
        lv_potentialTargetsGroup = UnitGroupEmpty();
        lv_groupLoop = 0;
        lv_foundTarget = false;
    
        // Actions
        if (!runActions) {
            return true;
        }
    
        UnitGroupClear(lv_closeEnemyGroup);
        UnitGroupLoopBegin(UnitGroup("Marine2", c_playerAny, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
        while (!UnitGroupLoopDone()) {
            libNtve_gf_AddUnitGroupToUnitGroup(UnitGroupAlliance(UnitGetOwner(UnitGroupLoopCurrent()), c_unitAllianceEnemy, RegionCircle(UnitGetPosition(UnitGroupLoopCurrent()), 15.0), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0), lv_closeEnemyGroup);
            UnitGroupLoopStep();
        }
        UnitGroupLoopEnd();
        UnitGroupLoopBegin(lv_closeEnemyGroup);
        while (!UnitGroupLoopDone()) {
            if ((UnitGroupHasUnit(libwtps_gv_searchingForCoverGroup, UnitGroupLoopCurrent()) != true)) {
                if ((UnitHasBehavior(UnitGroupLoopCurrent(), "NullCoverBuff") != true) && (UnitHasBehavior(UnitGroupLoopCurrent(), "NullCoverBuff2") != true)) {
                }
                else {
                }
                if ((UnitHasBehavior(UnitGroupLoopCurrent(), "NullCoverBuff") == true)) {
                    lv_foundTarget = false;
                    lv_potentialTargetsGroup = UnitGroupAlliance(UnitGetOwner(UnitGroupLoopCurrent()), c_unitAllianceEnemy, RegionCircle(UnitGetPosition(UnitGroupLoopCurrent()), 15.0), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32)) | (1 << (c_targetFilterInvulnerable - 32))), 0);
                    autoC3DF3D1D_as = 1;
                    autoC3DF3D1D_ae = UnitGroupCount(lv_potentialTargetsGroup, c_unitCountAlive);
                    autoC3DF3D1D_ai = 1;
                    lv_groupLoop = autoC3DF3D1D_as;
                    if (autoC3DF3D1D_ai > 0 || (autoC3DF3D1D_ai == 0 && autoC3DF3D1D_as < autoC3DF3D1D_ae)) {
                        while (lv_groupLoop <= autoC3DF3D1D_ae) {
                            if ((libwtps_gf_DetermineOpenTarget(UnitGroupUnit(lv_potentialTargetsGroup, lv_groupLoop), UnitGroupLoopCurrent()) == true)) {
                                UnitBehaviorRemove(UnitGroupLoopCurrent(), "NullCoverBuff", 1);
                                UnitBehaviorAddPlayer(UnitGroupLoopCurrent(), "NullCoverBuff2", UnitGetOwner(UnitGroupLoopCurrent()), 1);
                                UnitAbilityEnable(UnitGroupLoopCurrent(), "attack", true);
                                UnitIssueOrder(UnitGroupLoopCurrent(), OrderTargetingUnit(AbilityCommand("attack", 0), UnitGroupUnit(lv_potentialTargetsGroup, lv_groupLoop)), c_orderQueueReplace);
                                libNtve_gf_UIErrorMessage(PlayerGroupAll(), StringExternal("Param/Value/lib_wtps_B535D469"), SoundLink("Marine_DeathFXSilentKill", -1));
                                lv_foundTarget = true;
                                break;
                            }
                            else {
                            }
                            lv_groupLoop = lv_groupLoop + autoC3DF3D1D_ai;
                        }
                    }
                    else if (autoC3DF3D1D_ai < 0 || (autoC3DF3D1D_ai == 0 && autoC3DF3D1D_ae < autoC3DF3D1D_as)) {
                        while (lv_groupLoop >= autoC3DF3D1D_ae) {
                            if ((libwtps_gf_DetermineOpenTarget(UnitGroupUnit(lv_potentialTargetsGroup, lv_groupLoop), UnitGroupLoopCurrent()) == true)) {
                                UnitBehaviorRemove(UnitGroupLoopCurrent(), "NullCoverBuff", 1);
                                UnitBehaviorAddPlayer(UnitGroupLoopCurrent(), "NullCoverBuff2", UnitGetOwner(UnitGroupLoopCurrent()), 1);
                                UnitAbilityEnable(UnitGroupLoopCurrent(), "attack", true);
                                UnitIssueOrder(UnitGroupLoopCurrent(), OrderTargetingUnit(AbilityCommand("attack", 0), UnitGroupUnit(lv_potentialTargetsGroup, lv_groupLoop)), c_orderQueueReplace);
                                libNtve_gf_UIErrorMessage(PlayerGroupAll(), StringExternal("Param/Value/lib_wtps_B535D469"), SoundLink("Marine_DeathFXSilentKill", -1));
                                lv_foundTarget = true;
                                break;
                            }
                            else {
                            }
                            lv_groupLoop = lv_groupLoop + autoC3DF3D1D_ai;
                        }
                    }
                    if ((lv_foundTarget == false)) {
                        if ((RandomInt(0, 100) <= 30)) {
                            UnitBehaviorRemove(UnitGroupLoopCurrent(), "NullCoverBuff", 1);
                            UnitBehaviorAddPlayer(UnitGroupLoopCurrent(), "NullCoverBuff2", UnitGetOwner(UnitGroupLoopCurrent()), 1);
                            UnitAbilityEnable(UnitGroupLoopCurrent(), "attack", true);
                            libNtve_gf_UIErrorMessage(PlayerGroupAll(), StringExternal("Param/Value/lib_wtps_E4B542BB"), SoundLink("Marine_DeathFXSilentKill", -1));
                        }
                        else {
                            if ((RandomInt(0, 100) <= 30)) {
                                UnitBehaviorRemove(UnitGroupLoopCurrent(), "NullCoverBuff", 1);
                                UnitAbilityEnable(UnitGroupLoopCurrent(), "attack", true);
                                libNtve_gf_UIErrorMessage(PlayerGroupAll(), StringExternal("Param/Value/lib_wtps_AD33F6A1"), SoundLink("Marine_DeathFXSilentKill", -1));
                            }
                            else {
                                UnitSetFacing(UnitGroupLoopCurrent(), (AngleBetweenPoints(UnitGetPosition(UnitGroupLoopCurrent()), UnitGetPosition(libNtve_gf_ClosestUnitToPoint(UnitGetPosition(UnitGroupLoopCurrent()), UnitGroup("BraxisAlphaDestructible1x12", c_playerAny, RegionCircle(UnitGetPosition(UnitGroupLoopCurrent()), 4.0), UnitFilter((1 << c_targetFilterDestructible), 0, 0, 0), 0)))) + 180.0), 0.0);
                                libNtve_gf_UIErrorMessage(PlayerGroupAll(), StringExternal("Param/Value/lib_wtps_D5D3DEE6"), SoundLink("Marine_DeathFXSilentKill", -1));
                            }
                        }
                    }
                    else {
                    }
                }
                else {
                    if ((UnitHasBehavior(UnitGroupLoopCurrent(), "NullCoverBuff2") == true)) {
                        lv_foundTarget = false;
                        lv_potentialTargetsGroup = UnitGroupAlliance(UnitGetOwner(UnitGroupLoopCurrent()), c_unitAllianceEnemy, RegionCircle(UnitGetPosition(UnitGroupLoopCurrent()), 15.0), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32)) | (1 << (c_targetFilterInvulnerable - 32))), 0);
                        auto39F37D32_as = 1;
                        auto39F37D32_ae = UnitGroupCount(lv_potentialTargetsGroup, c_unitCountAlive);
                        auto39F37D32_ai = 1;
                        lv_groupLoop = auto39F37D32_as;
                        if (auto39F37D32_ai > 0 || (auto39F37D32_ai == 0 && auto39F37D32_as < auto39F37D32_ae)) {
                            while (lv_groupLoop <= auto39F37D32_ae) {
                                if ((libwtps_gf_DetermineOpenTarget(UnitGroupUnit(lv_potentialTargetsGroup, lv_groupLoop), UnitGroupLoopCurrent()) == true)) {
                                    UnitIssueOrder(UnitGroupLoopCurrent(), OrderTargetingUnit(AbilityCommand("attack", 0), UnitGroupUnit(lv_potentialTargetsGroup, lv_groupLoop)), c_orderQueueReplace);
                                    libNtve_gf_UIErrorMessage(PlayerGroupAll(), StringExternal("Param/Value/lib_wtps_01FD0118"), SoundLink("Marine_DeathFXSilentKill", -1));
                                    lv_foundTarget = true;
                                    break;
                                }
                                else {
                                }
                                lv_groupLoop = lv_groupLoop + auto39F37D32_ai;
                            }
                        }
                        else if (auto39F37D32_ai < 0 || (auto39F37D32_ai == 0 && auto39F37D32_ae < auto39F37D32_as)) {
                            while (lv_groupLoop >= auto39F37D32_ae) {
                                if ((libwtps_gf_DetermineOpenTarget(UnitGroupUnit(lv_potentialTargetsGroup, lv_groupLoop), UnitGroupLoopCurrent()) == true)) {
                                    UnitIssueOrder(UnitGroupLoopCurrent(), OrderTargetingUnit(AbilityCommand("attack", 0), UnitGroupUnit(lv_potentialTargetsGroup, lv_groupLoop)), c_orderQueueReplace);
                                    libNtve_gf_UIErrorMessage(PlayerGroupAll(), StringExternal("Param/Value/lib_wtps_01FD0118"), SoundLink("Marine_DeathFXSilentKill", -1));
                                    lv_foundTarget = true;
                                    break;
                                }
                                else {
                                }
                                lv_groupLoop = lv_groupLoop + auto39F37D32_ai;
                            }
                        }
                        if ((lv_foundTarget == false)) {
                            if ((RandomInt(0, 100) <= 80)) {
                                UnitBehaviorRemove(UnitGroupLoopCurrent(), "NullCoverBuff2", 1);
                                UnitBehaviorAddPlayer(UnitGroupLoopCurrent(), "NullCoverBuff", UnitGetOwner(UnitGroupLoopCurrent()), 1);
                                UnitAbilityEnable(UnitGroupLoopCurrent(), "attack", false);
                                libNtve_gf_UIErrorMessage(PlayerGroupAll(), StringExternal("Param/Value/lib_wtps_726790D8"), SoundLink("Marine_DeathFXSilentKill", -1));
                            }
                            else {
                                if ((RandomInt(0, 100) <= 10)) {
                                    UnitBehaviorRemove(UnitGroupLoopCurrent(), "NullCoverBuff2", 1);
                                    libNtve_gf_UIErrorMessage(PlayerGroupAll(), StringExternal("Param/Value/lib_wtps_35167E23"), SoundLink("Marine_DeathFXSilentKill", -1));
                                }
                                else {
                                }
                            }
                        }
                        else {
                        }
                    }
                    else {
                    }
                }
            }
            else {
            }
            UnitGroupLoopStep();
        }
        UnitGroupLoopEnd();
        TimerStart(libwtps_gv_aIStateTimer, RandomFixed(2.0, 10.0), false, c_timeGame);
        return true;
    }
     
  13. SerraAvenger

    SerraAvenger Cuz I can

    Ratings:
    +236 / 0 / -0
    it's quite obvious, isn't it?
    you're having a nested loop!
     
  14. wingdnosring

    wingdnosring New Member

    Ratings:
    +16 / 0 / -0
    So I can't use loops in custom functions? I'm not entirely sure what you mean by nested loop.
     
  15. SerraAvenger

    SerraAvenger Cuz I can

    Ratings:
    +236 / 0 / -0
    JASS:
    bool libwtps_gt_SetEnemyState_Func (bool testConds, bool runActions) {
        //...
        UnitGroupLoopBegin(lv_closeEnemyGroup);
        while (!UnitGroupLoopDone()) {
            //...
            if ((libwtps_gf_DetermineOpenTarget(UnitGroupUnit(lv_potentialTargetsGroup, lv_groupLoop), UnitGroupLoopCurrent()) == true)) {
                //...
            }
            UnitGroupLoopStep();
        }
        UnitGroupLoopEnd();
        //...
    }


    The DetermineOpenTarget function uses a unitgrouploop, too.
    That means you have something like this:
    JASS:
    
    UnitGroupLoop {
        UnitGroupLoop{
        }
    }

    This is not allowed. You should use for group loops only.
     
  16. wingdnosring

    wingdnosring New Member

    Ratings:
    +16 / 0 / -0
    Ahh thanks. I got it now. I was wondering about that, but I thought that if it ran in a seperate trigger/function it would be okay. Dunno why I thought that..but I did...

    [Edit]: What about the recoil ring? Any thoughts on that?

    [Edit 2]: I remember way back in this thread you(Serra Avenger) mentioned making a custom function for weapons that would be layed out like set (Attribute) for (Weapon). How would I go about creating something like that? I mean, the attribute could be an integer and I simply use comments to tell users what number is for what value, but that kinda sucks. I could also make about two dozen different actions, one for each attribute, but that seems cluttered and unnecessary. Is there a way to create my own presets and set them to an integer within the function itself?
     
  17. wingdnosring

    wingdnosring New Member

    Ratings:
    +16 / 0 / -0
    I believe version 7 is ready to go if I can get an answer to the questions above.
     
  18. SerraAvenger

    SerraAvenger Cuz I can

    Ratings:
    +236 / 0 / -0
    Recoil ring?

    Using constants (or presets in the SC2 GUI) is what you'd usually do. And no. it doesn't suck.
    Depends. I'd quite much go this way unless all attributes have the same type. (At least in galaxy/SC2 GUI). In golang, i'd just create an interface Attribute and use that interface instead of types. Or, ofc the empty interface{}.


    Yes. Click on "New Preset", select int as the preset type, and add your values.
     
  19. wingdnosring

    wingdnosring New Member

    Ratings:
    +16 / 0 / -0
    Sorry, I should have specified. I meant the accuracy quesiton I posted earlier. Would it work better if I made it favor the outside? It's more a matter of opinion than a technical question adn I haven't been able to decide, myself.

    If I could get the presets to work it'd rock. What I meant when I said it sucked was simply making it "type 1 into this parameter for this. Type 2 for this other thing."

    I have an incredibly long list of weapon options though, which keeps getting longer as time goes on. The majority of them are integers or reals, but there are quite a few other variable types too.

    Thanks, I'd never noticed that button before. I kept looking in the variables within my actions/functions, but I only ever saw Add, Remove, or Modify.

    Version 7 is being uploaded now.

    [Edit]: Wow, Version 7 nearly reaches the 1 MB limit on this site. Guess I'll have to upload elsewhere form now on and just provide a link...what's a good place to upload something like this? That SC2Mapster site?
     
  20. SerraAvenger

    SerraAvenger Cuz I can

    Ratings:
    +236 / 0 / -0
    This is why you can use constants.
    Just look at ncurses for a fine example.

    >Recoil Ring
    Make it a game option? Look at the game and, unless there's some reason to keep both, remove one of them after some time.

    >1MB
    1MB.
    Wait, what?
    You know that the Ntve library has only 6 MB?
    Don't tell me your library allready has one sixth of the size of the Native Library oO
    How about 7zing it?
    SC2Mapster is a nice community, and I have to thank them for putting me on the front page some time ago, so you might as well put it up there and lead some common interest to that site.
     

Share This Page