1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Producer Update: Natives List

Discussion in 'Patch & Reforged Discussion' started by Kam, Dec 7, 2017.

  1. KILLCIDE

    KILLCIDE

    Administrator

    Joined:
    Jul 22, 2015
    Messages:
    3,501
    Resources:
    20
    Models:
    2
    Icons:
    10
    Spells:
    7
    Tutorials:
    1
    Resources:
    20
    Not sure of the difference between GetUnitAbilityCooldownTimer() & GetUnitAbilityCooldownRemaining()
     
  2. HappyTauren

    HappyTauren

    Joined:
    Nov 3, 2006
    Messages:
    8,413
    Resources:
    87
    Models:
    61
    Icons:
    23
    Packs:
    1
    Tutorials:
    2
    Resources:
    87
    GetUnitAbilityCooldownTimer <- I have no idea what this is supposed to be, but generating a timer like this is just really bad design. Instead of this, the "ability cooldown finished" event is way better and more versatile.
     
  3. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,611
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    Which is why I called it GetUnitAbilityCooldownTimeout. It is so one can read the current cooldown status of abilities, including calculating the percentage completion of cooldown.
    GetUnitAbilityCooldownTimeout
    GetUnitAbilityCooldownRemaining
    These are functionally required as separate as they refer to the current state of a unit. Similar to the StarCraft II natives to read cooldown references of a unit. One gets the starting cooldown time, the other gets the cooldown time remaining. Together with natives to change cooldowns this would allow one to exactly set the cooldown state of an ability for a unit, including the fraction completed in the UI. An example use case could be a trigger enhanced ability that when over 50% cooldown completion gives bonus damage.

    GetUnitAbilityCooldown is required if SetUnitAbilityCooldown is implemented, otherwise it is pointless and the above two will work.

    GetAbilityCooldown is only required if SetAbilityCooldown is implemented, otherwise it can be replaced by the Object Editor API natives.
     
    Last edited: Jan 10, 2018
  4. Kam

    Kam

    Joined:
    Aug 3, 2004
    Messages:
    2,630
    Resources:
    23
    Models:
    8
    Icons:
    2
    Maps:
    13
    Resources:
    23
    Thank you all for the continued support. An engineer is currently going through these.

    More clarification:

    function UnitHideAbility takes unit u, integer abilityId, boolean flag returns nothing
    function UnitDisableAbility takes unit u, integer abilityId, boolean flag returns nothing
    What does flag stand for in these 2 functions?

    What's the difference between "SetUnitArmor" and "ModifyUnitArmor"

    Edit:

    for example
    an ability: cd: 10sec, cd remaining: 6 sec
    what's GetUnitAbilityCooldownTimeout
    is it 10 or 6 or 4 or 40% or 60%?

    But GetUnitAbilityCooldown is also 10?
    If now I set cooldown to 20sec
    cd remaining is 6sec
    what will GetUnitABliityCooldown and GetUnitAbilityCooldownTimeout become?
     
    Last edited: Jan 10, 2018
  5. KILLCIDE

    KILLCIDE

    Administrator

    Joined:
    Jul 22, 2015
    Messages:
    3,501
    Resources:
    20
    Models:
    2
    Icons:
    10
    Spells:
    7
    Tutorials:
    1
    Resources:
    20
    If true, hide/disable the ability for the unit. If false, unhide/enable the ability for the unit.

    SetUnitArmor affects the base, so I'm guessing "white" armor.
     
  6. DracoL1ch

    DracoL1ch

    Joined:
    Dec 12, 2010
    Messages:
    1,759
    Resources:
    2
    Tutorials:
    2
    Resources:
    2
    Modify* omit op to get the current value, enspeeding process up
     
  7. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,611
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    When true it does the native's name sake. UnitHideAbility will hide the ability from the command card of that unit when flag is true. UnitDisableAbility will disable the ability (shaded icon) on that unit when the flag is true.
    Set unit armor changes the white base value. Modify unit armor changes the green/red bonus value. To fit with WC3 convention some times one wants green/red bonys numbers to show modifications from buffs or passives. Other times one wants to modify the base value, eg for a custom progression system.

    10 seconds. The reason I choose the term "timeout" is because it follows the convention of TimerGetTimeout which returns the timeout parameter used to start a timer.
    Yes but its to go with modifying ability base cooldown for a specific unit. Without the capability to do so (its accompanying set native) its redundant. I tried to group the natives together so ones that compliment each other are near each other.

    Be aware that the source material was quite vague. I tried to give all the natives sensible names, parameters and a description however if the underlying concept is practical is another issue. This is especially the case for all the "Local" ones since I am not entirely sure if the people suggesting them were aware the return values might not be synchronized as they would depend on local state.
     
    Last edited: Jan 10, 2018
  8. Spellbound

    Spellbound

    Joined:
    Jan 9, 2005
    Messages:
    1,953
    Resources:
    16
    Icons:
    1
    Skins:
    5
    Spells:
    9
    JASS:
    1
    Resources:
    16
    Okay, I think there has been a mixup with the old list itself. Sorry about that. There are currently five functions that deal with ___UnitAbilityCooldown:

    Code (vJASS):
    function GetUnitAbilityCooldownTimeout takes unit u, integer abilityId returns real         //Returns the cooldown time for an ability if the unit were to use it.
    function GetUnitAbilityCooldownRemaining takes unit u, integer abilityId returns real       //Returns the remaining cooldown time of an ability on a unit.
    function SetUnitAbilityCooldown takes unit u, integer abilityId, real timeout, real remaining returns nothing

    function GetUnitAbilityCooldown takes unit u, integer abilityId, integer level returns real
    function SetUnitAbilityCooldown takes unit u, integer abilityId, integer level, integer newcool returns integer

    GetUnitAbilityCooldown seems to do the same thing as with GetUnitAbilityCooldownRemaining so we could potentially axe one of them. Having Remaining in the function name is more descriptive but some might see it as unnecessary.

    SetUnitAbilityCooldown is repeated once, but they take a different amount of arguments. The first one seems able to modify both the FULL cooldown of a unit's ability (which btw would mean that abilities will be per-unit rather than referenced from a global cache) and the remaining cooldown all in one. Seems a bit unnecessary. @Dr Super Good wouldn't it be preferable if the cooldown 'setters' were separated into two different functions?

    Eg:

    SetUnitAbilityCooldownTimeout takes unit u, integer abilityId, real timeout returns nothing

    SetUnitAbilityCooldown takes unit u, integer abilityId, real remaining returns nothing


    Thoughts?
     
  9. IcemanBo

    IcemanBo

    Joined:
    Sep 6, 2013
    Messages:
    6,180
    Resources:
    22
    Maps:
    3
    Spells:
    11
    Template:
    1
    Tutorials:
    4
    JASS:
    3
    Resources:
    22
    Obviously.
     
  10. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,611
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    This might cause ordering issues. For example someone trying to set the cooldown before setting a timeout. Cooldown should be clamped to timeout for logical reasons, and so in such a case it would likely not do what was intended. Having them as a single native forces the player to consider both timeout and remaining time and performs the set in an atomic way which will work as intended.
     
  11. MyPad

    MyPad

    Spell Reviewer

    Joined:
    May 9, 2014
    Messages:
    1,324
    Resources:
    7
    Models:
    1
    Icons:
    2
    Spells:
    3
    JASS:
    1
    Resources:
    7
    If these new natives will be included, the API for Memory Hack will be reborn (well, the way it was used in its thread and not the security issues and such, to be exact) as a hardcoded, Blizzard-sanctioned set of natives. Nice!
     
  12. Spellbound

    Spellbound

    Joined:
    Jan 9, 2005
    Messages:
    1,953
    Resources:
    16
    Icons:
    1
    Skins:
    5
    Spells:
    9
    JASS:
    1
    Resources:
    16
    Hmm, I think I see what you mean.

    Also to respond to the min/max movement speed thing, if you look at the Movement section of a unit in the Object Editor, you will find there is a Speed Maximum field and Speed Minimum field. I don't think these actually work, but if Blizzard feels so inclined, they could 'activate' them so that units can be made to accelerate and decelerate like they do in Starcraft 2.
     
    Last edited: Jan 10, 2018
  13. Tasyen

    Tasyen

    Joined:
    Jul 18, 2010
    Messages:
    1,356
    Resources:
    17
    Tools:
    2
    Maps:
    2
    Spells:
    8
    Tutorials:
    4
    JASS:
    1
    Resources:
    17
    The min/max speed fields in the object editor are working, they do the same as the ones in gameplay-constants but unitType specific.
    If one places a 0 (default), units from this unitType uses the values from gameplay-constants as the hint says.​
    Minspeed disallows slowing a unit below this limit.
    MaxSpeed disallows speeding up a unit above this limit. (max speed is again 522)

    Edit: Still would be cool to change this values unit-specific during runtime.
     
    Last edited: Jan 10, 2018
  14. Spellbound

    Spellbound

    Joined:
    Jan 9, 2005
    Messages:
    1,953
    Resources:
    16
    Icons:
    1
    Skins:
    5
    Spells:
    9
    JASS:
    1
    Resources:
    16
    Ooooh I see. In that case it would be cool to have an acceleration field in the OE :p
    Also allow max speed to go beyond 522.
     
  15. Rui

    Rui

    Joined:
    Jan 7, 2005
    Messages:
    8,497
    Resources:
    8
    Maps:
    8
    Resources:
    8
    Would it not be better that all getters are replaced by a
    ReadMemory()
    function with internal boundary checks? This would obviously go with unveiling how wc3 objects are structured. It takes less work to accomplish, is more efficient and allows further optimization of code.
    Sorry if I'm saying something that doesn't make sense; I've been out of the loop for a while. Just food for thought.
     
    Last edited: Jan 11, 2018
  16. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,611
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    This is probably an engine limitation. Specifically how the path finder works. Units might not be able to move smoothly at faster speeds.
     
  17. Daffa the Mage

    Daffa the Mage

    Map Moderator

    Joined:
    Jan 30, 2013
    Messages:
    7,730
    Resources:
    28
    Packs:
    1
    Maps:
    8
    Spells:
    17
    Tutorials:
    2
    Resources:
    28
    What's this thread actually about? I'm curious but the upper posts kinda heavy for me to understand :(
     
  18. MyPad

    MyPad

    Spell Reviewer

    Joined:
    May 9, 2014
    Messages:
    1,324
    Resources:
    7
    Models:
    1
    Icons:
    2
    Spells:
    3
    JASS:
    1
    Resources:
    7
    ^^

    It's about new natives being suggested to Blizzard. The posts above are talking about modifying the maximum speed and minimum speed of a certain unit at runtime.
     
  19. Daffa the Mage

    Daffa the Mage

    Map Moderator

    Joined:
    Jan 30, 2013
    Messages:
    7,730
    Resources:
    28
    Packs:
    1
    Maps:
    8
    Spells:
    17
    Tutorials:
    2
    Resources:
    28
    Adding natives eh? I'm in!
    Maybe some from the MemHack so we can officially have it?
     
  20. HappyTauren

    HappyTauren

    Joined:
    Nov 3, 2006
    Messages:
    8,413
    Resources:
    87
    Models:
    61
    Icons:
    23
    Packs:
    1
    Tutorials:
    2
    Resources:
    87
    Well the idea of this patch is basically to make memhack obsolete by adding its functionalities. But it'll take a few patches before all parties involved are satisfied. My wishes are heavy on the UI/control change, so this means having control over UI elements and being able to detect keyboard/mouse input easily.