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

Couple Questions...

Status
Not open for further replies.
Level 9
Joined
Nov 28, 2008
Messages
704
Alright, I have two questions, one simple, the other most likely not.

1) Is it possible to change a units attack type through a trigger? Like Choas -> Siege.

2) When replacing units, any units attacking that unit will stop. Assuming the two are allied (requiring MANUAL click to attack), what would be the best way to get them to KEEP attacking after the replacement?

So far, all I can figure out for 2 is that perhaps if a unit is attacking a unit, and that unit uses a skill which has a trigger replace it, order the unit who was attacking to keep attacking.

Is that the best way to handle that? Is there an easy way Im missing completelY?

Thanks in advance.
 
Level 18
Joined
Sep 27, 2005
Messages
2,069
1) Is it possible to change a units attack type through a trigger? Like Choas -> Siege.

I don't think so


2) When replacing units, any units attacking that unit will stop. Assuming the two are allied (requiring MANUAL click to attack), what would be the best way to get them to KEEP attacking after the replacement?

set x = attacked unit ( unit type variable )
unit replace unit with unit
issue last replaced unit to attack x
 
Level 3
Joined
Dec 14, 2008
Messages
35
1) Is it possible to change a units attack type through a trigger? Like Choas -> Siege.

I don't think so

It is possible if you make 2 copyed units of that are the same excpet for their type of attacks like when demon hunter turns into demon form. Then make a trigger and when something happens kill unit with choas attack the create siege attack unit at same position.
 
Level 9
Joined
Nov 28, 2008
Messages
704
Alright then:

I thjink you misunderstood me. I meant any units attacking your replaced unit.

Lets say I have a peasant, who can magically change into a dragon. An archer is attacking him.

I change that peasant to a dragon, and the archer stops attacking. What is the best way, short of keeping track of all units attacking each other at any time on the map, to keep that archer attacking?

And can you use "attacked unit" when my trigger is "a Unit casts an ability"?
 
Level 9
Joined
Nov 28, 2008
Messages
704
Cant use that, as ANY unit could be attacking it, the archer being an example. It could be an Archer, a Knight, another Dragon, and what happens if I have more then one thing?

Is there no function that can tell you all the units currently attacking a unit?


Alright, so far Ive got... make a seperate function calling all units within say. the max range possible someone could be attacking from.

Then have a seperate trigger setting the variable Temp_Attacking[0] (and if theres more, while looping, etc... its a picked unit loop) to the unit attacking every time it attacks a unita, then in that units within range function, check if any Temp_Attacking are attacking.

However, I see a problem with this, and that problem would be simple: the units could potentially be attacking something else while in range, and this would force them to attack the changing unit.

Is there no other way?
 
Level 2
Joined
Dec 14, 2008
Messages
21
Event - a unit is attacked
Condition - attacked unit equal to the unit you plan to replace
Action - Unit group - add attacking unit to unit group Attackers

Event - a unit is issued an order
Condition - unit issued order is in unit group Attackers
Action - If, then, else
Condition - And, all are true - issued order is equal to attack
- target of issued order equal unit to be replaced
Action - Do nothing
Else Action - Remove unit from Attackers

then when you replace the unit add this to your trigger:

Unit group - pick every unit in Attackers
Action - issue order attack last replaced unit to picked unit


If you wanna make it MPI the you can set up a unit group array...
If you wanna make it MUI then I will have to think harder lol...
Also, depending on how much you use it I believe it leaks, but I could add some stuff to stop it leaking but I'm lazy lol.
 
Level 9
Joined
Nov 28, 2008
Messages
704
I dont believe that leaks, assuming you reuse the variable.. does it?

Thanks again, I guess that's what I will have to use. Unfortunately, this will also require me having to do it for each of the 11 players, since they can all have replaceable units.

Sigh..

And I guess I could have a unit keep attacking my keeping track of units attacking target..
 
Level 2
Joined
Dec 14, 2008
Messages
21
So there are multiple players with multiple replacing units?

You can use a "Unit Group Array" for Attackers setting the number in the array to a number based on the player, but then you'd have to do it for every unit. Vice versa you might be able to do it for every unit with some massively huge array...

Tell me what your trying to do and I could probably whip it up for you in 5 mins. I love using GUI for problems like this lol ><
 
Level 9
Joined
Nov 28, 2008
Messages
704
Nono, I can figure it out, Im just trying to find the easiest and most efficient.

There will probably be at most 11 units at a time who can transform, but I might want to dome epic monsters and stuff, too.. so maybe not.

Oh well, thanks again for all your help.
 
Level 9
Joined
Nov 28, 2008
Messages
704
Hate to double post, the edit button is not there.. weird.. I found the solution to question 2)... use the "Choas" ability, I believe its ID is Srtt. It can morph the unit, and no need for anything involving triggers.
 
Status
Not open for further replies.
Top