• 🏆 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!

Replace unit problem and make sound have distance.

Status
Not open for further replies.
Level 6
Joined
Aug 14, 2016
Messages
174
1:I was use a replace unit in a zombie maps to change weapons, use a skill speed,make bleend when zombie attack it, but when i'm change a weapons, all buff, cooldown time white i'm use speed are remove, i'm don't like this bug, please how to make a better replace.
Event:
A unit is equip a items.
Coditions:
Item eqiup - ak 47
Action
Replace the old unit to owner of hero of equip items.
Codition
owner of equip items equal to ak-47
action
vararible:RedHero=last replace unit.
2:how to make sound distance weapons to less loud weapons when far units.
like this jass, can i accept this code in a custom script.
Code:
call SetSoundDuration(udg_sound15,810)
call SetSoundChannel(udg_sound15,5)
call SetSoundVolume(udg_sound15,'x')
call SetSoundPitch(udg_sound15,.9)
call SetSoundDistances(udg_sound15,900.,10000.)
call SetSoundDistanceCutoff(udg_sound15,3000.)
call SetSoundConeAngles(udg_sound15,.0,.0,127)
call SetSoundConeOrientation(udg_sound15,.0,.0,.0)
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
1:I was use a replace unit in a zombie maps to change weapons, use a skill speed,make bleend when zombie attack it, but when i'm change a weapons, all buff, cooldown time white i'm use speed are remove, i'm don't like this bug, please how to make a better replace.
Use one of the morph abilities? I forget which but I think bear form can be used to change unit type without resetting properties such as cooldowns. The key to the ability was to make the base unit the desired type and give it to them, order the morph and remove the ability, or something like that.

2:how to make sound distance weapons to less loud weapons when far units.
like this jass, can i accept this code in a custom script.
If the sound is meant to originate from an actor in the game world then make it a 3D sound that is played near them.

Otherwise you can use GetLocalPlayer to run sounds only for certain players which it is relevant to (eg the player who's weapon is reloading).
 
Level 8
Joined
Jan 28, 2016
Messages
486
Just to add to what the Doctor has said, there's this thread that explains the Bearform Trick that should help.

If you want to play a 3D sound, you'll need to attach it to a unit or point using the following natives:
native AttachSoundToUnit takes sound soundHandle, unit whichUnit returns nothing
native SetSoundPosition takes sound soundHandle, real x, real y, real z returns nothing

There's a recent thread about getting 3D sounds to work which might also help; Sound not playing.
 
Level 6
Joined
Aug 14, 2016
Messages
174
No, i'm use a spell Berserk and Trigger like this.
Event
Unit - A unit use an item
Coditions
(Unit-type of(Hero manipulating items)) not equal to Ak-47
(Item-type of (Hero manipulating items)) Equal to Ak-47
Charges remaining in (Hero manipulating items)) Greater than 0
Action:
Set charges remaining in (item being manipulated) to ((Charges remaining in (item being manipulated)) +1)
Sound - Play AK-47 Deploy <gen> at 100.00% volume, attached to (Hero manipulating items)
Replace (Hero manipulating items) with a AK-47 using the old unit's or relative life and mana.
Special Effect - Create a special effect attached to the weapon of (Last replace unit) using AK-47.mdx
Unit-Change color of (Last replaced unit) to Black
If (All Conditions are True) then do (Then Actions) else do (else Actions)
If - Conditions
Owner of (Last replaced unit)) Equal to Player 1(Red)
Then - Action
Set RedHero = (Last replaced unit)
if i'm use morph ability, the unit become fire like a pistol.
and sound distance, sorry my bad code, i'm use a GUI, can i use this code to custom srcipt.
 
Level 8
Joined
Jan 28, 2016
Messages
486
You don't need to base your spell on Bearform for the trick to work. Did you check the guide? o_O

As for the sound, you can use the Sound Editor to edit its min, max and cutoff distances without the use of Jass.
 
Status
Not open for further replies.
Top