• 0

    posted a message on Cutting down the for-loops
    Quote from s3rius: Go

    Sure, it adds comparisions, but integer comparisions are damn quick. Good performance and the script size will stay small.

    Yep, you're right about that. Can you explain to me why the blizzard developer(s) implemented it so stupidly then? :-O

    The only "advantage" would be that the ai > 0 / ai <0 is only checked once ... but that can't be the reason ;P

    Posted in: Triggers
  • 0

    posted a message on Campaign's Hyperion is a "Map" ?!

    Hey, I'm wondering... is the hyperion of the campaigns, the place where you can go to the arsenal, bridge, watch tv, listen to the juke box,... made in the normal editor? If yes, are we able to open it in the editor and where do I find it? I looked around it now that I know the editor better and didn't find anything obvious which couldn't be done with it (ofc that doesn't mean that I would be able to create sth like that :D ). And of course it would require a lot of custom models, flash movies, etc.

    But there are some nice little things which would be nice to know how to do. I especially got curious about the research console, the buttons, highliting, movies, images and all stuff you find there. Did I miss the dialog actions to do that stuff?

    just curious, Rushhour ;)

    Posted in: Miscellaneous Development
  • 0

    posted a message on Cutting down the for-loops

    With efficiency I don't mean the execution speed but the amount of code created. Since we are pretty restricted ( I think it was around 2MB) on code and variable memory this will be important for big projects. Reference thread

    Of course you are right: when you only use one function inside the loop and this function contains XY subfunctions, then we won't have that much code generated like when all subfunctions were directly in the forloop. Also this was to show what can be done with custom actions, because I think not too many people know about this yet. It will be pretty easy to create kind of a for (x,y,) loop with this, and this is the loop I used the most up to now, in my map.

    Posted in: Triggers
  • 0

    posted a message on Cutting down the for-loops

    It is (or should be) common knowledge that the current implementation of for-loops of the editor is pretty... ineffective, especially for loops with many actions and/or nested loops.

    The original for-loops have this in their custom script:

    #AUTOVAR(as) = #PARAM(s);
    #AUTOVAR(ae) = #PARAM(e);
    #AUTOVAR(ai) = #PARAM(increment);
    #PARAM(var) = #AUTOVAR(as);
    if (#AUTOVAR(ai) > 0 || (#AUTOVAR(ai) == 0 && #AUTOVAR(as) < #AUTOVAR(ae))) {
        while (#PARAM(var) <= #AUTOVAR(ae)) {
            #SUBFUNCS(actions)
            #PARAM(var) = #PARAM(var) + #AUTOVAR(ai);
        }
    }
    else if (#AUTOVAR(ai) < 0 || (#AUTOVAR(ai) == 0 && #AUTOVAR(ae) < #AUTOVAR(as))) {
        while (#PARAM(var) >= #AUTOVAR(ae)) {
            #SUBFUNCS(actions)
            #PARAM(var) = #PARAM(var) + #AUTOVAR(ai);
        }
    }
    

    As you see, the subfunctions get implemented twice! If you nest 3 for loops that would mean that the most inner loop actions actually have 8 copies of themself in the map code. The reason why they made this is to make this foolproof... but that results in too much code for simple for loops like: ForEachInteger(int,1,10,1) ... To get simple efficient for loops which simply count up you can do the following:

    Create a new action named something like "ForEachIntegerUp", click on Options and check "loop" and "subfunctions". Copy the parameters of the ForEachInteger function. Create an actions subfunctions and name it "actions" . Copy the following in the custom script section:

    #AUTOVAR(ae) = #PARAM(e);
    #AUTOVAR(ai) = #PARAM(increment);
    #PARAM(var) = #PARAM(s);
    if (#PARAM(increment) > 0) { // If you know that you will only pass increment values greater than zero you can remove this and the bracket at the end
        while (#PARAM(var) <= #AUTOVAR(ae)) {
            #SUBFUNCS(actions)
            #PARAM(var) = #PARAM(var) + #AUTOVAR(ai);
        }
    } //<-
    

    42 Posts!! (sorry 'bout that :) )

    Posted in: Triggers
  • 0

    posted a message on Terrain Objects Glitch

    Hey, I tried to answer you in the us.battle.net, but as I am from europe I have no possiblity to write anything there. I see you bumb the thread often so answering this old thread won't be too wrong.

    I had a similiar problem with terrain objects... god and blizzard developers may know, but somehow I suddenly had over 5000 of the same terrain object on the exact same spot. So huge laags in the editor and ingame followed, I couldn't even open the terrain module anymore. I tried to modify the actual game data, the terrain.xml file and delte those 5000 lines. But this resulted only in an error.

    I think that moving and doing anything with terrain objects is really bugged, I will not use them anymore from now Then I looked at the fields in the data module under Terrain object. I thought "what if I change the radius from 0 to 1, maybe they get removed because then they will need some space between them." -> weird, but it worked! I also delted the model filepath of the terrain object, but I am not sure if that had any extra positive effect.

    So then I only had one terrain object which could be delted easily: Switching to terrain brush list inside the terrain editor. Selecting Terrain objects (the very right box, but not sure if that's necessary). Pressing SPACEBAR to delte the current selection if any exists. Dragging a box around where my terrain object was, pressing delete: HAPPINESS.

    Try it, there is nothing to lose ;) good luck

    Posted in: Galaxy Editor Bugs and Feedback
  • 0

    posted a message on Difficult Terrain Objects

    I also had a problem with terrain objects and the above ways didn't work.

    I placed 2 trenches in my map (in earlier stages to try it) and didn't remove them immediately. Later when trying to delete them I realized that the editor and game gets VERY laagy when the camera gets close to the position where I placed those 2 trenches... this got so worse I couldn't even open the terrain module anymore.

    Then I looked in the xml terrain file and saw that my two trenches actually became 2508 trenches!!!! That was the explanation why it got so buggy, but I don't know how they made themselves become more (was it a daddy and a mommy trench?)

    Anyways: I couldn't delete them in the xml file since the editor always told me the map file is corrupted. Then I played around in the Data Module in the field TerrainObject and deleted the model and set the radius from 0 to 1. Suddenly I could open the terrain editor and these stupid objects seem to be gone. There was only one left which I could delete without any problems.

    I had over 2000 of the following lines: <cliffDoodad name="TerrainObjectTrenchDiagonal1" pos="51.000000 153.000000 0.000000 " rot="0"/> all at the same position.... man, I can only repeat the first two words: STAY AWAY FROM TERRAINOBJECTS AND DON'T USE THEM!

    Posted in: Galaxy Editor Bugs and Feedback
  • 0

    posted a message on $10,000 if you find how to fix that

    First of all: nice titel, you know how to attact attention :D

    Then: Try to put in some Wait ( 0 seconds), this often is a wonderful debugging tool ;)

    One right after setting the variable ObliterateZone to the random value, then: right after you created your purifier(s). I could imagine that the game needs longer to load and create the unit the first time since all values have to be loaded into memory.

    And yes, it would be better to save the purifier unit in a local unit variable, I heard that LastCreated functions are local to triggers now, but it's simply better, then you know what unit it is when looking at the variable name ;) So:

    Create Purifier at... Set LittlePuri = LastCreatedUnit Wait 0 seconds Move Purifier to center of region Red/Green

    And one more idea: Save the to points (Center of Red and center of green) in an global point array variable. Do that at map initialization and use index=1 for red and index=2 for green. And then simply do: Create Purifier at center of TheSpawnLocs[ObliterateZone]

    Posted in: Triggers
  • 0

    posted a message on Dialog item "glow"

    Hey, I would like to know if anyone of you has an idea how I could easily hightlight an dialog button item. In my head, I see some white glow that is around the button (the button is an image, all buttons are of the same size) which gets brighter the higher the level is.

    My problems are that setting color on disabled items doesn't work and only setting transparency isn't really what I want.

    I had an idea to create an image at the same position as every item, set its render priority lower and fade its transparency... but I still would need an nice picture and I guess this would require even more work..

    Any more ideas? ;)

    Posted in: Data
  • 0

    posted a message on How to make models attached to an air unit also have the slight bobbing up and down?

    I guess that the "bobbing up" is the model's stand animation?! If yes, than you should propably make the model use its stand animation. Look at a random unit-actor. It opens some animation bracket which handles the effects of the unit from creation, over its life up to its death.

    Posted in: Data
  • 0

    posted a message on Trigger Runtime

    Allright then; the following is valid for WC3, not yet tested if SC2 uses a similiar system!

    The number of executions of a loop can be calculated with following formula: n(x)= (300,000 / (2x+1) ) with n being the number of executions and x being what I call "ops". That would mean that an empty loop in an own thread will be executed 300,000 times until it breaks down. This can't be proved since inputting a counting variable will influence the result.

    My testing function looked like this:

    function OPTest takes nothing returns nothing
    loop
        set TestI=TestI+1
        //basic setting
    endloop
    endfunction
    
    function Trig_Test_Actions takes nothing returns nothing
    set TestI=0
    call OPTest.execute()
    call BJDebugMsg(I2S(TestI))
    endfunction
    

    That's the basic setting. This would return a value of 42857. Seems pretty random, but it follows some logic. When looking at the formula this would be the rounded outcome for x=3. I did various tests and discovered following things: set TestI=TestI+1 increases x (the "ops") by 3. one for referencing the variable TestI, one for using an calculation operator (+) and one for referencing the number 1.

    When I try the following: set TestI=TestI+1 set someInt=someInt+8436 I get 23077 as a result. Again, this is the rounded outcome for x=6, again the same explanation: Two variable or number references and the +.

    When using: set TestI=TestI+1 set someInt=someInt set someInt=someInt set otherInt=otherInt I get the same result as above, again 6 ops referenced!

    Ok thats the basics. When you want to know how many times your loop will get executed you need to simply count all these things, but there are more things to keep in mind: A native function reference itself adds 0,5. If it has a parameter and you use some variable or value you will need to add 1 for this. If you do some math like "var + 5" in the parameter, you will need to add 3. If you use an own function you will need to add 1 for the function itself. Same like for natives is valid for the parameters, but: You will need to count the stuff done inside the function as if it was in the loop. A completly empty if-then-else would add 0,5 (but noone ever has this), so you need to add 1,5 for an if-then-else which has something in it. And: Only the code reached by the loop will count! If the outcome is random then you would need to guess or add the highest possibility to your x. If there is a loop inside your loop, you will need to count all stuff that is done inside of your nested loop like you did before and then multiply it with the number of executions for the inner loop.

    So having a lot of if - then -elses, inner loops that have different number of executions makes it really hard to get the actual number of maximum executions of your loop. But as a general note you could remember that instead of calculationg myVar+CONST 4 times, it would be better to save it in another variable. Or it would be better to use natives instead of own functions.

    I did this for a PathExists function which then worked pretty fast but which still needs some Waits after XY executions to make sure it doesn't suddenly stop. ;)

    Let's see if I explained clearly :D, how often will the following code be executed?

    loop 
           call UnitRemove(theBoss)
           set BossesRemoved=BossesRemoved+1
           if BossesRemoved > (IAmPositive+BossesRemoved) then
                  set easyMath=1+2
           else
                 set difficultMath=SquareRoot(4)
           endif
    endloop
    
    Posted in: Galaxy Scripting
  • 0

    posted a message on Requesting a feature..

    I don't know if its only me, but I REALLY need to have a way to use constant int variables as array sizes in the GUI. I know that this is possible in the script, but when I create my variables in some custom script section, I am not able to reference them from the GUI variable list and would then be forced to write everything in script.

    I have many arrays that use for example their first index to reference the player. Some have three indexes/dimensions where the first one is the player, the second one the Id, the third one the section,...! I am now forced to write dozen of comments to make sure I remember which index represents which constant. AND: the idea behind constants and variables - that you simply need to change it at one point and have it changed anywhere else - is completly lost! This is simply stupid and doesn't look very nice.

    As I play on the european severs I can't write that in the us.battle.net thread which seems to be read and answered frequently in constrant to our thread :D So could someone who thinks this would be a nice feature please post it there? Thanks!

    Posted in: Galaxy Editor Bugs and Feedback
  • 0

    posted a message on Trigger Runtime

    Do you know that there exists point functions that should (at least when reading their names, haven't used them yet) return things you may need.

    I'm not sure about the function name right now, but this one function returns the "pathingcost" (?) between two points. So have a try if this is the distance between the two points or some value which can be used as the distance. It's the same problem like we had in WC3 scripting, after several iterations you simply exceed the operation limit and you would need to use a wait.

    I did some testing on the operation limit in WC3 and found a formula where you could simply calculate how often a loop will be executed in its own thread until the game breaks it down. As a basic you can say that more function calls, variable references and operations (like +-*/ && ||) drastically decrease the limit. Will post more details later if someone wants to know this. :D

    Posted in: Galaxy Scripting
  • 0

    posted a message on Wait for condition make my local triggers bug ?

    Just like he said: Use one dialog for each player. You can do really anything concerning a dialog or dialog controls for a single player. (Maybe you need to sometimes convert a singleplayer to a player group)

    I currently don't have the time to go through your complete trigger, but you should remember that turning a trigger off only diables the events registered to it, instances currently running will finish running or creating new instances directly will work anyways.

    Posted in: Triggers
  • 0

    posted a message on while loop

    And: You should reset Y to 0 after the second loop is done ;) But one row should appear anyways. Is the burrowed unit visible, check that too.

    Posted in: Triggers
  • 0

    posted a message on Behavior Tooltip Reference

    Yep, it is possible. So, first of all: Find a button that uses some reference to any ability or effect. (since I don't know the exact way of doing it by hearth) :P Second: Enable the field, which ask you to show more details of the tooltip (something like <d ref="Abil,MyAbility,... "/> will appear around the references. Third: Edit the "Abil" to "Behavior" if you want to reference a behavior. Edit: "MyAbility" to the id of your behavior (select "view raw data" when having your behavior selected to see it) Edit: what follows after the "MyAbility," to whatever field you need to reference.

    To find the name of the field, you should enable the table view in the data editor and enable "view raw data". For simple fields like Duration, you usually only need to type "Duration". For others, read this thread on how the names are built up: http://www.sc2mapster.com/forums/resources/tutorials/1250-triggers-catalog-field-value-get-set/

    You can even do basic arithmetics in the tooltip references. For example when you need to show a percentage and the field value is only ranged from 0 to 1, you can use <d ref="Eff,MyEff,Chance *100"/>

    If something is unclear or you can't figure sth out, I will have a look at the editor in some hours ;)

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