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. We have recently started the 16th edition of the Mini Mapping Contest. The theme is mini RPG. Do check it out and have fun.
    Dismiss Notice
  4. Dismiss Notice
  5. The Highway to Hell has been laid open. Come along and participate in the 5th Special Effect Contest.
    Dismiss Notice
  6. 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. WGPavell

    WGPavell

    Joined:
    Sep 25, 2013
    Messages:
    4
    Resources:
    0
    Resources:
    0
    I would like to offer add the following functions and make the following changes that improve life of mapmakers :)

    1. Make it possible to add custom attack/armor types like in SC2. Custom hero stats as well. Maybe new tab in Object Editor?

    2. Some new events:
    Code (vJASS):
    constant unitevent EVENT_UNIT_BASH //event triggers when Bash chance occurs. Helps to make passives that trigger on attack way easier.
    constant unitevent EVENT_UNIT_CRITICAL //event triggers when Critical Strike chance occurs. Same as one above.
    constant unitevent EVENT_UNIT_UNLOADED //triggers when unit unloading
    constant unitevent EVENT_UNIT_LIGHTNING_DAMAGE //triggers when deal damage by Chain/Forked Lightning and Healing Wave


    (also, if you add bonus damage to crit. ability, it doesnt add up with the number in the floating text)

    3. Fix Hero and Divine armor type icons - they do not have upgradeable counterparts

    4. Some new functions:
    Code (vJASS):
    function UnitAddChanceAbility takes unit u, integer abilid, real chance returns nothing //adds unit an ability that triggers when it attacks (aka toggleable orb passive without the orb)


    5. Add orders for item abilities so they can be issued to cast with triggers.

    6. Rewamp Archimonde’s Rain of Fire to work diffirently and not only with part of summon spells. (aka an ability to put in Flamestrike so it casts multiple Flamestrikes)

    7. Allow to add more lightning types than currently supported (maybe allow their custom coloration as well). Another tab in Object Editor?

    8.
    Code (vJASS):
    function AddLightningUnitToPoint takes string codename, boolean checkVisibility, unit u, real x, real y returns lightning //Bounds a unit and a point with a lightning (when unit moves effect is attached)
    function AddLightningUnitToUnit takes string codename, boolean checkVisibility, unit u1, unit u2 returns lightning //Bounds two units with a lightning effect (attached to both, even when they move)


    9. Allow to hide floating text of abilities like Evade, Shadow Strike, Critical Strike and Mana Burn with a flag in Object Editor.

    10.
    Code (vJASS):
    function UnitSetAbilityTooltip takes unit u, integer abilid, string tooltip returns nothing //Changes ability tooltip


    11. Allows to add an argument that can be changed and that depends on certain values in ability tooltips.

    Like so: Deals $1 damage to the targeted unit.

    Code (vJASS):
    function SetUnitTooltipAbilityArgument takes unit u, integer abilid, integer param, string value returns nothing

    Changes $argument to be equal of value. E.g:
    Code (vJASS):
    call SetUnitTooltipAbilityStats(u,’A000’,1,I2S(GetHeroAgi())

    The "1" number means first argument in tooltip ($1)
    where $1 equals hero’s Agility. etc

    12. Increase the amount of text that you can put in a tooltip.

    13. Some function for AI scripts:
    Code (vJASS):
    function MorphUnit takes integer qty, integer id returns boolean //Morph qty units of type id for AI
    function GetRandomAIUnit takes integer id returns unit //Gets a random unit controlled by AI
    function IssueUnitHireHero takes integer id returns nothing //Orders a random unit controlled by AI to hire a unit from Mercenary Camp/Goblin Laboratory/etc
    function IssueUnitHireUnit takes integer id returns nothing //Same as one above but to hire a hero from a Tavern.
    function IssueHeroBuyItem takes integer hero_id, integer item_id returns nothing //Orders a random hero of hero_id type to purchase an item of item_id type from any shop (including neutral)


    14.
    Code (vJASS):
    function UnitAddEnergyBar takes unit u, integer res_start, integer res_max, integer res_regen integer color_red, integer color_green, integer color_blue //Unit gains an energy bar, its text color can be changed. You can make abilities to use custom energy instead of mana (like Rage or Energy in WoW). Does not count as mana (unaffected by brilliance aura, fountain of mana, etc)


    15.
    Code (vJASS):
    function SetLocalCursorFlicking takes boolean on returns nothing //Enables/disables cursor flicking (change of color) (see next)
    function SetLocalCursorFlickingOnTarget takes boolean on, string error returns nothing //Enables/disables cursor flicking when casting an ability (for spells based on Channel)
    function SetLocalCursorOnTargetError takes string error returns nothing //When cursor flicking is disabled, show error string and not issue an order
    function SetLocalCursorColor takes integer red, integer green, integer blue returns nothing //Sets a custom coloration for players cursor
    function SetLocalCursorModel takes string model returns nothing //Changes cursor’s model


    16. Add a flag for abilities in Object Editor to make them unable to be silenced. For Example, Ensnare is not affected by Silence.
    Add flags for Silence, Drunken Haze and Cloud of Fog to allow them to disable passive abilities and items (either fully or partially, like Doom).
    Another solution - when creating a spell with silence, allow players to list spells that are unaffected by this spell.

    17.
    Code (vJASS):
    function GetUnitAbilityList takes unit u returns integer array //Gets a list of unit abilities as array

    Or add another variable - abilitylist (array of abilities).
    In that case, required functions are:
    Code (vJASS):
    function GetUnitAbilityList takes unit u returns abilitylist //returns a list of the unit's abilities
    function GetAbilityListLength takes abilitylist l returns integer //returns the size of the unit's abilities list
    function GetAbilityFromAbilityList takes abilitylist l, integer id returns integer //returns rawcode of the ability at number id
     


    18. Fix the custom text on pre-game menu (custom names of races and AIs shows only after you play a map and it shows on all the other maps as well).
    Allow to add additional races. Can be achieved by using config (for JASS users) or make it fully supported in WE.

    19. Fix and extend or at least allow to add new team colors (at least through using colors of players 13+) or allow to customize team colors using RGB system.

    20. Add a new type of agents in-game that work like effects but that are instead moved from point to point until a required event happens after which they get destroyed..
    Code (vJASS):
    type missile extends agent //New variable type - missile
    type missileevent extends eventid //New event type for missiles
    constant unitevent EVENT_UNIT_MISSILE //Event of missile hitting a unit
    constant missileevent EVENT_MISSILE_IMPACT //Even of missile reaching a point
    function CreateMissileOnUnitToUnit takes unit target, unit source, real height, real speed, real arcangle, real scale, string modelpath returns missile //Creates a missile that moves from one point to another. Upon impact triggers EVENT_UNIT_MISSILE.
    function CreateMissileOnPointToUnit takes unit source, unit target, real x, real y, real height, real speed, real arcangle, real scale, string modelpath returns missile //Like one above but from point to unit
    function CreateMissileOnPointToPoint takes unit source, real x1, real y1, real x2, real y2, real height, real speed, real arcangle, real scale, string modelpath returns missile //Like ones above but from point to point. Upon impact triggers EVENT_MISSILE_IMPACT.
    function SetMissileX takes missile m, real x returns nothing //Sets X coordinate of missile
    function SetMissileY takes missile m, real y returns nothing //Sets Y coordinate of missile
    function SetMissileHeight takes missile m, real height returns nothing //Sets height of missile
    function SetMissileTargetPoint takes missile m, real x, real y returns nothing //Sets the target that missile will move at
    function SetMissileTargetUnit takes missile m, unit u returns nothing //Missile will move to targeted unit
    function SetMissileSourceUnit takes missile m, unit u returns nothing //Detects a unit that spawned missile
    function SetMissileSpeed takes missile m, real speed returns nothing //Sets missile speed
    function SetMissileScale takes missile m, real scale returns nothing //Sets missile size
    function SetMissileArcAngle takes missile m, real angle returns nothing //Sets missile arcangle
    function SetMissileModel takes missile m, string path returns nothing //Sets missile model
    function GetEventMissile takes nothing returns missile //Returns a missile that reached its target
    function GetMissileX takes missile m returns real //Returns current X of a missile
    function GetMissileY takes missile m returns real //Returns current Y of a missile
    function GetMissileHeight takes missile m returns real //Returns current height of a missile
    function GetMissileSpeed takes missile m returns real //Returns current speed of a missile
    function GetMissileScale takes missile m returns real //Returns current size of a missile
    function GetMissileArcAngle takes missile m returns real //Returns current arcangle of a missile
    function RemoveMissile takes missile m, boolean animation returns nothing //Deletes a missile. Flag animation depends if it will play death animation or not

    Speculations about missile functional are open.

    21. Allow to customize command icons for each race (move, stop, hold, attack and etc. like building icon) by using functions or using method from WC3 Beta

    22. Allow to add additional custom resource(s) to gold and lumber (or at least give us back mana stones pls)

    23. Allow/upgrade/extend functional of hidden abilities (world requires to know what ‘Spy’ is doing!, Random Item to work only with items that have ‘morphable’ flag at ‘on’)

    24.
    Code (vJASS):
    function SetUnitSelectionCircle takes unit u, string modelpath returns nothing //Sets a selection circle model for a unit
    function ResetUnitSelectionCircle takes unit u returns nothing //Returns the original selection circle of the unit


    P.S. Source idea, the rest is there

    25. Allow "Charge Gold and Lumber" to be customized like Channel (so custom spells that cost resources instead of mana can be added)

    26. Fix impact effect of spells based on Stampede and Carrion Swarm/Crushing Wave (it isnt changing when setting any other effect, it follows the one that original spell possesses)
     
    Last edited: Jan 21, 2018
  2. Wareditor

    Wareditor

    Joined:
    Jan 16, 2009
    Messages:
    681
    Resources:
    3
    Maps:
    3
    Resources:
    3
    @WGPavell
    Thank you for your input :)
    I have made some comments regarding your propositions.

    2: BASH, CRITICAL and LIGHTNING are too specific. It should be something that would work for all spells. In a sense BASH and CRITICAL have the same logic.
    4: this can be easily done using a Damage Detection System
    5: This can be already done from what I know. You should just make a trigger that display any order issued and you will catch the order used by items. Even for such things as moving an item to another slot.
    6: This can be easily triggered.
    7: This can be done too: check this out.
    8: This can be easily triggered with a periodic loop.
    10: This has already been proposed by everyone, I think we might get it if it's not too hard to do for Blizzard.
    11: seems useless if you have 10.
    14: I am getting what you want to do (alternate resource system) but it won't be made with just one function. What you want is actually really complicated. You would need to rework the whole warcarft 3 spell system to be able to work with multiple hero resources. It is clear that the game was built to only use mana.
    17: First you would need to add a list type. Jass functions can't return nor take integer array as of right now.
    18: Additionally, the game should clear its cache a lot better. for instance, a custom font will appear on other maps too. Sometimes it may causes the map to crash because of collisions.
     
  3. 4craft

    4craft

    Joined:
    Apr 16, 2017
    Messages:
    1
    Resources:
    0
    Resources:
    0
    And how about adding an event if the "spellbook" is open, and it is also possible to change positions within the "spellbook"

    PS wrote through Google translator xD

    constant unitevent EVENT_UNIT_ABILITY_OPEN
     
  4. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,722
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    Not possible as all that is managed locally. Other clients are not aware of current command card state. If it is synchronized it will increase net traffic as well as fire the even off with some network based latency.
     
  5. DoctorGester

    DoctorGester

    Joined:
    Dec 6, 2009
    Messages:
    76
    Resources:
    3
    Maps:
    2
    JASS:
    1
    Resources:
    3
    Better array API, possibly a dynamic array type, with common functions like ArrayAdd, ArrayLength, ArrayRemove.
    Separate type is probably not really feasible because it would need to support generic/template types, but if structs are implemented maybe some simple form of template types could be implemented as well?
    Original arrays have this weird element limit and require keeping their "length" somewhere, this is not good.
    At least the element limit itself has to go.

    An ability to declare locals anywhere would be very good.

    Multi pass compiler - an ability to declare functions past the point they are used.

    If structs are added I would suggest not adding any form of OOP, but rather adding proper typed function pointers (currently we have code, I'm not sure if we can even do anything with it other than pass it into other functions) which would allow creating vtables and whatnot in userland.
     
    Last edited: Jan 22, 2018
  6. TriggerHappy

    TriggerHappy

    Code Moderator

    Joined:
    Jun 23, 2007
    Messages:
    3,684
    Resources:
    22
    Spells:
    11
    Tutorials:
    2
    JASS:
    9
    Resources:
    22
    Here are some of my suggestions. I will likely post more as time goes on.

    Models

    Dynamically change the path of replaceable textures for widgets.

    Code (vJASS):
    native SetWidgetTexure takes widget whichWidget, string texturePath, integer replaceableId returns boolean

    Models can have textures with a Replaceable ID instead of a texture path. The most common use of this is for team color and hero glow (Replaceable ID 1 & 2). While there are natives to set a units team color, that's about all that is natively supported. The Mountain Giant's War Club ability will change any texture on the caster that uses "Replaceable ID 32" to the texture of the targeted destructable. While this allows us to modify ID 32, it's not enough and has some overhead.

    If we can allow the user to change any ID, then we can switch the texture of any part of the model dynamically. Of course this requires models to use Replaceable ID's instead of texture paths, so many vanilla models won't have uses other than custom team colors. Perhaps a complete API to modify model data would be better, however this would be the easiest to implement.

    There is already an internal function capable of doing this. However it requires a destructable as one of the paramaters, but I think it should be fairly easy to find a way to not require one. The way I do it is by using a dummy destructable object (not handle) and switching it's texture, but there is probably a better way.

    1.26
    game.dll + 0x4D32E0

    1.28.5
    game.dll + 0x1D74F0

    (thanks to @MindWorX for originally finding it on 1.28.5 for me)

    Syncing

    1. SyncStoredString
      doesn't work.
    2. Create a
      IsPlayerSyncing
      native which will check if a player is still syncing gamecache data (if none are, data is safe).
    3. Add sync natives for the
      hashtable
      type, or create a new type specifically for syncing.

    Interface

    1. Allow us to write text to more than just the game text (field03EC of CGameUI). We should be able to write to our own error messages like SimError (this library has drawbacks/doesn't work perfectly).
    2. Draw images & models on screen.
    3. GetResolutionX/Y.
    4. Possibly allow imported framedef files in maps to work (could mess things up after map is over).
    5. Allow us to move/modify frames in-game.
    6. native EnableCheats takes boolean flag returns nothing
      (game.dll + 0x1C97E0 on 1.28.5).

    And the mouse/interface API from Custom JASS Natives - (Requests & Submissions)

    Of course GetMouseX/Y functions would likely have to be async, but we could have events for clicks and it would be no different from the camera natives being async.

    And with the sync natives we can have some use in syncing mouse positions sparingly.

    Files

    1. For backwards compatibility keep everything related to the Preload bug (generating and reading files in CustomMapData folder).
    2. Allow
      Preloader
      to work for the CustomMapData folder even if the "Allow Local Files" registry flag is not set.
    3. A proper API that allows storing and retrieving data to/from disk in multiplayer. One way might be to not wipe game cache data in multiplayer. Another would be IO natives that are restricted to the CustomMapData folder.
     
    Last edited: Jan 24, 2018
  7. Wareditor

    Wareditor

    Joined:
    Jan 16, 2009
    Messages:
    681
    Resources:
    3
    Maps:
    3
    Resources:
    3
    Unless I am missing something, pausing a unit shouldn't affect its pathing.

    Code (vJASS):
    native PauseUnit takes unit whichUnit, boolean flag returns nothing
    /*
    This forces a unit to have a collision until it's unpaused.
    Pausing a unit with a disabled collision will re-enable it for this unit.
    Trying to disable the collision of a paused unit doesn't work.

    This has been tested with the SetUnitPathing native and abilities that affect collision such as 'Aeth'*/

    native SetUnitPathing takes unit whichUnit, boolean flag returns nothing
    */
     
  8. blufflegendaire

    blufflegendaire

    Joined:
    Jul 2, 2014
    Messages:
    45
    Resources:
    0
    Resources:
    0
    Anyone mentioned web requests?

    The idea would be allowing host (I've read "GetLocalPlayer() == Player(-1)" to exec code only on host) to communicate over HTTP requests to recover persistent datas online.

    Right now I only think of save/load system; implementation could be such as :

    First, upon starting Warcraft, create an unique identifier (call it token, id, whatever), this will be used later.

    As for functions, I think it could be defined as:

    Code (vJASS):
    native WebRequestGet takes string uri returns string
    native WebRequestPost takes string uri, string parameters returns string
     


    As for now, returns would be strings, meaning one would have to process it to extract data if format is not text.
    The asynchronous state of the functions could be problematic, would it be possible to pass string variable to the function as pointer and check for it's content to be != empty string, once it's filled with data, consider the request as done?

    That would mean:

    Code (vJASS):
    native WebRequestGet takes string uri, string* response returns nothing
    native WebRequestPost takes string uri, string parameters, string* response returns nothing
     


    For mod uses, one would have 2 triggers, one issuing the request on events (player types "-load"), one with periodic timer checking for the "string* response" to be != empty string.
    Ideally, only host would do the requests, to avoid multiple identical requests; then, on response, the variable would be filled and sync across other players.

    Edit: unique identifier would be sent every request as his current in-game username, period.
    Point is to identify who is asking and be able to implement, for instance, a codeless, name sensitive, identifier sensitive save/load system.

    As "name:blufflegendaire+identifier:2028AZ" would be an unique pair, allowing people to share aliases/names and yet not overlapping over saves.
     
  9. TriggerHappy

    TriggerHappy

    Code Moderator

    Joined:
    Jun 23, 2007
    Messages:
    3,684
    Resources:
    22
    Spells:
    11
    Tutorials:
    2
    JASS:
    9
    Resources:
    22
    @blufflegendaire I doubt Blizzard will allow us to communicate to outside websites.

    What makes more sense is if Blizzard does it how they already do in China (netease), and provide a JASS API that allows you to store data in a key/value system for your map on official servers. Then, Blizzard could make a web API to make that data retrievable.

    These are the natives they use in China which allow users to load characters without typing a code. There are others which allow you to create your own ladder rankings, and you can even display some of this data in the game lobby before the match starts.

    Code (vJASS):
    native DzAPI_Map_SaveServerValue takes player whichPlayer,string key,string value returns boolean
    native DzAPI_Map_GetServerValue takes player whichPlayer,string key returns string

    However if Blizz decides to implement HTTP requests I propose it works like this.
     
    Last edited: Jan 26, 2018
  10. DoctorGester

    DoctorGester

    Joined:
    Dec 6, 2009
    Messages:
    76
    Resources:
    3
    Maps:
    2
    JASS:
    1
    Resources:
    3
    Why would you do it like that? Wouldn't it be simply saner to pass a code reference like all asynchronous functions already do?
    Web requests are important for stuff like keeping stats, just look at how much stuff came from being able to execute code in dota 2 custom games. Whole stat libraries and website helping creators track their games and balance them. I think everyone wants to know how much their game is actually being played.
     
  11. TriggerHappy

    TriggerHappy

    Code Moderator

    Joined:
    Jun 23, 2007
    Messages:
    3,684
    Resources:
    22
    Spells:
    11
    Tutorials:
    2
    JASS:
    9
    Resources:
    22
    Yeah that would make more sense.

    Code (vJASS):
    native TriggerRegisterWebResponseEvent takes trigger whichTrigger, string uri, string headers returns nothing
    native GetEventWebResponse takes nothing returns string

    Yeah but like I said in the previous post, if Blizzard did it how they are already doing it in China, all of what you're saying would be possible.

    Web requests from JASS could be used to DDOS or who knows what else. It just seems like more of a hassle to implement safely.
     
    Last edited: Jan 27, 2018
  12. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,722
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    The host cannot execute JASS. It is a coordination server.
    So this native already exists in the Chinese install of WC3? Please elaborate.

    If it was recently added to China patches of WC3 then it will soon be added to the rest of the world. Be aware that a lot of Asia uses third party mods of WC3 which might have unofficially changed the available JASS natives.

    This is the first time I am hearing of this which is why I am sceptical. Such features usually make the front news page of THW when they are released.
     
  13. TriggerHappy

    TriggerHappy

    Code Moderator

    Joined:
    Jun 23, 2007
    Messages:
    3,684
    Resources:
    22
    Spells:
    11
    Tutorials:
    2
    JASS:
    9
    Resources:
    22
    Chinese players don't use Battle.net and have their own platform (netease). This platform provides the extra natives for people who use it, and it has been around for some time now.

    首页-魔兽争霸官方对战平台
     
  14. Kam

    Kam

    Joined:
    Aug 3, 2004
    Messages:
    2,632
    Resources:
    23
    Models:
    8
    Icons:
    2
    Maps:
    13
    Resources:
    23
    We have added a large number of natives for 1.29.0. I'll update here when we have a final list.

    I will then work with you all to make part two based on what was added and what you still need.
     
  15. KILLCIDE

    KILLCIDE

    Administrator

    Joined:
    Jul 22, 2015
    Messages:
    3,504
    Resources:
    20
    Models:
    2
    Icons:
    10
    Spells:
    7
    Tutorials:
    1
    Resources:
    20
  16. Wareditor

    Wareditor

    Joined:
    Jan 16, 2009
    Messages:
    681
    Resources:
    3
    Maps:
    3
    Resources:
    3
    So good to hear! Can't wait :D
     
  17. HappyTauren

    HappyTauren

    Joined:
    Nov 3, 2006
    Messages:
    8,412
    Resources:
    87
    Models:
    61
    Icons:
    23
    Packs:
    1
    Tutorials:
    2
    Resources:
    87
    IT'S HAPPENING
     
  18. Kyrbi0

    Kyrbi0

    Joined:
    Jul 29, 2008
    Messages:
    7,935
    Resources:
    1
    Models:
    1
    Resources:
    1
    [​IMG]
     
  19. HappyTauren

    HappyTauren

    Joined:
    Nov 3, 2006
    Messages:
    8,412
    Resources:
    87
    Models:
    61
    Icons:
    23
    Packs:
    1
    Tutorials:
    2
    Resources:
    87
    can't sleep now
     
  20. Kyrbi0

    Kyrbi0

    Joined:
    Jul 29, 2008
    Messages:
    7,935
    Resources:
    1
    Models:
    1
    Resources:
    1
    It's hard to believe i t ' s h a p p e n i n g