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

[Solved] Spell with 2 target points

Status
Not open for further replies.
Level 10
Joined
Jun 6, 2007
Messages
392
Is it possible in wc3 to have a spell which has 2 target points?

I'll use a chronosphere superweapon from c&c red alert 2 as an example. How it works is that first you click on the ability, then you target a point (area1), then you target another point (area2). Then all units from area1 are teleported to area2.

Is it possible to have this kind of spell in wc3, without having a separate spells for choosing units and for the actual teleportation?
 
Level 12
Joined
Oct 10, 2009
Messages
438
Oh boy, as far as I know it is not possible to make through the object editor. You would have to trigger the spells completely.

Off the top of my head this should work:

Make spell 1: The actual ability that is shown
Spell 2: A dummy target point spell with the same hotkey as the before ability

Now then, I'm not sure if this works but you get the player to cast the first ability, the one you use to set target point 1. And once that point has been chosen you rotate the first ability for the second one. Be it through hard replacement or engineering upgrade.

Once it's replaced you force the player to press the ui key for the hotkey of the second spell (Assuming he still has the unit selected) and you get them to cast the second spell.

And then the rest is just triggers to teleport them to different points etc.

  • Untitled Trigger 001
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to (==) Abil1
    • Actions
      • Set Point[0] = (Target point of ability being cast)
      • Unit - Remove Abil1 from (Triggering unit)
      • Unit - Add Abil2 to (Triggering unit)
      • -------- Assumes hotkey for last added spell is Q --------
      • Game - Force (Owner of (Triggering unit)) to press the key Q
  • Untitled Trigger 001 Copy
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to (==) Abil2
    • Actions
      • Set Point[1] = (Target point of ability being cast)
      • Unit - Remove Abil2 from (Triggering unit)
      • Unit - Add Abil1 to (Triggering unit)
 
Level 10
Joined
Jun 6, 2007
Messages
392
Thanks for the quick replies!

I tried forcing a hotkey, but it doesn't work unless there's a delay between changing the abilities and forcing the key. It's not possible (to my knowledge) to cast a spell immediately after another. Adding a delay would be quite buggy solution.

@Maker: What exactly do you mean by right-clicking? Is there a way to detect it as an event?
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
@Maker: What exactly do you mean by right-clicking? Is there a way to detect it as an event?

You detect "smart" and "move" orders. When you start the spell, use call SetUnitPropWindow(GetTriggerUnit(), 0), which makes the unit unable to move. It can still turn, attack etc. Then you detect the two next "smart" and "move" orders from the unit (right clicks) and then perform the teleporting.
 
Level 10
Joined
Jun 6, 2007
Messages
392
Hmm, that could work, but it has some problems: It won't show a target cursor, and there's no way to cancel the spell. Well, I'm not really creating a spell like this, I just wanted to know if it's possible. It looks like there's no good way to do this. Thanks anyway!
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
It is possible by using boolean, the first cast, check if the boolean is either false or true.
If false, meaning it is the first cast (set it to true).
If true, meaning it is the second cast (set to false back after second cast to reset).

Wait, you mean continuous target-point in-between first and second cast ???
Continuous in this context means that after the first cast, there is still available the target cursor for the Player to target second point without having any ability trigger the target cursor.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
And what will happen if you have more than 1 unit possessing this spell ?

Let's say you have 2 units having this spell;
Unit A cast it - forces you to choose first point for Unit A
You chose first point for Unit A
After that, you select Unit B and cast it - forces you to choose first point for Unit B

It would mess up the spell mechanics, don't you think ?

Also, you can do this with a single spell - provided that the spell has 0 cooldown.

Suggestion:
1. Make Spell has 0 second cooldown
2. Allow only 1 unit of that unit-type per Player can own it
 
Level 10
Joined
Jun 6, 2007
Messages
392
I don't think there would be any problem with 2 units having this spell. When the unit is deselected, the spell is completely canceled.

How is it possible with 0-cooldown? There's always a delay between casting abilities, even if cooldown and casting time are set to 0.
 
Level 6
Joined
Nov 24, 2012
Messages
218
How about detect when main caster starts his point target ability, spawn a dummy, order ui key and selection on another point target ability, on the shortest expiring timer possible(pretty sure its under 0.01)? Am i missing something here? reset cooldown only main caster spell if 2 points not given.
 
Level 10
Joined
Jun 6, 2007
Messages
392
Ahh, now I found a way to do that. Basically it's very simple:

  • Untitled Trigger 001
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Flame Strike
    • Actions
      • Unit - Order (Triggering unit) to Stop
      • Game - Force (Owner of (Triggering unit)) to press the key F
This solution doesn't work if the unit is not currently selected by a player, but AI couldn't cast this spell anyway, so not a big deal. Also something has to be done to detect cancelling the spell. Thanks to everyone who has helped, this can be considered solved now.
 
Status
Not open for further replies.
Top