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.

[Trigger] Set unit weapon natives issue

Discussion in 'Triggers & Scripts' started by The_Silent, Oct 10, 2019.

  1. The_Silent

    The_Silent

    Joined:
    Feb 4, 2008
    Messages:
    2,875
    Resources:
    159
    Models:
    49
    Icons:
    89
    Packs:
    8
    Skins:
    12
    Maps:
    1
    Resources:
    159
    I played around trying to make a equipment system, using the new natives instead of custom units to change attack and armor of the unit. But it does not seem to work.

    This is the trigger I tested with. Tested it on a rifleman. Nothing happened. Tried with different attack index. Hide and Unhide is only used because I remember some issues in the far past, where that method would work. It does not.

    • TestEquip
      • Events
        • Unit - A unit Starts the effect of an ability
      • Conditions
        • (Ability being cast) Equal to Equip Handgun
      • Actions
        • Custom script: call DisplayTextToPlayer(Player(0), 0, 0, "Equip Handgun registered")
        • Unit - Set Unit: (Triggering unit)'s Weapon Integer Field: Attack Attack Type ('ua1t')at Index:0 to Value: 1
        • Unit - Set Unit: (Triggering unit)'s Weapon Integer Field: Attack Damage Base ('ua1b')at Index:0 to Value: 3
        • Unit - Set Unit: (Triggering unit)'s Weapon Integer Field: Attack Damage Sides Per Die ('ua1s')at Index:0 to Value: 17
        • Unit - Set Unit: (Triggering unit)'s Weapon Integer Field: Attack Damage Number Of Dice ('ua1d')at Index:0 to Value: 1
        • Unit - Set Unit: (Triggering unit)'s Weapon Real Field: Attack Range ('ua1m')at Index:0 to Value: 500.00
        • Unit - Set Unit: (Triggering unit)'s Weapon Real Field: Attack Base Cooldown ('ua1c')at Index:0 to Value: 0.33
        • Unit - Hide (Triggering unit)
        • Unit - Unhide (Triggering unit)


    Am I doing something wrong, or do these just not work yet?
     
  2. Tasyen

    Tasyen

    Joined:
    Jul 18, 2010
    Messages:
    1,300
    Resources:
    16
    Tools:
    2
    Maps:
    2
    Spells:
    7
    Tutorials:
    4
    JASS:
    1
    Resources:
    16
    weapon fields do not work, yet.
     
  3. The_Silent

    The_Silent

    Joined:
    Feb 4, 2008
    Messages:
    2,875
    Resources:
    159
    Models:
    49
    Icons:
    89
    Packs:
    8
    Skins:
    12
    Maps:
    1
    Resources:
    159
    That is too bad. Will wait till they are fixed to create my equipment system I guess. No reason to use the old clunky method, when a new method is so close. Especially because armor will work independently of attack too, which replacing units does not really support.

    Do you know if changing armor types work?

    Edit:
    It does not seem to
     
    Last edited: Oct 10, 2019
  4. Tasyen

    Tasyen

    Joined:
    Jul 18, 2010
    Messages:
    1,300
    Resources:
    16
    Tools:
    2
    Maps:
    2
    Spells:
    7
    Tutorials:
    4
    JASS:
    1
    Resources:
    16
    if you want to change large armor to hero armor that is not armor type, that is defense type. Armor type is used for combat sounds, metal slash on stone sounds different than wood slash on flesh.
    Code (vJASS):

        // defense type
        constant defensetype    DEFENSE_TYPE_LIGHT              = ConvertDefenseType(0)
        constant defensetype    DEFENSE_TYPE_MEDIUM             = ConvertDefenseType(1)
        constant defensetype    DEFENSE_TYPE_LARGE              = ConvertDefenseType(2)
        constant defensetype    DEFENSE_TYPE_FORT               = ConvertDefenseType(3)
        constant defensetype    DEFENSE_TYPE_NORMAL             = ConvertDefenseType(4)
        constant defensetype    DEFENSE_TYPE_HERO               = ConvertDefenseType(5)
        constant defensetype    DEFENSE_TYPE_DIVINE             = ConvertDefenseType(6)
        constant defensetype    DEFENSE_TYPE_NONE               = ConvertDefenseType(7)

     // Armor Type
        constant armortype      ARMOR_TYPE_WHOKNOWS             = ConvertArmorType(0)
        constant armortype      ARMOR_TYPE_FLESH                = ConvertArmorType(1)
        constant armortype      ARMOR_TYPE_METAL                = ConvertArmorType(2)
        constant armortype      ARMOR_TYPE_WOOD                 = ConvertArmorType(3)
        constant armortype      ARMOR_TYPE_ETHREAL              = ConvertArmorType(4)
        constant armortype      ARMOR_TYPE_STONE                = ConvertArmorType(5)
     
     
  5. The_Silent

    The_Silent

    Joined:
    Feb 4, 2008
    Messages:
    2,875
    Resources:
    159
    Models:
    49
    Icons:
    89
    Packs:
    8
    Skins:
    12
    Maps:
    1
    Resources:
    159
    Thanks, that works.