• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Using Items as attachments/weapons

Status
Not open for further replies.
Level 13
Joined
Oct 16, 2010
Messages
731
Hi,

I've got 2 quick questions...

1. Is there a way that I can change the attack sound based on what weapon is held? The base sound is Wood Light Bash for fists, then a sword would be a slice, and a hammer would be a heavy bash. Any way of changing them based on the item held? (Would be in slot 1)

2. I want to make an ammo system for Bows & Crossbows. They would require arrows in your inventory to be able to fire, if you have no arrows then you can't shoot. Any ideas? I'm planning on using an orb effect to enable "attack 2" so maybe I can detect use of the orb effect somehow?
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,183
1. It is not impossible.. but there is no good solution. You would have to have multiple versions of the unit and swap them when the item is equipped. It is overall bothersome and would not waste time doing it.

2. If the unit is ranged from the start you can add cargo to the unit which will disable the ability to attack completely.
There is also a system in the spell section which showcase the orb trick you are talking about.
 
Level 13
Joined
Oct 16, 2010
Messages
731
Thanks for your replies

1. I did think it might be a bit problematic... Unfortunately it's a Hero that would be using them so I assume that also makes things more complicated? Was wondering if using a DDS and dummy units might allow me to generate the correct sound? Or just using a DDS and picking the relevant sound?

2. Do you know what the system is called?
 
Level 13
Joined
May 10, 2009
Messages
868
Use the UnitDamageTarget native instead, dealing 0. damage.

  • Then - Actions
    • Trigger - Turn off DDS <gen>
    • Custom script: call UnitDamageTarget(Source, Target, 0., false, false, null, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_?)
    • Trigger - Turn on DDS <gen>
weapon type list
JASS:
    constant weapontype         WEAPON_TYPE_WHOKNOWS            = ConvertWeaponType(0) // No sound
    constant weapontype         WEAPON_TYPE_METAL_LIGHT_CHOP    = ConvertWeaponType(1)
    constant weapontype         WEAPON_TYPE_METAL_MEDIUM_CHOP   = ConvertWeaponType(2)
    constant weapontype         WEAPON_TYPE_METAL_HEAVY_CHOP    = ConvertWeaponType(3)
    constant weapontype         WEAPON_TYPE_METAL_LIGHT_SLICE   = ConvertWeaponType(4)
    constant weapontype         WEAPON_TYPE_METAL_MEDIUM_SLICE  = ConvertWeaponType(5)
    constant weapontype         WEAPON_TYPE_METAL_HEAVY_SLICE   = ConvertWeaponType(6)
    constant weapontype         WEAPON_TYPE_METAL_MEDIUM_BASH   = ConvertWeaponType(7)
    constant weapontype         WEAPON_TYPE_METAL_HEAVY_BASH    = ConvertWeaponType(8)
    constant weapontype         WEAPON_TYPE_METAL_MEDIUM_STAB   = ConvertWeaponType(9)
    constant weapontype         WEAPON_TYPE_METAL_HEAVY_STAB    = ConvertWeaponType(10)
    constant weapontype         WEAPON_TYPE_WOOD_LIGHT_SLICE    = ConvertWeaponType(11)
    constant weapontype         WEAPON_TYPE_WOOD_MEDIUM_SLICE   = ConvertWeaponType(12)
    constant weapontype         WEAPON_TYPE_WOOD_HEAVY_SLICE    = ConvertWeaponType(13)
    constant weapontype         WEAPON_TYPE_WOOD_LIGHT_BASH     = ConvertWeaponType(14)
    constant weapontype         WEAPON_TYPE_WOOD_MEDIUM_BASH    = ConvertWeaponType(15)
    constant weapontype         WEAPON_TYPE_WOOD_HEAVY_BASH     = ConvertWeaponType(16)
    constant weapontype         WEAPON_TYPE_WOOD_LIGHT_STAB     = ConvertWeaponType(17)
    constant weapontype         WEAPON_TYPE_WOOD_MEDIUM_STAB    = ConvertWeaponType(18)
    constant weapontype         WEAPON_TYPE_CLAW_LIGHT_SLICE    = ConvertWeaponType(19)
    constant weapontype         WEAPON_TYPE_CLAW_MEDIUM_SLICE   = ConvertWeaponType(20)
    constant weapontype         WEAPON_TYPE_CLAW_HEAVY_SLICE    = ConvertWeaponType(21)
    constant weapontype         WEAPON_TYPE_AXE_MEDIUM_CHOP     = ConvertWeaponType(22)
    constant weapontype         WEAPON_TYPE_ROCK_HEAVY_BASH     = ConvertWeaponType(23)
 
Last edited:
Level 13
Joined
Oct 16, 2010
Messages
731
I've managed to get the bow to work using arrows as ammo but have now come into another problem that will cause more issues with (1).

What I've done is used an attack switch system that allows Attack 2 which is the ranged attack, however rather than the hero firing the arrow it immediately damages the target, the damage then gets nulled by a DDS and a dummy unit is spawned to then fire the arrow and remove ammo. This has worked well other than the fact that any damage the hero deals while the bow is in slot 1 will then fire an arrow, and as you can "starve" that means that arrows get shot at yourself till you die! (or run out of arrows)

I'm not really sure how to get around this yet unless I make sure Hero's have no other damage source other than attacks... But I had intended on making Bleed (poison) damage on certain weapons which would then proc the arrows... I don't think the DDS I'm using differentiates from basic attacks and spells, is the a DDS which can detect basic attacks?

BloodSoul:
Would this work with the new Combat Sound variable?
 
Status
Not open for further replies.
Top