1. The Melee Mapping Contest #4: 2v2 - Results are out! Step by to congratulate the winners!
    Dismiss Notice
  2. We're hosting the 15th Mini-Mapping Contest with YouTuber Abelhawk! The contestants are to create a custom map that uses the hidden content within Warcraft 3 or is inspired by any of the many secrets within the game.
    Dismiss Notice
  3. The 20th iteration of the Terraining Contest is upon us! Join and create exquisite Water Structures for it.
    Dismiss Notice
  4. Check out the Staff job openings thread.
    Dismiss Notice

Warcraft III - Patch 1.31 PTR

Discussion in 'Latest Updates and News' started by TriggerHappy, Apr 24, 2019.

  1. EvilNico

    EvilNico

    Joined:
    Jul 16, 2008
    Messages:
    23
    Resources:
    0
    Resources:
    0
    Some kind of nonsense from my map was completely erased base of import, when it was opened in the editor and after editing I tried to save my map, but I wrote that it was impossible to save, I paid attention to the way C \ which I opened was completely removed without my permission by the editor, it was only possible to save the version that was opened in the editor to the desktop, however, it was saved without import, it is partially missing. NEGATIVE .

    Pay attention in the old version, everything is fine, but the new one is ruined by imports and not only.

    communication is broken if you open it, then my hero for some reason shoots buildings.

    And buildings that were neutral became enemy units. All he did was open the map in the new version of the editor and re-save. And the original map from where it opened the editor for some reason deleted it and erased it from the C drive where it lay. why does the editor take action without my approval?
     

    Attached Files:

    Last edited: Apr 28, 2019
  2. EvilNico

    EvilNico

    Joined:
    Jul 16, 2008
    Messages:
    23
    Resources:
    0
    Resources:
    0
    The editor deleted my working version of my map without errors from the C drive and left me a broken version of the map with errors, which for some reason refused to save at the beginning when I saved not just re-save the map.


    Disgusting version of the editor. The editor is constantly knocking out. There is not even a syntax highlighting code. JNGP is much better and fewer departures when
     
  3. Tasyen

    Tasyen

    Joined:
    Jul 18, 2010
    Messages:
    1,122
    Resources:
    13
    Tools:
    2
    Maps:
    2
    Spells:
    7
    Tutorials:
    1
    JASS:
    1
    Resources:
    13
    In most maps no unit uses attacktype spell as attack and attacks allways have damage type normal. Therefore with the restriction to not use attacktype spell for attacks one should be able to detect damage from attacks by something like that:

    Code (vJASS):

    function OnDamage takes nothing returns nothing
       //not attacktype spell and damage Normal.
       if BlzGetEventAttackType  () != ATTACK_TYPE_NORMAL and BlzGetEventDamageType() == DAMAGE_TYPE_NORMAL then
    //Debug Print msg
           call BJDebugMsg("AttackDamage: "+GetUnitName(GetEventDamageSource())+" -> "+GetUnitName(GetTriggerUnit()))
       endif

    endfunction

    //===========================================================================
    function InitTrig_Unbezeichneter_Ausl__ser_001 takes nothing returns nothing
       local trigger trig = CreateTrigger()
           call TriggerRegisterAnyUnitEventBJ( trig, EVENT_PLAYER_UNIT_DAMAGED )
        call TriggerAddAction( trig, function OnDamage)
    endfunction

     
     
  4. Rui

    Rui

    Joined:
    Jan 7, 2005
    Messages:
    8,402
    Resources:
    8
    Maps:
    8
    Resources:
    8
    Will LUA perform better? As I recall, you said JASS2 was converted to some crappy bytecode. Hopefully, the same does not happen with LUA?
     
  5. IcemanBo

    IcemanBo

    Joined:
    Sep 6, 2013
    Messages:
    6,098
    Resources:
    22
    Maps:
    3
    Spells:
    11
    Template:
    1
    Tutorials:
    4
    JASS:
    3
    Resources:
    22
    Bytecode is needed, it's like virtual machine code, so the only code the JASS- or Lua VM (virtual machine) can read. So maybe it's not necessarily faster, but depends how the VM is built.
     
  6. lolreported

    lolreported

    Joined:
    Aug 16, 2007
    Messages:
    674
    Resources:
    10
    Tools:
    1
    Maps:
    3
    Spells:
    6
    Resources:
    10
    I've attached a 10s video of recorded 144 fps footage of the live version of the game.

    I went frame by frame in VLC, but I'm not sure how to properly make the decision if it's unique frames or not. The models appears to run and update at a lower fps, but cursor and "patrol-command-point"-model appears to be updated every frame of 144 frames?
     

    Attached Files:

  7. lolreported

    lolreported

    Joined:
    Aug 16, 2007
    Messages:
    674
    Resources:
    10
    Tools:
    1
    Maps:
    3
    Spells:
    6
    Resources:
    10
    I've also done some experimenting with the new abilityfield natives; trying to change the ability hotkey at runtime. Unfortunately it appears to be impossible.

    It's easy enough to change other fields, such as Cast Range, etc. I've not found any issues with these natives so far.

    You can call any "Set" integer/string/real/boolean native for any fieldID, it will not crash the game and simply not work if the fieldID is of another type.

    I've not done any testing with the "LevelArray" natives, but I'd guess these are for "Buffs" and "Targets Allowed" fieldIDs, with multiple selections.

    JASS
    Code (vJASS):

    function ChangeAbilityFieldTest_Actions takes nothing returns nothing

        /*
        native BlzSetAbilityBooleanLevelField              takes ability whichAbility, abilitybooleanlevelfield whichField, integer level, boolean value returns boolean
        native BlzSetAbilityIntegerLevelField              takes ability whichAbility, abilityintegerlevelfield whichField, integer level, integer value returns boolean
        native BlzSetAbilityRealLevelField                 takes ability whichAbility, abilityreallevelfield whichField, integer level, real value returns boolean
        native BlzSetAbilityStringLevelField               takes ability whichAbility, abilitystringlevelfield whichField, integer level, string value returns boolean
        */


        local unit u = gg_unit_Hpal_0000

        local integer abilID = 'Amls' // Aerial Shackles
        //local integer fieldID = 'ahky' // Ability Hotkey FieldID in Object Editor (doesn't appear to work)
        local integer fieldID = 'aran' // Ability Cast Range FieldID in Object Editor

        local integer integerValue = 1231
        local string stringValue = "D"
        local real realValue = 9999.0

        call DisplayTimedTextToForce( GetPlayersAll(), 30, "fieldID: " + I2S(fieldID)) // 'ahky' returns 1634233209

        call BlzSetAbilityIntegerLevelField( BlzGetUnitAbility(u, abilID), ConvertAbilityIntegerLevelField(fieldID), 1, integerValue)
        call DisplayTimedTextToForce( GetPlayersAll(), 30, "Int Field: " + I2S(BlzGetAbilityIntegerLevelField( BlzGetUnitAbility(u, abilID), ConvertAbilityIntegerLevelField(fieldID), 0) ))

        call BlzSetAbilityStringLevelField( BlzGetUnitAbility(u, abilID), ConvertAbilityStringLevelField(fieldID), 1, stringValue)
        call DisplayTimedTextToForce( GetPlayersAll(), 30, "String Field: " + BlzGetAbilityStringLevelField( BlzGetUnitAbility(u, abilID), ConvertAbilityStringLevelField(fieldID), 0) )

        call BlzSetAbilityRealLevelField( BlzGetUnitAbility(u, abilID), ConvertAbilityRealLevelField(fieldID), 1, realValue)
        call DisplayTimedTextToForce( GetPlayersAll(), 30, "Real Field: " + R2S(BlzGetAbilityRealLevelField( BlzGetUnitAbility(u, abilID), ConvertAbilityRealLevelField(fieldID), 0) ))

        set u = null
    endfunction

    //===========================================================================
    function InitTrig_ChangeAbilityFieldTest takes nothing returns nothing
        local trigger t = CreateTrigger( )
        call TriggerRegisterPlayerChatEvent( t, Player(0), "t", true )
        call TriggerAddAction( t, function ChangeAbilityFieldTest_Actions )
    endfunction
     


    Maybe it's already mentioned, but there's a bug (I'd asume atleast) with all "Get" natives, such as
    native BlzGetAbilityIntegerLevelField              takes ability whichAbility, abilityintegerlevelfield whichField, integer level returns integer

    where the "integer level" argument must be 1 lower than the targeted level (i.e. 0 = 1 and 1 = 2, etc). The "Set" natives doesn't have this issue and works differently (i.e. level 1 = 1 and 2 = 2, etc).
     
    Last edited: Apr 28, 2019
  8. Rui

    Rui

    Joined:
    Jan 7, 2005
    Messages:
    8,402
    Resources:
    8
    Maps:
    8
    Resources:
    8
    I meant to ask if LUA bytecode is less crappy than JASS2 bytecode :p
     
  9. Ardenaso

    Ardenaso

    Joined:
    Jun 22, 2013
    Messages:
    291
    Resources:
    0
    Resources:
    0
    But patch the latest patch works perfectly fine though, so I assume that it won't be different anymore here. But I guess I'll just find out how to get more memory to my laptop.
     
  10. deepstrasz

    deepstrasz

    Map Reviewer

    Joined:
    Jun 4, 2009
    Messages:
    9,223
    Resources:
    1
    Maps:
    1
    Resources:
    1
    It might be related to Reforged.
     
  11. WeirdEditor

    WeirdEditor

    Joined:
    May 10, 2018
    Messages:
    108
    Resources:
    0
    Resources:
    0
    Most Maps must exclude DotA, one of the most famous maps on war3.
    Code (vJASS):

    function V08 takes unit Z77,unit X77,integer V58,real P08 returns nothing
    if V58==AA4 then
    return
    endif
    if V58==AB4 then
    call UnitDamageTarget(Z77,X77,P08,true,true,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_FIRE,WEAPON_TYPE_WHOKNOWS)
    elseif V58==AC4 then
    call UnitDamageTarget(Z77,X77,P08,true,true,ATTACK_TYPE_HERO,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
    elseif V58==A34 then
    call UnitDamageTarget(Z77,X77,P08,true,true,ATTACK_TYPE_HERO,DAMAGE_TYPE_MAGIC,WEAPON_TYPE_WHOKNOWS)
    elseif V58==A64 then
    call UnitDamageTarget(Z77,X77,P08,true,true,ATTACK_TYPE_PIERCE,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
    elseif V58==AL4 then
    call UnitDamageTarget(Z77,X77,P08,true,true,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
    elseif V58==A14 then
    call SetUnitState(X77,UNIT_STATE_LIFE,RMaxBJ(GetUnitState(X77,UNIT_STATE_LIFE)-P08,1))
    if GetUnitState(X77,UNIT_STATE_LIFE)<2 then
    call UnitRemoveBuffs(X77,true,true)
    call UnitRemoveAbility(X77,'Aetl')
    call UnitDamageTarget(CreateUnit(GetOwningPlayer(Z77),'e00E',0,0,0),X77,100000000.,true,false,ATTACK_TYPE_MELEE,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
    endif
    elseif V58==A04 then
    if GetUnitAbilityLevel(X77,'Aetl')>0 or GetUnitAbilityLevel(X77,'B01N')>0 then
    call UnitDamageTarget(Z77,X77,P08,true,true,ATTACK_TYPE_HERO,DAMAGE_TYPE_MAGIC,WEAPON_TYPE_WHOKNOWS)
    else
    call UnitDamageTarget(Z77,X77,P08,true,true,ATTACK_TYPE_HERO,DAMAGE_TYPE_UNIVERSAL,WEAPON_TYPE_WHOKNOWS)
    endif
    elseif V58==AA94 then
    call UnitDamageTarget(Z77,X77,P08,true,true,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_UNIVERSAL,WEAPON_TYPE_WHOKNOWS)
    endif
    endfunction
     
     
  12. MyPad

    MyPad

    Spell Reviewer

    Joined:
    May 9, 2014
    Messages:
    1,243
    Resources:
    5
    Models:
    1
    Icons:
    1
    Spells:
    2
    JASS:
    1
    Resources:
    5
    For those willing to test out the unit fields, I'll leave a test map, which makes watching unit fields easier.

    @Kam...
     

    Attached Files:

  13. Death Adder

    Death Adder

    Joined:
    Nov 3, 2013
    Messages:
    879
    Resources:
    0
    Resources:
    0
    And what about ranged attacks? Unless there's no projectile simply using a DDS won't work.

    Also, iirc DDS don't register missed attacks.


    Anyway, this along with some other listed features which I've been eagerly waiting for and expected from 1.31 still haven't been added... But the things listed on Producer Update: Natives List are meant to be added at some point, right?

    It's fine so long as it gets added soon™.

    Code (vJASS):
        constant unitevent EVENT_UNIT_DAMAGE_RELEASE        
           //This triggers when a unit's attack is released, aka when a melee unit hits its target or a ranged unit launches a missile.
     
  14. TriggerHappy

    TriggerHappy

    Code Moderator

    Joined:
    Jun 23, 2007
    Messages:
    3,607
    Resources:
    22
    Spells:
    11
    Tutorials:
    2
    JASS:
    9
    Resources:
    22
    The war3map.w3i format changed. I wrote a converter but it only works one way. You shouldn't be uploading PTR maps to epicwar anyway.

    For those of you who want to play with Lua this is what I use.

    JNGP Lua Edition - Combining JASS/vJass/Lua

    It allows you to combine JASS and Lua. You can also code in external editors wile having the World Editor open. Hopefully Blizzard implements something similar natively. All we to would need to use Lua from code editors is the ability to include other Lua files from within the map's MPQ.

    [​IMG]

    I'll be releasing my VS Code setup soon.
     

    Attached Files:

    Last edited: Apr 28, 2019
  15. WeirdEditor

    WeirdEditor

    Joined:
    May 10, 2018
    Messages:
    108
    Resources:
    0
    Resources:
    0
    Blizzard please fix this ASAP, in case this bug would become a feature in the next version for campatibility!
     
  16. Tasyen

    Tasyen

    Joined:
    Jul 18, 2010
    Messages:
    1,122
    Resources:
    13
    Tools:
    2
    Maps:
    2
    Spells:
    7
    Tutorials:
    1
    JASS:
    1
    Resources:
    13
    ranged attacks use the same damage type, I don't see a problem for simple ranged attacks. Problem could be splash/multitarget/bouncing ranged attacks, cause that way one can not differ between main target and additional targets, without additional effort.

    I also don't see any good/simple way to detect missed attacks with damage events, currently.


    When you deal the damage with code, you have the power to prevent your own code-damage seen as attack by adding with low additional effort. But none of the built in spells/actions will be miss interpreted, cause the don't inflict dat attacktype damagetype combo, only attacks do.


    The GUI getters of unit weapons use the wrong field options.
     
    Last edited: Apr 28, 2019
  17. Trill

    Trill

    Joined:
    Feb 24, 2018
    Messages:
    249
    Resources:
    1
    Icons:
    1
    Resources:
    1
    Holy @#$%!!!
    Integrated text colorizer!

    Also Ritual Dagger ability can apparently can be modified into AoE heal centered on target, either instant or periodic, and it doesn't necessarily has to kill the target! Very useful.

    Funny thing is that ability of new Orb of Fire is called "Shadow Meld (item) and its fields are named after Shadow Meld fields, except they have values of OfF ability and it has projectile and orb sfx. I wonder if I tick fields that have nothing to do with Orb of Fire, like "Permanent Cloak"...
     
  18. Death Adder

    Death Adder

    Joined:
    Nov 3, 2013
    Messages:
    879
    Resources:
    0
    Resources:
    0
    Well the thing is that a DDS registers when you deal damage, not when you fire whatever projectile you're shooting.

    i.e. with a dds you can detect when a projectile hits, but not when it's shot.
     
  19. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,257
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    Please do not distribute 1.31 PTR maps since they might not be compatible with 1.31 release. For now it is only for testing. Also report that issue to EpicWar.
    And what should this conversion do? Or are you asking for a native to convert from an ability to its Ability Type ID?
    Your "good" map is corrupt. When I try opening it in WorldEdit it tries to request 180GB of memory. Only enterprise level hardware (AMD ThreadRipper, Intel Xenon) can have that much memory and nothing one can make in Warcraft III should ever need that much memory anyway.

    If you "protected" your map, please post the unprotected version to confirm that it corrupts on map save with the 1.31 PTR editor. If you are uncomfortable handling it to the public, consider sending it to Kam (Will is on holiday ATM) along with the steps needed to reliably to recreate the corruption.
    All such languages work via bytecode. Even Java, a serious programming language, does.

    Inherently performance should be similar since both use runtime resolution of types and such. However Lua might be faster due to it being a lot more mature and maintained than JASS2.

    Technically Lua can be a lot faster if a JIT compiling virtual machine is used. However Will has confirmed that they are using the standard Lua implementation (not JIT compiler) due to requiring the use of other libraries to serialize the Lua state for save/load game support. They might look into JIT Lua support if needs dictate it, but currently they do not.

    That said some tasks Lua will perform a lot better than JASS due to how the language works and what the language supports inherently. For example passing functions around dynamically is trivial for Lua but with JASS2 needed some very complex hacky code such as using triggers or passing around function name strings. There is also no limit to table size and Lua tables likely perform better with large mapping counts compared with hashtables. Functionally there is no reason to use hashtable in Lua since Lua natively offers better functionality. Lua also has built in bitwise operators which will almost certainly be faster than the newly added JASS2 natives to achieve the same results.

    Where Lua will be slower is due to its garbage collector. JASS did not really have a serious one since most JASS related data, other than handles, was static and declared at map initialization. Lua on the other hand can incure significant overhead if one abuses creating lots of tables which will eventually be garbage collected. However one can fine tune the garbage collector and through careful programming one can also reduce the amount of garbage produced if the collector performance does become an issue.

    Lua has fantastic error reporting. If a native function call fails it will throw an error which one can catch and print. This alone makes it a lot better than JASS2 to work with since what used to take 30 minutes of trial and error to diagnose could be discovered the instance it is encountered. For people using Lua I strongly recommend taking advantage of this error reporting when developing code as it could save you a lot of time without much overhead. You can even log such errors in production code if you want!
    It is not JIT compiling. It is more mature so possibly more optimized.
    Use the lower frame rate then. The unit models are the most important thing since they represent the action and unless they are smooth at 144Hz having something else appear smooth is not useful as it will appear inconsistent.

    In any case I guess we could add high refresh rate support to the list of desired features. However this may or many not be possible depending on how the game is designed as perhaps it is not possible interpolate animations between frames like how StarCraft II works to achieve smooth high refresh rate animation.
    The x86-64 build will use more memory due to larger pointer sizes (64bit vs 32bit). Additionally like all other current Blizzard games they might drop support for D3D9 and x86 in the future.
     
  20. Neveralice

    Neveralice

    Joined:
    Feb 27, 2015
    Messages:
    8
    Resources:
    0
    Resources:
    0
    I was trying to use this function in our shiny new Lua script.
    Code (Lua):
    print(BlzGetAbilityTooltip('AHfs', 1))
    It gave no output and crashed the rest of the calling function.
    I found these lines in the common.j file. The AbilityId function always gives 0, whatever the input.
    Code (vJASS):
    // Not currently working correctly...
    constant native AbilityId                   takes string  abilityIdString   returns integer
    constant native AbilityId2String            takes integer abilityId         returns string
    So I decided to do it myself. I thought this would work, but it just gives me "Tooltip missing!"
    Code (Lua):
    function GetAbilityID (code)
        local length = #code
        if length == 4 then
            local id = 0
            for i = 1, length do
                id = id + (256 ^ (length - i)) * code:byte(i)
            end
            return id | 0
        else
            return 0, 'Error: ' .. code .. ' is not an ability!'
        end
    end
    print(BlzGetAbilityTooltip(GetAbilityID('AHfs'), 1))
    After some debugging, I found the issue. In the standalone Lua interpreter, the function call gives the expected value 1095263859. But in game, it gives 1095263744.
    Code (Lua):
    print(GetAbilityID('AHfs'))
    I suspect the error is related to the floating point numbers. It is. The following version works correctly.
    Code (Lua):
    function GetAbilityID (code)
        local length = #code
        if length == 4 then
            local id = 0
            for i = 1, length do
                -- Must convert floats to integers, or there will be severe rounding errors
                id = id + (256 ^ (length - i) | 0) * code:byte(i)
            end
            return id
        else
            return 0, 'Error: ' .. code .. ' is not an ability!'
        end
    end
    My conclusion:
    1. Automatic conversion from ability ID string to integer does not work in Lua scripts
    2. There are some subtle bugs in the new Lua VM related to floating point numbers
    3. Integer and Real types are not indistinguishable even in Lua scripts
     
    Last edited: Apr 28, 2019