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. Daffa the Mage

    Daffa the Mage

    Map Moderator

    Joined:
    Jan 30, 2013
    Messages:
    7,689
    Resources:
    27
    Packs:
    1
    Maps:
    8
    Spells:
    16
    Tutorials:
    2
    Resources:
    27
    Are there native to get price of units or items already? If not, can we have them?
     
  2. TriggerHappy

    TriggerHappy

    Code Moderator

    Joined:
    Jun 23, 2007
    Messages:
    3,668
    Resources:
    22
    Spells:
    11
    Tutorials:
    2
    JASS:
    9
    Resources:
    22
    Code (vJASS):
    native GetUnitGoldCost      takes integer unitid                        returns integer
    native GetUnitWoodCost      takes integer unitid                        returns integer

    native GetUpgradeGoldCost   takes integer id                            returns integer
    native GetUpgradeWoodCost   takes integer id                            returns integer
     


    These are in common.ai and there doesn't seem to be anything for items.
     
  3. Daffa the Mage

    Daffa the Mage

    Map Moderator

    Joined:
    Jan 30, 2013
    Messages:
    7,689
    Resources:
    27
    Packs:
    1
    Maps:
    8
    Spells:
    16
    Tutorials:
    2
    Resources:
    27
    common.ai? Can we have them into the main native of triggers? Oh wait, 1.30 JassHelper I assume?
     
  4. Wrda

    Wrda

    Joined:
    Nov 18, 2012
    Messages:
    1,133
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    it's possible since... jngp? Remember
    native UnitAlive
    ? It is oftenly used in systems and spells, just need to declare it at map header in order to use it.
     
  5. Robbepop

    Robbepop

    Joined:
    Mar 6, 2008
    Messages:
    890
    Resources:
    7
    Maps:
    6
    Spells:
    1
    Resources:
    7
    Can anybody here please elaborate if there was already a discussion and plans about some new natives that actually allow us to save and load data over the course of several game instances?

    This can be done in StarCraft2 via the banks as far as I remember and there they are even available in online sessions. So the data isn't even stored locally on the players computer but on B.Net2 servers as far as I can imagine it to work.
    This feature would allow for a great set of new maps and map types.
     
  6. TriggerHappy

    TriggerHappy

    Code Moderator

    Joined:
    Jun 23, 2007
    Messages:
    3,668
    Resources:
    22
    Spells:
    11
    Tutorials:
    2
    JASS:
    9
    Resources:
    22
    After pestering Blizzard a few times they finally listened and have told me the "Allow Local Files" requirement for the
    Preloader
    native will be removed. This means you will be able to execute generated files from the Preload exploit effectively allowing us to read/write arbitrary data from disk.

    In short, Codeless Save/load should work for everyone without having to enable the "Allow Local Files" registry flag starting on Patch 1.30 (not PTR).

    Codeless Save and Load (Multiplayer) - v1.3.9

    I will be updating my Sync library / codeless save/load once the patch hits and I can confirm the requirement has been removed.
     
  7. Robbepop

    Robbepop

    Joined:
    Mar 6, 2008
    Messages:
    890
    Resources:
    7
    Maps:
    6
    Spells:
    1
    Resources:
    7
    Thank you for clearing that up to me.
    It is awesome to see progress in this field.

    So we can actually use local files that are safed on each player's computer - this is good.
    And I think using your library (or similar) makes for a good encryption of the data. :) - Am I right about this?

    Depending on the limiations of local file loading for multiplayer games this could create many new opportunities for us on creating new game experiences! I imagine a global player rank for some mini games such as Tower Defense etc.
     
  8. Wareditor

    Wareditor

    Joined:
    Jan 16, 2009
    Messages:
    681
    Resources:
    3
    Maps:
    3
    Resources:
    3
    The issue is not how the data is stored - Nobody would cheat by cracking the encryption method used to store the data. It's much easier to copy a map, inject any cheat in it and create a 'valid' save by just playing that cheated map. The only way to ensure data legitimacy is to make sure that the data's source is legit itself and thus you must have a way to know from where the data is coming - official host bot, regular battle net, lan or singleplayer. Then the first step would be to have only official host bot data work in the official host bot games. However even with that type of safety, one could just modify the hostbot map to produce host bot data even when hosted by a non official source (unless you are using a private key received at run time). Thus to have it really safe, one should store the data on a sever.

    Using TriggerHappy's Web Request API, one could achieve that today.
     
  9. Wrda

    Wrda

    Joined:
    Nov 18, 2012
    Messages:
    1,133
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    That seems rather vague, and pointless to make it "really safe" when there still are, few people with intentions to cheat and will find any methods possible.
     
  10. Wareditor

    Wareditor

    Joined:
    Jan 16, 2009
    Messages:
    681
    Resources:
    3
    Maps:
    3
    Resources:
    3
    Maybe your lack of understanding of what I am talking about make it vague to you but then you should have just stayed it that way.
    It's not pointless since cheaters have a negative impact on the map and its community since they devaluate the efforts of legit players. Thus, there is a reason to make cheating as hard as possible.
    Of course, one could always find a way to cheat. However the chance of someone hacking a server to cheat in a Warcraft 3 map is very slim.
     
  11. apsyll

    apsyll

    Joined:
    Aug 28, 2015
    Messages:
    196
    Resources:
    1
    Maps:
    1
    Resources:
    1
    I don't know if something like this was already requested I think so but just in case something like
    Code (vJASS):
    startUnitAbilityCooldown takes unit, abilityId returns boolean is cooldown started

    It returns true when the cooldown could be started like the unit cast the ability but without the cast effect.
    And false if the ability wasn't added to the unit or couldn't start the cooldown for other reasons.
    I dont know if it should reset the cooldown to its maximum when its in cooldown when the trigger is fired tho, I would say yes it should.
     
  12. Wrda

    Wrda

    Joined:
    Nov 18, 2012
    Messages:
    1,133
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    A native like that was already requested 2 times, and it won't work because it doesn't support passive abilities.
     
  13. Pinzu

    Pinzu

    Joined:
    Nov 30, 2007
    Messages:
    1,177
    Resources:
    3
    Spells:
    2
    Tutorials:
    1
    Resources:
    3
    If you change the ability level of a aura spell the buff marker does not update until you select/deselect the unit. This bug is probably old though.

    These have probably already been suggested.
    function SetUnitAttackRange takes unit u, real range returns nothing

    function GetUnitAttackRange takes unit u returns real

    function SetUnitModel takes unit u, string modelFile returns nothing


    Make it possible to save using Unit or Item types as keys in GUI. I think the only way to do it now (if Im not completely wrong here) is to make a custom script.

    But what I really want would be more data structures other than the hashtable.
     
    Last edited: Jul 29, 2018
  14. Raised

    Raised

    Joined:
    May 8, 2016
    Messages:
    56
    Resources:
    0
    Resources:
    0
    The folloving functions needs a fix:
    Code (vJASS):
    native CreateSound(path,looping,3D,stopWhenOutOfRange,0,0,"DefaultEAXON")
    //Parameter stopWhenOutOfRange = false does not disable the sound cutoff.
       
    native SetSoundDistances(s,fadeIn,fadeOut)
    //Low fadeIn value (<100) prevent sound from playing for some reason
    //The sound is still hearable when the distance from the sound position to the game camera is greater than fadeOut
     
    Last edited: Jul 31, 2018
  15. MyPad

    MyPad

    Spell Reviewer

    Joined:
    May 9, 2014
    Messages:
    1,320
    Resources:
    7
    Models:
    1
    Icons:
    2
    Spells:
    3
    JASS:
    1
    Resources:
    7
    Some more natives to suggest (that probably have already been suggested):

    Code (vJASS):

    native GetCurrentOpLimit takes nothing returns integer
        // This gets the operation limit of the current thread. (Although it is technically a global)

    native SetCurrentOpLimit takes integer newLimit returns nothing
        // Setting it to 10 or below removes the limit entirely. (Only for the current thread).
        // This also undoes any operation expenses the native spends.
     
     
  16. Death Adder

    Death Adder

    Joined:
    Nov 3, 2013
    Messages:
    886
    Resources:
    0
    Resources:
    0
    It would be nice to be able to change the hotkeys of abilities ingame for a specific unit, so you could have the abilities Q W E R T etc. on custom hero maps without having to make 4+ versions of the same ability, but with different hotkeys. (So you can combine any combination of abilities without some of them having the same hotkey.)


    native SetAbilityHotkey takes unit whichUnit, integer whichAbilityId, string whichHotkey returns nothing



    Also, I don't think I've seen getting and setting the position of buttons on the command card either, which goes hand in hand with this.
     
  17. Robbepop

    Robbepop

    Joined:
    Mar 6, 2008
    Messages:
    890
    Resources:
    7
    Maps:
    6
    Spells:
    1
    Resources:
    7
    I don't know if this has been suggested already but for my Line Tower Wars map I oftentimes wanted the below API to be existent.
    It would have been a convenience feature for the players since that's mainly the first thing what every experienced player does at the beginning of each game.

    Code (vJASS):

    // Constants for hotkeys 0 to 9 for the new type named controlgroup
    constant controlgroup CONTROL_GROUP_0
    constant controlgroup CONTROL_GROUP_1
    ...
    constant controlgroup CONTROL_GROUP_9

    native ControlGroupPlayerAddUnit takes controlgroup whichControlGroup, player whichPlayer, unit whichUnit returns nothing
    native ControlGroupPlayerRemoveUnit takes controlgroup whichControlGroup, player whichPlayer, unit whichUnit returns nothing
    native ClearControlGroup takes controlgroup whichControlGroup, player whichPlayer returns nothing
     


    Which adds or removes the target unit to a control group for the given player.

    Maybe we could even simply the API to be used without the player handle since one can only put his or her own units into a controlgroup.

    Code (vJASS):

    native ControlGroupAddUnit takes controlgroup whichControlGroup, unit whichUnit returns nothing
    native ControlGroupRemoveUnit takes controlgroup whichControlGroup, unit whichUnit returns nothing
     
     
    Last edited: Aug 6, 2018
  18. Rufus

    Rufus

    Joined:
    Oct 2, 2011
    Messages:
    2,543
    Resources:
    8
    Maps:
    6
    Tutorials:
    2
    Resources:
    8
    I thirst for new natives!
    This one looks particulary useful I think:

    When can we expect to see a new batch of added natives? :)
     
  19. yxq1122

    yxq1122

    Joined:
    Jun 5, 2018
    Messages:
    112
    Resources:
    0
    Resources:
    0
    Is there a full list of unit types? If not, a full unit types list should be considered to aid the unit type natives, e.g.
    Code (Text):
    IsUnitType
    .
    This is very useful for type identification of units, e.g. a guard.
     
  20. TriggerHappy

    TriggerHappy

    Code Moderator

    Joined:
    Jun 23, 2007
    Messages:
    3,668
    Resources:
    22
    Spells:
    11
    Tutorials:
    2
    JASS:
    9
    Resources:
    22
    constant native IsUnitType          takes unit whichUnit, unittype whichUnitType returns boolean


    Notice it takes
    unittype
    as a parameter. If you search for it in the common.j you will find this:

    Code (vJASS):

    //===================================================
    // Unit Type Constants for use with IsUnitType()
    //===================================================
        constant unittype UNIT_TYPE_HERO                        = ConvertUnitType(0)
        constant unittype UNIT_TYPE_DEAD                        = ConvertUnitType(1)
        constant unittype UNIT_TYPE_STRUCTURE                   = ConvertUnitType(2)
        constant unittype UNIT_TYPE_FLYING                      = ConvertUnitType(3)
        constant unittype UNIT_TYPE_GROUND                      = ConvertUnitType(4)
        constant unittype UNIT_TYPE_ATTACKS_FLYING              = ConvertUnitType(5)
        constant unittype UNIT_TYPE_ATTACKS_GROUND              = ConvertUnitType(6)
        constant unittype UNIT_TYPE_MELEE_ATTACKER              = ConvertUnitType(7)
        constant unittype UNIT_TYPE_RANGED_ATTACKER             = ConvertUnitType(8)
        constant unittype UNIT_TYPE_GIANT                       = ConvertUnitType(9)
        constant unittype UNIT_TYPE_SUMMONED                    = ConvertUnitType(10)
        constant unittype UNIT_TYPE_STUNNED                     = ConvertUnitType(11)
        constant unittype UNIT_TYPE_PLAGUED                     = ConvertUnitType(12)
        constant unittype UNIT_TYPE_SNARED                      = ConvertUnitType(13)
        constant unittype UNIT_TYPE_UNDEAD                      = ConvertUnitType(14)
        constant unittype UNIT_TYPE_MECHANICAL                  = ConvertUnitType(15)
        constant unittype UNIT_TYPE_PEON                        = ConvertUnitType(16)
        constant unittype UNIT_TYPE_SAPPER                      = ConvertUnitType(17)
        constant unittype UNIT_TYPE_TOWNHALL                    = ConvertUnitType(18)
        constant unittype UNIT_TYPE_ANCIENT                     = ConvertUnitType(19)
     
        constant unittype UNIT_TYPE_TAUREN                      = ConvertUnitType(20)
        constant unittype UNIT_TYPE_POISONED                    = ConvertUnitType(21)
        constant unittype UNIT_TYPE_POLYMORPHED                 = ConvertUnitType(22)
        constant unittype UNIT_TYPE_SLEEPING                    = ConvertUnitType(23)
        constant unittype UNIT_TYPE_RESISTANT                   = ConvertUnitType(24)
        constant unittype UNIT_TYPE_ETHEREAL                    = ConvertUnitType(25)
        constant unittype UNIT_TYPE_MAGIC_IMMUNE                = ConvertUnitType(26)
     


    Unless of course you mean there are more types that aren't defined here that can be used.