1. Find your way through the deepest dungeon in the 18th Mini Mapping Contest Poll.
    Dismiss Notice
  2. A brave new world lies beyond the seven seas. Join the 34th Modeling Contest today!
    Dismiss Notice
  3. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
Hive 3 Remoosed BETA - NOW LIVE. Go check it out at BETA Hive Workshop! Post your feedback in this new forum BETA Feedback.
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. lan nguyen

    lan nguyen

    Joined:
    Feb 14, 2018
    Messages:
    34
    Resources:
    0
    Resources:
    0
    I mean remove the delete and add another ability to level up a skill
    Sr my bad english
     
  2. Dark-Zalor

    Dark-Zalor

    Joined:
    Oct 10, 2011
    Messages:
    235
    Resources:
    12
    Maps:
    12
    Resources:
    12
    Code (vJASS):


    // UNIT SECTION
    // By Upgrades I mean bonuses to units for examples damages displayed in green on a unit
    function SetUnitAttackDamageUpgrade takes unit u, integer index, integer upgrade returns nothing    //Changes the bonus damages given to the unit
    function GetUnitAttackDamageUpgrade takes unit u, integer index, returns integer    //Get the amount of bonus damages

    function SetUnitArmorUpgrade takes unit u, integer upgrade returns nothing    //Changes the bonus armor given to the unit
    function GetUnitArmorUpgrade takes unit u returns integer    //Get the amount of bonus armor

    //(not sure if attackspeed work just on one type of attack, with index 1 for exemple)
    function SetUnitAttackSpeed takes unit u, integer index, integer bonus returns nothing    //Changes the attack Speed of a unit
    function GetUnitAttackSpeed takes unit u, integer index returns integer    //Get the unit attack Speed

    function SetUnitAcquisitionRange takes unit u, integer range returns nothing
    function GetUnitAcquisitionRange takes unit u returns integer

    function GetUnitCollisionSize takes unit u returns real
    function SetUnitCollisionSize takes unit u, real size returns nothing

    function UnitDisableSpells takes unit u, boolean flag returns nothing    //Silence a unit if the flag == true

    function IsUnitSilenced takes unit u returns boolean //Return true if the unit is silenced

    function AddHeroAbility takes unit u, integer id returns nothing // Add a spell to a hero that can be learnable

    function GetUnitBountyGoldBase takes unit u returns integer
    function GetUnitBountyGoldDiceNumber takes unit u returns integer
    function GetUnitBountyGoldDiceSide takes unit u returns integer
    function SetUnitBountyGoldBase takes unit u, integer amount returns nothing
    function SetUnitBountyGoldDiceNumber takes unit u, integer amount returns nothing
    function SetUnitBountyGoldDiceSide takes unit u, integer amount returns nothing

    function GetUnitBountyWoodBase takes unit u returns integer
    function GetUnitBountyWoodDiceNumber takes unit u returns integer
    function GetUnitBountyWoodDiceSide takes unit u returns integer
    function SetUnitBountyWoodBase takes unit u, integer amount returns nothing
    function SetUnitBountyWoodDiceNumber takes unit u, integer amount returns nothing
    function SetUnitBountyWoodDiceSide takes unit u, integer amount returns nothing

    // these two functions are only available on events EVENT_PLAYER_UNIT_DEATH or EVENT_UNIT_DEATH to get the amount of bounty calculated by the game when a player kill a unit.
    function GetBountyGoldGiven takes nothing returns integer // the amount of gold calculated with base bonus and dice given to the player that killed the unit.
    function GetBountyWoodGiven takes nothing returns integer // the amount of wood calculated with base bonus and dice given to the player that killed the unit.

    // SPELLS SECTION
    // it could be intresting to use that following functions on specific spells on units and not only for abilityid
    function SetAbilityOrder takes integer id, takes string order returns nothing
    function GetAbilityOrder takes integer id returns string
    function SetAbilityLearningKey takes integer id, takes string spellKey returns nothing
    function GetAbilityLearningKey takes integer id returns string
    function SetAbilityKey takes integer id, takes string spellKey returns nothing
    function GetAbilityKey takes integer id returns string
    function SetAbilityUnactivateKey takes integer id, takes string spellKey returns nothing
    function GetAbilityUnactivateKey takes integer id returns string

    // Only works for channel abilities
    constant spelltarget TARGET_SPELL_LOCATION //the spell target a location (shockwave)
    constant spelltarget TARGET_SPELL_UNIT    //the spell target units (thunderbolt)
    constant spelltarget TARGET_SPELL_INSTANT  //the spell is instant (stomp)
    constant spelltarget TARGET_SPELL_TARGET   // the spell can target units or location

    function SetAbilityTarget takes integer id, takes spelltarget target returns nothing
    function GetAbilityTarget takes integer id returns spelltarget

    function IsSpellActivated takes integer id, takes unit u returns boolean // return true is spell is activated (mana shield, immolation, defense, ...)
    function IsSpellAutoCast takes integer id, takes unit u returns boolean // return true is spell is auto cast (slow, bloodlust, ice arrow, ...)

     
     
    Last edited: May 12, 2018
  3. MyPad

    MyPad

    Spell Reviewer

    Joined:
    May 9, 2014
    Messages:
    1,562
    Resources:
    9
    Models:
    1
    Icons:
    2
    Maps:
    2
    Spells:
    3
    JASS:
    1
    Resources:
    9
    A nice list of natives, I would say. The most useful natives insofar in the list are the bounty base getters and setters. With that in place, I would like to add some to the list...

    Code (WurstScript):

    function unittype.getBountyGold() returns int
    function unittype.setBountyGold(int newVal)

    ...
    // Basically, these are getters and setters for the unit type, not unit.

    function unit.revive() returns bool
    // Will return false if unit's alive or out of scope.

     
     
  4. Novena Espada

    Novena Espada

    Joined:
    Sep 25, 2016
    Messages:
    47
    Resources:
    2
    Maps:
    2
    Resources:
    2
    Could you please solve a problem which is some models imorted into the map has only an outline of their form? All or some of their .blp files shown nothing but shadows in both of the game and WE.
     
  5. Kaijyuu

    Kaijyuu

    Joined:
    Jun 2, 2004
    Messages:
    848
    Resources:
    0
    Resources:
    0
    That sounds more like a problem with the models and textures and not anything wrong with the game itself.
     
  6. Novena Espada

    Novena Espada

    Joined:
    Sep 25, 2016
    Messages:
    47
    Resources:
    2
    Maps:
    2
    Resources:
    2
    Well, I do not think so. Because all the models I said can be utilized normally in 1.24, 1.27 and so on. Only in 1.29, they are nothing but shadows.
     
  7. dtnmang

    dtnmang

    Joined:
    Apr 20, 2010
    Messages:
    562
    Resources:
    12
    Models:
    5
    Maps:
    2
    Ported Models:
    1
    Tutorials:
    4
    Resources:
    12
    It's because your imported BLP texture uses fake mipmaps (to cut down filesize of the custom BLP). Open the BLP file in BLP Lab with File information turned on so you can see how many fake mipmaps it has. When converting an image to BLP format you can set the mipmap count. The minimum number of real mipmaps you need for a BLP is Logarithm base 2 of the largest dimension plus 1. So if you have a 512x256 TGA file you can set the mipmap count to 10 (b/c log base 2 of 512 is 9, then add 1 to make 10) which will make the result BLP file use all real mipmaps.

    Clipboard01.png
     
    Last edited: Apr 24, 2018
  8. Novena Espada

    Novena Espada

    Joined:
    Sep 25, 2016
    Messages:
    47
    Resources:
    2
    Maps:
    2
    Resources:
    2
    Thank you very much, I'll have a try.
     
  9. Rui

    Rui

    Joined:
    Jan 7, 2005
    Messages:
    8,529
    Resources:
    8
    Maps:
    8
    Resources:
    8
    I've been out of the loop, so forgive my ignorance, but is this different from
    native SetUnitAcquireRange takes unit whichUnit, real newAcquireRange returns nothing
    ?

    I'd also like to propose:

    Code (vJASS):
    function UnitSilenceItems takes unit u, boolean flag returns nothing //Prevents a unit from using item abilities when flag == true
    function UnitMuteItems takes unit u, boolean flag returns nothing //Prevents a unit from benefiting from any item stats when flag == true
    function IsUnitItemSilenced takes unit u returns boolean
    function IsUnitedItemMuted takes unit u returs boolean

    //Alternatively, though it'd require additional work when the use case is a spell that silences/mutes all items:
    function ItemSilence takes item m, boolean flag returns nothing //Prevents units from using m's abilities when flag == true
    function ItemMute takes item m, boolean flag returns nothing //Prevents units from benefiting off stats offered by m when flag == true
    function IsItemSilenced takes item m, returns boolean
    function IsItemMuted takes item m, returns boolean
     
    Last edited: May 12, 2018
  10. MyPad

    MyPad

    Spell Reviewer

    Joined:
    May 9, 2014
    Messages:
    1,562
    Resources:
    9
    Models:
    1
    Icons:
    2
    Maps:
    2
    Spells:
    3
    JASS:
    1
    Resources:
    9
    This has been missing for quite a long time, so I'll propose the following things:

    Code (WurstScript):

    native SetUnitAttackRange(unit whichUnit, int index, int newRange)
    native GetUnitAttackRange(unit whichUnit, int index)

    unitevent EVENT_UNIT_ATTACK_RELEASE
    playerunitevent EVENT_PLAYER_UNIT_ATTACK_RELEASE
     
    However, the list of natives that we have obtained as of this major patch (v.1.29) is quite an enormous load of natives that would surely keep us content for a while if properly implemented.
     
  11. Wrda

    Wrda

    Joined:
    Nov 18, 2012
    Messages:
    1,317
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    SetUnitAcquireRange and GetUnitAcquireRange already exists, as stated before.
    How is UnitDisableSpells supposed to work? Affect all abilities? Shouldn't it be called "UnitSilenceSpells" since "disable" looks like another thing?
    What would IsUnitSilenced return if the "UnitSilenceSpells" is set to false but the unit has the "silenced" buff?
    Sounds like this can be just achieved better with the silence ability.
    Rest of the natives are great.

    I guess we would have then
    Code (vJASS):
    native IsUnitItemSilenced takes unit returns boolean //Returns true when unit can't use item abilities
    //Same for UnitMuteItems
    But what would "IsUnitItemSilenced" return if it returns false and unit has "silence" buff, like I said above?
    Also please write the new natives like Dark-Zalor and everyone else, it's easier to read and understand.
     
  12. _Guhun_

    _Guhun_

    Joined:
    Jun 12, 2010
    Messages:
    395
    Resources:
    7
    Spells:
    6
    Tutorials:
    1
    Resources:
    7
    Please add:

    Code (vJASS):

    native GetUnitAnimationIndex takes unit whichUnit, string animation returns integer
     


    Right now, there is no way to make a unit play the 'walk' animation while not moving, except:
    SetUnitAnimationByIndex
    , and there is no way to know which animation index the walk animation is for a certain unit.

    If this were possible, it would be awesome!

    EDIT: Would also be nice to have a way to know which animation tags (eg. upgrade, first, alternate) a unit currently has, as a string with each tag separated by spaces, so we could do:

    SetUnitAnimation(u, "stand" + GetUnitAnimationProperties(u))
     
    Last edited: May 11, 2018
  13. Wareditor

    Wareditor

    Joined:
    Jan 16, 2009
    Messages:
    681
    Resources:
    3
    Maps:
    3
    Resources:
    3
    @_Guhun_
    You can iterate trough each animation index to get the animation index of any animation. I believe you can also open the model in a model editor software and check the index there but I am not sure.
     
  14. _Guhun_

    _Guhun_

    Joined:
    Jun 12, 2010
    Messages:
    395
    Resources:
    7
    Spells:
    6
    Tutorials:
    1
    Resources:
    7
    Yeah, you can do that, but then you will only be able to play the animation for 1 model, since you can't do that programatically in-game (there's no way to get which index corresponds to which animation string, so you have to do it manually). If you want to play it for ANY model, you will need to save the correct index in a hashtable for EVERY unit type in the map, which could take a while and is pretty annoying to maintain if you add new unit types constantly (which is basically my case =3).
     
  15. Abovegame

    Abovegame

    Joined:
    Jan 2, 2016
    Messages:
    465
    Resources:
    1
    Maps:
    1
    Resources:
    1
    The bounty natives should take a unit type not an unit. Basically reference the field in the OE.

    Nonetheless these natives could be very useful, perhaps some natives that retrieve item cost as well ?
     
  16. Dark-Zalor

    Dark-Zalor

    Joined:
    Oct 10, 2011
    Messages:
    235
    Resources:
    12
    Maps:
    12
    Resources:
    12
    I think the method BlzSetSpecialEffectX does not work (I mean there is no changes) on version 1.29.2.9231, I made a few tests and it is not working. Does anyone has the same problem.
     
  17. Wareditor

    Wareditor

    Joined:
    Jan 16, 2009
    Messages:
    681
    Resources:
    3
    Maps:
    3
    Resources:
    3
    @Dark-Zalor It has been reported already (the Y doesn't work too but the Z does).
     
  18. Rui

    Rui

    Joined:
    Jan 7, 2005
    Messages:
    8,529
    Resources:
    8
    Maps:
    8
    Resources:
    8
    Unit abilities and item abilities should be treated differently, so the silence buff should be irrelevant for the inner workings of this function.

    EDIT: Revised proposals:
    Code (vJASS):
    function UnitSilenceItems takes unit u, boolean flag returns nothing //Prevents a unit from using active item abilities when flag == true
    function UnitSilenceItemPassives takes unit u, boolean flag returns nothing
    function UnitMuteItems takes unit u, boolean flag returns nothing //Prevents a unit from benefiting from any item stats when flag == true
    function IsUnitItemSilenced takes unit u returns boolean
    function IsUnitItemMuted takes unit u returs boolean

    //Alternatively, though it'd require additional work when the use case is a spell that silences/mutes all items:
    function ItemSilenceActives takes item m, boolean flag returns nothing //Prevents units from using m's abilities when flag == true
    function ItemSilencePassives takes item m, boolean flag returns nothing //Prevents units from benefiting off passive abilities given by m
    function ItemMute takes item m, boolean flag returns nothing //Prevents units from benefiting off stats offered by m when flag == true
    function IsItemSilenced takes item m, returns boolean
    function IsItemMuted takes item m, returns boolean
     
    Last edited: May 13, 2018
  19. DracoL1ch

    DracoL1ch

    Joined:
    Dec 12, 2010
    Messages:
    2,040
    Resources:
    2
    Tutorials:
    2
    Resources:
    2
    Then u go with items you dont wanna silence (eg Reincarnation)
    Those functions are barely useful in the way you propose them
     
  20. Wrda

    Wrda

    Joined:
    Nov 18, 2012
    Messages:
    1,317
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    No it isn't irrelevant because if "UnitSilenceItems" is false and the unit has the silence buff then "IsUnitItemSilenced" should return true, not false.