HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

[Help] Remove "Attack" and make attack animate

01-26-2008, 03:51 AM#1
Salbrismind
I have 2 problems on my map right now.

First, and most important the attack animation on my unit does not go off at all.
Here's the trigger:
Trigger:
Basic Attack
Collapse Events
Unit - A unit Begins casting an ability
Collapse Conditions
(Casting unit) Equal to Heroes[1]
(Ability being cast) Equal to Attack
Collapse Actions
Animation - Play Heroes[1]'s attack animation
Collapse Unit Group - Pick every unit in (Units within 100.00 of (Position of Heroes[1]) matching (((Owner of (Matching unit)) is an enemy of Player 1 (Red)) Equal to True)) and do (Actions)
Collapse Loop - Actions
Set x = ((X of (Position of (Picked unit))) - (X of (Position of Heroes[1])))
Set y = ((Y of (Position of (Picked unit))) - (Y of (Position of Heroes[1])))
Set AtkAng[1] = (Atan((y / x)))
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
x Greater than 0.00
Collapse Then - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
y Greater than 0.00
Then - Actions
Collapse Else - Actions
Set AtkAng[1] = (360.00 + AtkAng[1])
Collapse Else - Actions
Set AtkAng[1] = (180.00 + AtkAng[1])
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
AtkAng[1] Greater than ((Facing of Heroes[1]) - 45.00)
AtkAng[1] Less than ((Facing of Heroes[1]) + 45.00)
Collapse Then - Actions
Special Effect - Create a special effect at (Position of (Picked unit)) using Objects\Spawnmodels\Orc\Orcblood\BattrollBlood.mdl
Unit - Cause Heroes[1] to damage (Picked unit), dealing 80.00 damage of attack type Normal and damage type Normal
Sound - Play AxeMissile1 <gen> at 100.00% volume, attached to Heroes[1]
Else - Actions
The animation action is at the top, and I can't find anything wrong with it.

Second, It would be nice if someone could tell me a way to remove the generic attack command on a unit. The spell I want to use has the hotkey A. Now I can change it but because it is the spell used to attack it just seems right to use a.

If anyone can help me with either or both of my problems It will be greater appreciated. + rep of course
01-26-2008, 04:50 AM#2
TaintedReality
Quote:
First, and most important the attack animation on my unit does not go off at all.

I would just put "attack" in the Animation field of the actual ability. That would be easiest, but if for whatever reason you need to trigger it, then you should Pause and Unpause the unit, then issue the animation order. You also might have to use SetUnitAnimationByIndex instead of the usual Animation function, but I think the Pause/Unpause will do the trick.

Quote:
Second, It would be nice if someone could tell me a way to remove the generic attack command on a unit. The spell I want to use has the hotkey A. Now I can change it but because it is the spell used to attack it just seems right to use a.

You can remove the Attack and Stop buttons together by setting Show UI to false. If you don't want to remove the Stop button with it, I think you can probably just directly remove the attack ability through triggers, its object id is 'Aatk'.
01-26-2008, 04:58 PM#3
Salbrismind
Quote:
Originally Posted by TaintedReality
I would just put "attack" in the Animation field of the actual ability. That would be easiest, but if for whatever reason you need to trigger it, then you should Pause and Unpause the unit, then issue the animation order. You also might have to use SetUnitAnimationByIndex instead of the usual Animation function, but I think the Pause/Unpause will do the trick.



You can remove the Attack and Stop buttons together by setting Show UI to false. If you don't want to remove the Stop button with it, I think you can probably just directly remove the attack ability through triggers, its object id is 'Aatk'.

Wow, thanks I tested your ideas but I was only about to get the animation to work. What "Show UI to False" are you referring to? I used the one in the object editor under "Combat Attack 1" and it did remove the icon but not stop and it also removed the attack damage icon thing that shows the units attack and such. Is there anyway to remove just all the standard commands on a unit without removing the attack icon thing?

Again thanks for your help so far!
01-26-2008, 07:16 PM#4
TaintedReality
Quote:
What "Show UI to False" are you referring to? I used the one in the object editor under "Combat Attack 1" and it did remove the icon but not stop and it also removed the attack damage icon thing that shows the units attack and such. Is there anyway to remove just all the standard commands on a unit without removing the attack icon thing?

I've actually never tried that myself, just got that from reading other threads, so I guess it was wrong =\. I don't think you can remove attack without removing the attack damage info, and you can't remove move without setting the unit's move speed to 0. You can try removing them individually using the UnitRemoveAbility function, attack's id is 'Aatk' and move is 'Amov'. I think removing Move removes Move and Patrol, and removing Attack removes Attack and Stop. But again, I've never really tried any of this so it's probably all wrong =P.

Edit: Here's some stuff I found, not specifically for what you're trying to do but it should help.

Quote:
Originally Posted by PitzerMike
I've done this in one of my maps, there are actually 2 different ways.

1) The move ability can be removed by using the Unit Remove Ability function. simply do a custom script call : call UnitRemoveAbility(unit_variable_here, 'Amov')
The problem is you can't easily add the move ability back when you want the hero to move.
You'll need 2 chaos abilities and 1 alternate form of your hero that is actually exactly the same as the hero unit. When you want to add the move ability to the hero you'll just chaos-convert it to the alternate unit-id and immediately convert it back. Now the hero will have the move ability again.
As soon as the hero reaches the target you can remove the move ability again.

2) The second possibility involves a simple modification to the editor and 2 or 3 imported files. Extract Units\AbilityData.slk from Patch.mpq, create a Units folder in your WC3 dir and drop the file there. Edit it in Excel so the column useInEditor says 1 for the Amov abiliity. Now the move ability will be shown in the editor and can be edited.
In the ability editor add a custom unit to the requirements of the move ability. As long as the owner of the hero doesn't posess such a unit he can't use the move ability. When you want the hero to move, create the required unit for the owner, issue the order, then remove the unit again.
In order to hide the move, patrol and holdposition buttons properly you'll need to import a black icon. And change the icon-paths in Units\CommandFunc.txt (which you'll have to extract from a mpq) to point to that black icon.
In Units\CommandStrings.txt you should replace the tooltips with something better (you can't get rid of those). I for example put some credits there.
Then import the CommandFunc and CommandStrings files into your map and you're set.

And this thread is kind of interesting.
01-26-2008, 07:33 PM#5
Salbrismind
Thanks, when I got on my main computer I'll try that. Good thing is I don't want any of my units to have any commands ever so the first option works perfect. Thanks for all the effort you put into helping. +rep

edit: Sorry, can't rep you, I reped you last time. :(

edit2: I just tested it and it worked! However... unexpectedly a unit cannot be moved via triggers if it doesn't have the move command, so now I will have to give that back.

edit3: K, thank you. I have other problems now but none that relate to this. I actually have to keep all the icons anyways because the unit would either not move or the attack would not show.