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 poll for Hive's 12th Concept Art Contest is up! Go cast your vote for your favourite genie!
    Dismiss Notice
  4. Travel to distant realms and encounter scenes unknown to the common folk. The Greatest of Adventures is upon us with the 8th Cinematic Contest. Join in on a fun ride.
    Dismiss Notice
  5. The 18th Icon Contest is ON! Choose any ingame unit and give him/her Hero abilities. Good luck to all.
    Dismiss Notice
  6. Contestants are to create a scene set in the Stone Age. Come and see what you can come up with. We wish you the best of luck!
    Dismiss Notice
  7. Colour outside the lines! Techtree Contest #13 is a go. The contest is optionally paired.
    Dismiss Notice
  8. Greetings cerebrates, our Swarm needs new spawners that will have numerous children. Join the HIVE's 31st Modeling Contest - Spawners and Spawned! The contest is optionally paired.
    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. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,476
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    These were removed for security reasons.
     
  2. pusha1999

    pusha1999

    Joined:
    Jan 7, 2014
    Messages:
    67
    Resources:
    0
    Resources:
    0
    then need smth for save code functions in hashtable for example like
    Code (Text):
    native SaveCode takes hashtable hash, integer parentInt, integer childInt, code codename returns nothing
    and
    Code (Text):
     native LoadCode takes hashtable hash, integer parentInt, integer childInt returns code
     
  3. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,476
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    From what I understand code is a low level type. Hence it is not meant to or at least safe to be heavily manipulated. If you want to execute code dynamically then wrap it in boolexprs or triggers.
     
  4. pusha1999

    pusha1999

    Joined:
    Jan 7, 2014
    Messages:
    67
    Resources:
    0
    Resources:
    0
    i think youre right. but, if you can use code as variable, then why not supported arrays on this? its strange. You cannot use boolexpr in timers expired functions for example, qoz this functions should return nothing as you know ofc...how to be here then? If there is a bug with resuming periodic timers after pause.
     
  5. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,476
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    Not that strage. Code arrays were used for arbitrary code execution exploit so were removed.
    One can create a system which runs a dynamic boolexpr in response to a timer expiring. Not the nicest code wise but I think that is what most timer systems do.
     
  6. WeirdEditor

    WeirdEditor

    Joined:
    May 10, 2018
    Messages:
    111
    Resources:
    0
    Resources:
    0
    Please add a native:
    Code (vJASS):
    function IsTriggerSleeping takes trigger t returns boolean
    to prevent stack corruption if a trigger is destroyed when sleeping!
     
  7. pusha1999

    pusha1999

    Joined:
    Jan 7, 2014
    Messages:
    67
    Resources:
    0
    Resources:
    0
    i think its useless qoz you can check with booleans this if i correct understood your idea...smth like:
    Code (Text):
    boolean sleep
    set sleep = true
    call TriggerSleepAction(1.0)
    set sleep = false
     
  8. Wrda

    Wrda

    Joined:
    Nov 18, 2012
    Messages:
    1,050
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    That doesn't stop the trigger from executing the rest of the code if the trigger is destroyed. Also use [jass][/jass] not [code][/code], it makes it easier to read as it is more appropriate.
     
  9. pusha1999

    pusha1999

    Joined:
    Jan 7, 2014
    Messages:
    67
    Resources:
    0
    Resources:
    0
    btw, ive got an idea about trigger events.
    IDK if there is a limit of events count in one trigger (i mean how many events in one trigger i can put without any problems?...as i see event is an integer type, so shoulnd be any limits with that....never checked this) , but if yes, then i think need to remove any limits of this..
     
  10. Wrda

    Wrda

    Joined:
    Nov 18, 2012
    Messages:
    1,050
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    I've seen maps where there was a trigger with around 3000 events, and it didn't affect gameplay at all and worked perfectly.
     
  11. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,476
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    However with a badly written damage detection system one can easily end up with a trigger with 10,000 events or more in some games. This harms performance due to the event leaks.
     
  12. MyPad

    MyPad

    Spell Reviewer

    Joined:
    May 9, 2014
    Messages:
    1,282
    Resources:
    6
    Models:
    1
    Icons:
    1
    Spells:
    3
    JASS:
    1
    Resources:
    6
    Can both destructable and item creation event, and their corresponding remove event, be introduced?

    I think this has been mentioned a lot of times already, but to rehash some possible natives, along with new ones:

    Code (vJASS):

    function IsUnitAbilitySilenced takes unit whichUnit, integer abilId returns boolean
        // Returns true if ability exists and is silenced and false otherwise
    function MakeUnitSelectable takes unit whichUnit, boolean isSelectable returns nothing
        // A complement to IsUnitSelectable
    function GetUnitAttackType takes unit whichUnit, integer index returns attacktype
        // Returns the attack type of the selected attack index

    // These are unit-specific versions of the new natives introduced
    function SetUnitAbilityTooltip takes unit whichUnit, integer abilId, integer level, string description returns boolean
        // Returns true if the tooltip was overwritten
    function SetUnitAbilityExtendedTooltip takes unit whichUnit, integer abilId, integer level, string description returns boolean
        // Returns true if the extended tooltip was overwritten
    function SetUnitAbilityResearchTooltip takes unit whichUnit, integer abilId, integer level, string description returns boolean
        // Returns true if the research tooltip was overwritten
    function SetUnitAbilityResearchExtendedTooltip takes unit whichUnit, integer abilId, integer level, string description returns boolean
        // Returns true if the research tooltip was overwritten

    // Auto-cast versions
    function SetUnitActivatedAbilityTooltip takes unit whichUnit, integer abilId, integer level, string description returns boolean
        // Returns true if the tooltip was overwritten
    function SetUnitActivatedAbilityExtendedTooltip takes unit whichUnit, integer abilId, integer level, string description returns boolean
        // Returns true if the extended tooltip was overwritten
    function SetUnitActivatedAbilityResearchTooltip takes unit whichUnit, integer abilId, integer level, string description returns boolean
        // Returns true if the research tooltip was overwritten
    function SetUnitActivatedAbilityResearchExtendedTooltip takes unit whichUnit, integer abilId, integer level, string description returns boolean
        // Returns true if the research tooltip was overwritten

    // The abilities' getters (Replace Set with Get, remove parameter string description, and change return type to string)

    function SetUnitAbilityCooldownRemaining takes unit whichUnit, integer abilId, real newRemaining returns boolean
        // Modifies the amount of time left before the ability can be activated again. Minimum value of 0 internally.
        // Internally does not affect abilities which are no longer in cooldown.
    function SetUnitAbilityCooldownRemainingEx takes unit whichUnit, integer abilId, real newRemaining returns boolean
        // Does the same thing as SetUnitAbilityCooldownRemaining, but refreshes the cooldown model of the icon.
    function ApplyUnitAbilityCooldown takes unit whichUnit, integer abilId, real duration returns boolean
        // Applies the cooldown of an ability which is not in cooldown. Ignores the internal cooldown of the ability.
        // Returns true if procedure above is successful.
     
     
  13. chopinski

    chopinski

    Joined:
    May 16, 2012
    Messages:
    141
    Resources:
    0
    Resources:
    0
    Will all the functions listed be added at some point?
     
  14. The_Silent

    The_Silent

    Joined:
    Feb 4, 2008
    Messages:
    2,849
    Resources:
    159
    Models:
    49
    Icons:
    89
    Packs:
    8
    Skins:
    12
    Maps:
    1
    Resources:
    159
    BlzFrameSetTexture

    removes the edges of backdrop. And there is no natives to set the edges.
     
  15. BestZero

    BestZero

    Joined:
    May 14, 2007
    Messages:
    35
    Resources:
    3
    Maps:
    3
    Resources:
    3
    Not sure if this has already been suggested but I could see a lot of usage. Not to mention it should be easy to implement since you could already see the level of the buff when you hover over the buff.

    Code (vJASS):
    native GetUnitBuffLevel takes unit whichUnit, integer abilcode returns integer


    Or fix GetUnitAbilityLevel to actually return the correct level of the buff instead of always returning 1. But I guess it could break some maps this way.
     
  16. Wrda

    Wrda

    Joined:
    Nov 18, 2012
    Messages:
    1,050
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    And let us to able to detect buffs on unit death, just right before the unit actually dies.
    Code (vJASS):
    native MakeUnitMissAttack takes unit whichUnit, integer weaponIndex returns nothing //Makes unit miss next attack
    native MakeUnitMissAttackN takes unit whichUnit, integer weaponIndex, integer attackAmount returns nothing //Makes unit miss an amount of its next attacks
    EVENT_PLAYER_UNIT_MISSED //WE NEED THIS EVENT!
    EVENT_UNIT_MISSED //Does same
     
    Last edited: Jun 8, 2019
  17. pusha1999

    pusha1999

    Joined:
    Jan 7, 2014
    Messages:
    67
    Resources:
    0
    Resources:
    0
    Code (vJASS):
    native BlzSetUnitAbilityPosX/Y takes unit u, integer abilCode, integer XPos returns nothing
    //Same as BlzSetAbilityPosX/Y but for unit. Qoz change for every units wich got this ability. GetLocalPlayer snippet doesnt work there.

    native BlzSetUnitAbilityPosX/Y takes unit u, integer abilCode returns integer
    //Just return the same value as BlzGetAbilityPosX/Y but for unit.

    native GetUnitRealDamage takes unit u, boolean before returns real
    //Returns a real value of damage to unit with boolean before(thats mean without including  and resists armor) or with included armor and resists.

    native CheckWalkable takes real x, real y, boolean checkDestructable, boolean checkUnits, integer walktype returns boolean
    //wich means to check or not a standart walkable like in function IsTerrainWalkable...if 0 then no check, if >0 thats mean index of walkabilitypatch).
    Also for avoid a tons of code in custom systems. Always better if natives :)

    native Function2String takes code func, string name returns nothing
    //thats means you can save the function code to string for save

    native Sring2Function takes string funcName returns code
    //Convert back the string to function code for fire. For avoid abuses there can be a return value 0 if function wasnt converted to string before. Thats means you can convert the string to function only if you used converting this function to string before.

    Or

    native GetIndexCode takes code func returns integer
    //Only Get, not Set for avoid abuses.
    Will be very usefull

    and

    native GetCode takes integer codeindex returns code


    native TypeToString takes type wichType returns string
    //Just takes the type variable  (handle, agent, eventid and etc) and converts to string

    native IsVariableDefined takes string var, function code returns boolean
    //Thats means function got an defined  variable or not.


    hm, with damage detect its impossible to detect, miss or not?)

    i think they should return boolean then, not nothing.
     
    Last edited by a moderator: Jun 16, 2019
  18. Wrda

    Wrda

    Joined:
    Nov 18, 2012
    Messages:
    1,050
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    If it's damage detected, then it wasn't missed, plus, we don't want the hit sound to be triggered. That's why we need that event.

    I don't know, it is indifferent. It's up to them to know if it should return something or not :)
     
  19. pusha1999

    pusha1999

    Joined:
    Jan 7, 2014
    Messages:
    67
    Resources:
    0
    Resources:
    0
    if this will return nothing then you cant use this in conditions without your custom checks.
    most of the function i think should return boolean wich now returns nothing.

    no, if damage = 0, its anyway damage and will be detected. just make a condition smth like
    if dmg > 0 then
    some code...
    else
    your miss detect
    endif
     
  20. Wrda

    Wrda

    Joined:
    Nov 18, 2012
    Messages:
    1,050
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    There's no point in using using this in an if-statement as a condition, it would always return true.

    Damage will be 0 with abilities and etc of course. You missed the point, if I want to make the unit miss the target, then there should be a function for it, without the target actually being hit and without setting the damage = 0, it won't be a real miss because the hit sound still plays.