• 0

    posted a message on Library: Improved GetResolution

    I just added some documentation stuff and wrote you a pm. Hope it helps. If there is anything else or you find a bug just ask. ;) And there is a new version avalible with a better describitons and with a minor bugfix.

    Posted in: Triggers
  • 0

    posted a message on Library: Improved GetResolution

    Nah, that was a stupid bug. I just changed some varnames. That was about it. I just uploaded a version with the Hotfix. I got this Library working on a (currenty) single playermap with no more issues.

    The compiling error was because i forgot to write that after importing you have to change the library ID to 0E15B1AE. Hope everything works now.

    Posted in: Triggers
  • 0

    posted a message on Library: Improved GetResolution

    Hey there, i just updated the Library. I hope there are not so much bugs anymore. Would be really cool to get some feedback again ;).

    Thanks Taldeen

    Posted in: Triggers
  • 0

    posted a message on Library: Improved GetResolution

    The scale is being calculated by getting the vertical mouse position and creating a dialog at the same time with lots 1px rows. With two events i get the mouse position and the "entered" dialogitem. Since there is an delay between these two events its important to make sure the Player didn't move the mouse in between. Then i get the Y-Offset of the dialog Item and divide it by the mouse position. Thats it for the scale.

    Getting the maximal X and Y screen sizes works similar to desiderius1 library. Therefore I set the coursor to the middle of the screen using the build in action by blizzard. Then i get the mouse position again by showing these dialogs and getting the X and Y offsets and multiply them by 2.

    The last thing i do i checking if the resolution is relativly close to a standart resolution. If it's close to a standart resolution, i assume it's the players resolution and then set the scale to an exact value.

    EDIT:@Kueken531: I figuerd out all the errors, currently working on fixing them, because of your feedback I had quite a nice idea which allows getting the resolution even faster.

    Posted in: Triggers
  • 0

    posted a message on Library: Improved GetResolution
    Quote from Kueken531: Go

    It detects my 1280x1024 as 1280x960 from time to time(precise and fast).

    Hmm i quess there is something wrong with finding the best fitting standard Screensize. I tried to reproduce the Problem but i can't. Could you post the Results of the "calculated" value when it was detecting 1280x960 instead of 1280x1024?

    Quote from Kueken531: Go

    Also, if I move the mouse rapidly while calculating, I got results like 462x363 or 89x63 (precise).

    Hmm, thats wierd what does the scale say? A screenshot(if possible) would be even better.

    Quote from Kueken531: Go

    The mouse disappears while determining, and if I don't move the mouse, I don't get any result at all.

    Do you use the Testmap, or have you imported the library? Does the error still occur when you change the mouse position before detecting?

    Quote from Kueken531: Go

    Also, from time to time, I got: 00:04:22.94 Trigger Error in 'lib0E15B1AE_gt_GetMousePos_Func': Divide by zero 00:04:32.50 Trigger Error in 'lib0E15B1AE_gt_GetMousePos_Func': Divide by zero

    I have an Idea about that, i will fix that ;).

    Thanks for the quick feedback :).

    Posted in: Triggers
  • 0

    posted a message on Library: Improved GetResolution

    Hey there,

    since the resolution libary by desiderius1 requierd the User to click, and had some little errors when moving the mouse during the measurement, i decided to write a new one. The new libary has a diffrent approch to measure the resolution and has more options doing this:

    Advantages

    • No more Click required
    • Precise Resolution measuerment: 2-4px might differ i it's not a standart resolution
    • Instant Resolution measuerment: The Player just notices camera flickering one time, with little errors like desiderius1 library
    • Condition: Resolution Changed: User won't notice anything.

    Disadvantages

    • Increased loading time (2-3 Seconds)

    Known Issues

    • The fast detection detects the scale often very wrong. This results in a false resolution. The internal UI resolution ist still correct.

    Documentation(Basic)

    Installation

    Change the lirbary ID to 0E15B1AE (Right click on the library -> Library -> Change Library ID -> Use Shared ID -> Hexadecimal -> 0E15B1AE)

    Action: UI - Resolution - Setup

    It's initailizes everything you need. If you want to risk a lagg when detecting the resolution you should run this action in adavance. It usally takes 2-3 seconds. I recommend running this at Map initialization. This will generate the needed dialogs for the system and initalize the resolution database.

    Action: Resolution - Refresh

    This is the heart of the system. Running this action it will set the global variables.

    Parameter: Player(0-15)

    Playernumber of the Player you want to detect the resolution of.

    Parameter: Mode(on/off)

    Turning on the precison mode will ensure the quallity of the result. If the mouse is moved rapidly it will take some additional seconds to detect the resolution. When turned off the result will be nearly instant, but on moving the mouse it will be inaccurate the same way like desiderius1 library.

    Parameter: Tolerance(0-infty)

    Setting this parameter to a value greater than zero the system will use the resolutiontable(Source:Wikipedia) and trys to match the measured resolution to a common resolution. Since the error of the measurement is about 1% i recommend a value of 2.5%, this will ensure quallity of the result.

    Parameter: Debugmode(on/off)

    This will display the measured variables when done.

    Variable(Record): UI - Resolution

    This contains all information measured. The array is the playernumber(0-15). All values are set to zero in the beginning. If youre not sure if the variable has been set then use the "Condition: Resolution - Decent check". I will return false if the variales aren't set.

    • X-Mouse(Integer): Internal X UI resolution of starcraft
    • Y-Mouse(Integer): Internal Y UI resolution of starcraft
    • X-Resolution(Integer): X Resolution of the window (eg 800)
    • Y-Resolution(Integer): Y Resolution of the window (eg 600)
    • Scale(Real): Quotient of "Internal UI resolution" to "Resolution"

    Documentation(Advanced)

    Action: UI - Resolution - Disable Permanent Tracking

    Parameter: Permanent Tracking(Enable/Disable)

    Enableing this option might speed up the detections Prozess. I do not recommend leaveing this option turned on since it fires a trigger on mouse movement and generates this way a lot of traffic. Single player shouldn't be a probem.

    Condition: Resolution - Decent check

    This condition will check if the player has changed his resolution. It's a lot faster than refreshing the resolution variables. It will return false if the resolution has changed, true if it's still the same. I will NOT correct the resolution variables!

    Settings(Advanced): Record: Settings

    • UI X (Max) = 3000, currently 3000 is enough for all common resolution. Raise this value if you work on a screen with an X-Resolution(Windows) of 7000 or more.
    • UI Y (Max) = 2000, same as UI X (Max).
    • Detection Dialogs Transparency = 99.9, if this value is lower than 99 the player might see the windows flickering when detecting.
    • Detection Time = 0.1, just change this if the system doesn't work when you mouse of hovering over a Dialog while detecting. Then you might try 0.15 or 0.2
    • Permanent Traking = Off, the initial value of Permanent Traking
    • Accuracy = 50, Possible Range 1 to 300, the higher the more accurate it is. It will sort of cut of the detecting if the mouse is to close to the border for detecting the Scale.

    By-product: Show/Hide Dialogs Below Mouse

    This will hide all dialogs below your mouse and show them again on command.

    Parameter: Player(0-15)

    Playernumber of the Player you want to hide the dialogs for.

    Parameter: Display(show/hide)

    Show or hide the Dialogs

    I hope this Documentation helps a litte ;).

    Since i have no Idea if these changes are enough for a new post in the library section and i would like to have some feedback i postet this here for now. Hope this helps some mapmakers ;)

    Taldeen

    Posted in: Triggers
  • 0

    posted a message on Don't allow clicking through Dialog

    Hmm, that won't work for me, cause i still want to track down all the mouse clicks(also rightclick, middle etc., not just leftclick and doubleclick). In WC3/Jass i would have created a visibility modifier to black out the area (temporarly) behind the dialog.

    Is there something like this possible? Edit: Hmm, i thought of something difffrent. Is it possible to hide actors for a specific player(means locally)?

    Posted in: Triggers
  • 0

    posted a message on Don't allow clicking through Dialog

    Hey there, i just set up an Dialog. As the title states, how can i make the cursor interacting just with the dialog itself? Means no changing of the cursor when hovering over a unit if it's in the background of the dialog?

    Thanks Taldeen

    Posted in: Triggers
  • 0

    posted a message on Store Damage dealt by Player to Player

    Jap, that was it! The Debugwindow the created a huge lagg. Now everything is running beautiful! Thanks a lot!

    Posted in: Triggers
  • 0

    posted a message on Store Damage dealt by Player to Player

    Yeah, you were right. It wasn't direcly connected to this trigger. There was another trigger with "Environment - Player Any Player uses Effect xxx".

    The effect triggered when a specicfic behavior has been removed(a stackable behavior), so when a unit died and it had about 50 behaviors the trigger just went nuts :D. I solved that with a simple validator.

    EDIT: Nah, just when i tought i was done, i realized that wasn't the only couse. Its still lagging. I attached the map, maybe someone can test it or has another idea.

    trigger gt_ReputationAttack;
    //--------------------------------------------------------------------------------------------------
    // Trigger: Reputation - Attack
    //--------------------------------------------------------------------------------------------------
    bool gt_ReputationAttack_Func (bool testConds, bool runActions) {
        // Conditions
        unit lv_AttackedUnit = EventUnit();
        int lv_AttackedPlayer = EventPlayer();
        int lv_AttackingPlayer = EventUnitDamageSourcePlayer();
        int lv_CostDamage;
        if (lv_AttackingPlayer > 9) {
            return false;
        }
        if (lv_AttackedPlayer < 10) {
            return false;
        }
        if (lv_AttackedPlayer > 12) {
            return false;
        }
        lv_AttackedPlayer = lv_AttackedPlayer - 10;
        // lv_CostDamage = FixedToInt(EventUnitDamageAmount() / UnitGetPropertyFixed(lv_AttackedUnit, c_unitPropLife, c_unitPropNormal)) * UnitTypeGetCost(UnitGetType(lv_AttackedUnit), c_unitCostMinerals) + 1;
        lv_CostDamage = 1;  
        gv_playerdata[lv_AttackingPlayer].lv_reputation[lv_AttackedPlayer] = gv_playerdata[lv_AttackingPlayer].lv_reputation[lv_AttackedPlayer] - lv_CostDamage;
        return true;
    }
    //--------------------------------------------------------------------------------------------------
    void gt_ReputationAttack_Init () {
        gt_ReputationAttack = TriggerCreate("gt_ReputationAttack_Func");
        TriggerAddEventUnitDamaged(gt_ReputationAttack, null, c_unitDamageTypeAny, c_unitDamageEither, null);
    }
    
    Posted in: Triggers
  • 0

    posted a message on Store Damage dealt by Player to Player

    Okay then i guess it's better to move this thread to the triggersection.

    I rewrote the Trigger in Galaxy, but it's not helping much, still the same Issues:

    trigger gt_ReputationAttack;
    //--------------------------------------------------------------------------------------------------
    // Trigger: Reputation - Attack
    //--------------------------------------------------------------------------------------------------
    bool gt_ReputationAttack_Func (bool testConds, bool runActions) {
        // Conditions
        int lv_AttackedPlayer = EventPlayer();
        int lv_AttackingPlayer = UnitGetOwner(EventUnitTarget());
        if (lv_AttackingPlayer > 9) {
            return false;
        }
        if (lv_AttackedPlayer < 10) {
            return false;
        }
        if (lv_AttackedPlayer > 12) {
            return false;
        }
        gv_reputation2=gv_reputation2 + 1;
        return true;
    }
    
    //--------------------------------------------------------------------------------------------------
    void gt_ReputationAttack_Init () {
        gt_ReputationAttack = TriggerCreate("gt_ReputationAttack_Func");
        TriggerAddEventUnitAttacked(gt_ReputationAttack, null);
    }
    
    • Events per Second: 300
    • Events: 2760 (Total time: 23.024 ms),
    • Failed Conditions: 1425 (Average Fail Time: 0.006 ms)
    • Run: 1335 (Average Run Time: 0.010)

    Any Ideas?

    Posted in: Triggers
  • 0

    posted a message on Store Damage dealt by Player to Player

    Hmm, the trigger runtime itself seems not to be that high. About 9 seconds of testing(about 80 Units fighting each other):

    • Events per Second: ~300
    • Events: 2775 (Total time: 40.451 ms),
    • Failed Conditions: 1447 (Average Fail Time: 0.004 ms)
    • Run: 1328 (Average Run Time: 0.026)

    But still the lag is unbearable. And i don't know a way using this Trigger more efficiently (I think the event is fired so often that itself causes the lag)

    To avoid 10k Buffstacks, i could easily set the periodic checking event to half a second so there usally wouldn't be 10k buff stacks one one unit.

    I thought about using the conjoined behaveior on a unit with 100k Life and then check the hitpoints periodically. But i'm not really familiar with this behaveior and I dont have a clue how it actually works(I know that some destructibles are using it). Any examples/suggestions?

    (Edit: The trigger forum would be ok too ;))

    Posted in: Triggers
  • 0

    posted a message on Store Damage dealt by Player to Player

    Hey there, i'm new at SC2 Mapster and to the Galaxy Editor. But I did quite a lot with the old Warcraft 3 World Edit. Im not sure where to put this thread, but i hope the datasection is ok.

    I would like to store all the damage dealt(relative to the units production cost) by a player to a specific player stored in a variable. Until now i did this via Trigger:

    Reputation - Attack
        Events
            Unit - Any Unit takes Fatal or Non-Fatal Any damage (from Any effects)
        Local Variables
        Conditions
            10 <= (Triggering player) <= 12
            1 <= (Damaging player) <= 9
        Actions
            Variable - Set Reputation[(Damaging player)][((Triggering player) - 10)] = (Reputation[(Damaging player)][((Triggering player) - 10)] + (Round((((Triggering damage amount) / ((Triggering unit) Life (Default))) * (Real((Minerals cost of (Unit type of (Triggering unit)))))))))
    

    But the trigger slows down the whole game when more than 30 units are fighting. My next Idea was to store the all damage dealt by a player to a player in a specific structure(using Validators) and then refresh the variable every 5 seconds.

    I thought about adding one behaveior-buff per damagepoint to a specific structure or to "share" the damage with that structure. Since i'm all new to behaviors, effects and validators i hope you can help me with this or share another idea.

    Thanks Taldeen

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