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

[Spell] Recall Spell

Status
Not open for further replies.
Level 4
Joined
Jan 2, 2016
Messages
66
I'm trying to create a unit with a Recall spell, just like the Protoss Arbiter. I've made a custom ability based on the Amulet of Recall's ability, changed to be non-item and modified the number of unit transported and the size. The spell does transport the units, does cost mana, does have the right cooldown.

The problem is that if I have multiple Arbiters selected and I order the spell, they all cast it, instead of just one of them casting it, as most spells work. How do I modify a spell so that only one unit in the group will cast it? Or is that possible? Do I have to trigger this spell to make it work the way I want?
 
Level 4
Joined
Jan 2, 2016
Messages
66
Mass teleport has the wrong effect though; it teleports the caster (and nearby units) to another unit instead of teleporting units to the caster.

I'll look into it a bit later and see what I can do.
 
Level 12
Joined
May 22, 2015
Messages
1,051
You could maybe use a dummy to cast the recall or mass teleport spell (whichever you end up going with).

You just need to find an ability that only one unit will cast at a time (and targets the ground). I don't know what spells will work for this, unfortunately. I know it does work for things like holy light. I've had multiple units with it and they smart cast them like in SC2 (only one unit casts it at a time).
 
Level 12
Joined
May 22, 2015
Messages
1,051
Going off of what SAUS said, you could base a spell off of something like roar (or something that isn't multicast) with no effects and then have a trigger that creates a dummy unit with an expiration that casts recall.

The spell needs to be able to target the ground (AOE might be better to show the radius).

Roar has no targets, right?

I don't know if the smart casting thing is an option for the channel spells, but you could try that. If you want an AOE ground targetting spell that doesn't do anything, you can use death and decay with numbers set so it doesn't do any damage / has no duration.
 
Level 11
Joined
Jun 2, 2013
Messages
613
You wouldn't need roar's AoE for it. All you use roar for is the Starts the Effect of an Ability event so that you can create a dummy unit to cast the recall spell around your units - unless showing the AoE is important.

In that case Blizzard/Flamestrike would probably be a good one to use
 
Level 4
Joined
Jan 2, 2016
Messages
66
I'd like to show the AoE cursor when selecting the target. I'll probably use an AoE spell like Blizzard, Flamestrike, or Rain of Fire.

You just need to find an ability that only one unit will cast at a time (and targets the ground). I don't know what spells will work for this, unfortunately. I know it does work for things like holy light. I've had multiple units with it and they smart cast them like in SC2 (only one unit casts it at a time).

I think pretty much all spells except Raise Dead are not multicast, at least from my experience in the campaigns and melee play.
 
Level 12
Joined
Jan 2, 2016
Messages
973
I'd like to show the AoE cursor when selecting the target. I'll probably use an AoE spell like Blizzard, Flamestrike, or Rain of Fire.



I think pretty much all spells except Raise Dead are not multicast, at least from my experience in the campaigns and melee play.

If you want the AoE cursor - you need to trigger it:
base the spell on something with AoE cursor: blizzard/rain of fire/silence/flame strike, etc...
and trigger would be: A unit starts the effect of ability
ability being cast equal to (your ability)
set temp_point1 = target point of ability being cast
set temp_point2 = position of triggering unit
set bj_wantDestrouGroup = true
pick all units in range (the range you want) from temp_point1, matching condition (owner of matching unit is an enemy of triggering player)
loop actions: move picked unit instantly to temp_point2
call RemoveLocation(temp_point1)
call RemoveLocation(temp_point2)

If you want the special effects to happen - you need a "temp_point3" which you set in the begining of the loop, create a special effect at it, destroy the temp point, destroy the special effect, move the unit, set temp_point3 to the new position of the unit (since it will get moved to another location, not exactly at temp_point2), create and destroy special effect there, and destroy temp_point3
 
Level 12
Joined
May 22, 2015
Messages
1,051
If you want the AoE cursor - you need to trigger it:
base the spell on something with AoE cursor: blizzard/rain of fire/silence/flame strike, etc...
and trigger would be: A unit starts the effect of ability
ability being cast equal to (your ability)
set temp_point1 = target point of ability being cast
set temp_point2 = position of triggering unit
set bj_wantDestrouGroup = true
pick all units in range (the range you want) from temp_point1, matching condition (owner of matching unit is an enemy of triggering player)
loop actions: move picked unit instantly to temp_point2
call RemoveLocation(temp_point1)
call RemoveLocation(temp_point2)

If you want the special effects to happen - you need a "temp_point3" which you set in the begining of the loop, create a special effect at it, destroy the temp point, destroy the special effect, move the unit, set temp_point3 to the new position of the unit (since it will get moved to another location, not exactly at temp_point2), create and destroy special effect there, and destroy temp_point3

It might be better to just use a dummy to cast the spell. I'm not sure exactly how it works, but I know in starcraft, the arbiter recall ability keeps the same unit formation. I don't know if that's the case with the WC3 abilities though.

It would probably be simpler to code that way, anyway (create dummy and then tell it to cast the spell).
 
Level 12
Joined
Jan 2, 2016
Messages
973
Well, it is possible to keep the formation, using the trigger I presented. You just need 2 more points:
temp_point3 = position of picked unit
temp_point4 = point, centered at temp_point2 with offset (distance from temp_point1 to temp_point3), at angle (angle from temp_point1 to temp_point3)
and teleport the unit to temp_point4 :p

But yeah.. perhaps it will be easier to just make a dummy cast it.
 
Level 4
Joined
Jan 2, 2016
Messages
66
Couldn't I instead spawn a dummy unit at the point of the Arbiter, and have it cast Recall? That seems easier than screwing around with teleporting trigger actions. Or would it be too slow?
 
Level 7
Joined
Nov 19, 2015
Messages
283
Im also for triggering it. Found in my experience that if you want to change something or upgrade your spell to do more stuff you will have to trigger anyway.
Sorry I don't play SC and didn't really play WC3. I assume you have a AOE target spell which takes all allies in the area to the caster. Roar won't work for that since you don't know where to target. If you want to keep the same formation you can just save the offset between the two points. (coordinates or polaroffset)

Here is coordinate example:
Point1 = caster
Point2 = target
Set offsetX = distance(p1,p2)*cos(angle(p1,p2))
Set offsetY = distance(p1,p2)*sin(angle(p1,p2))
Pick all units in X of Point2
Set unit x = x of picked unit + offsetX
Set unit y = y of unit + offsetY

or you can use polar offset and save distance and angle instead of X,Y.

This will keep the units formation and facing and also not disrupt channeling spells which can lead to some pretty crazy surprise attacks
 
Level 4
Joined
Jan 2, 2016
Messages
66
Im also for triggering it. Found in my experience that if you want to change something or upgrade your spell to do more stuff you will have to trigger anyway.
Sorry I don't play SC and didn't really play WC3. I assume you have a AOE target spell which takes all allies in the area to the caster. Roar won't work for that since you don't know where to target. If you want to keep the same formation you can just save the offset between the two points. (coordinates or polaroffset)

Here is coordinate example:
Point1 = caster
Point2 = target
Set offsetX = distance(p1,p2)*cos(angle(p1,p2))
Set offsetY = distance(p1,p2)*sin(angle(p1,p2))
Pick all units in X of Point2
Set unit x = x of picked unit + offsetX
Set unit y = y of unit + offsetY

or you can use polar offset and save distance and angle instead of X,Y.

This will keep the units formation and facing and also not disrupt channeling spells which can lead to some pretty crazy surprise attacks

That seems quite logical. The only problem would be how to limit the number of units transported, for balance reasons. I suppose I could just make the spell have a very small AOE, but if I wanted to just say that a maximum of 5 units would be transported, how would I do that?
 
Level 12
Joined
May 22, 2015
Messages
1,051
Couldn't I instead spawn a dummy unit at the point of the Arbiter, and have it cast Recall? That seems easier than screwing around with teleporting trigger actions. Or would it be too slow?

This is most likely the most simple answer and it should work. You then just need a spell to target with (many were mentioned already), and then have the dummy cast at that spot as well. Quite simple and it will work until you want to make it more complex (which may never happen).
 
Level 12
Joined
Jan 2, 2016
Messages
973
That seems quite logical. The only problem would be how to limit the number of units transported, for balance reasons. I suppose I could just make the spell have a very small AOE, but if I wanted to just say that a maximum of 5 units would be transported, how would I do that?

You can use "Pick N units from group", and in the "N" - write the maximum amount of units you want to teleport.
You can even make it increase this amount by leveling the spell when you make N some function (f. ex: "2+Level of ability being cast())
 
Level 1
Joined
Oct 24, 2015
Messages
7
Attached is an example of a customizable recall spell, I use booleans to set teleport clustering or not, allied or owned and a number will set the max number of units wanted. Please tell me if this helps out.
 

Attachments

  • Recall Test.w3x
    20.2 KB · Views: 56
Level 7
Joined
Nov 19, 2015
Messages
283
That seems quite logical. The only problem would be how to limit the number of units transported, for balance reasons. I suppose I could just make the spell have a very small AOE, but if I wanted to just say that a maximum of 5 units would be transported, how would I do that?

n=0
Point1 = caster
Point2 = target
Set offsetX = distance(p1,p2)*cos(angle(p1,p2))
Set offsetY = distance(p1,p2)*sin(angle(p1,p2))
Pick all units in X of Point2
set n=n+1
if n<= max_units

Set unit x = x of picked unit + offsetX
Set unit y = y of unit + offsetY

if you want i help you make it pick the closest to the target
 
Level 12
Joined
May 22, 2015
Messages
1,051
Set offsetX = distance(p1,p2)*cos(angle(p1,p2))
Set offsetY = distance(p1,p2)*sin(angle(p1,p2))

This is correct, but it bugs me :p

In this case, you could just do:
Set offsetX = GetLocationX(p2) - GetLocationX(p1)
Set offsetY = GetLocationY(p2) - GetLocationY(p1)

Also, I think you got the points in the angle calculation backwards. This would move the units in the same direction you cast in, but they should move the opposite so that they end up at the caster.
 
Level 7
Joined
Nov 19, 2015
Messages
283
Set offsetX = distance(p1,p2)*cos(angle(p1,p2))
Set offsetY = distance(p1,p2)*sin(angle(p1,p2))

This is correct, but it bugs me :p

In this case, you could just do:
Set offsetX = GetLocationX(p2) - GetLocationX(p1)
Set offsetY = GetLocationY(p2) - GetLocationY(p1)

Also, I think you got the points in the angle calculation backwards. This would move the units in the same direction you cast in, but they should move the opposite so that they end up at the caster.

Opps I meant x/y -offset instead of +offset. (or could add a +180)
I wrote this in basic form but I assumed he would save it in a variable so he would only need 2.
Angle and distance instead of x1,x2,y1,y2. Also he can do checks such as the range.
 
Level 1
Joined
Oct 24, 2015
Messages
7
Although x,y offsets are fine I think using polar offsets with the target as a center point is much more efficient and easy to understand. Angle and distance between points can be easily obtained using wc3 functions.
 
Level 12
Joined
May 22, 2015
Messages
1,051
Although x,y offsets are fine I think using polar offsets with the target as a center point is much more efficient and easy to understand. Angle and distance between points can be easily obtained using wc3 functions.

X and Y offsets can be as well - though you have to use JASS to use them. In GUI, using points and polar offsets is definitely easier to understand, but it is considerably less efficient than using X and Y offsets - especially using my method which does not touch sin() or cos() functions which are generally quite expensive. Don't forget the extra time used to clean up those points as well.
 
Level 7
Joined
Nov 19, 2015
Messages
283
Although x,y offsets are fine I think using polar offsets with the target as a center point is much more efficient and easy to understand. Angle and distance between points can be easily obtained using wc3 functions.

Agree that it is easier but not more efficient
 
Status
Not open for further replies.
Top