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

Short But Difficult Question

Status
Not open for further replies.
Level 6
Joined
Apr 27, 2006
Messages
186
How can I order a unit to cast shockwave (or any point-targetable spell), but what I mean by cast is like... click it, so the targeting cursor comes up but the shockwave does NOT fire (allowing the caster to fire it himself)

Example:
Unit Casts a non-targetable spell: The Shockwave targeting reticule appears, allowing the caster to now cast shockwave (which was added via triggers when they cast the spell)
 
Level 6
Joined
Apr 27, 2006
Messages
186
Is there any way to detect the x and y position of a player's mouse and when it is clicked then?
 
Level 4
Joined
Dec 14, 2004
Messages
85
Your explanation doesn't make much sense, you need to explain it better. Mostly exactly how different is it from shock wave. Also, after you get the targeting cursor to come up, you want him to cast shock wave on his own? with no action from the human person controlling him? If so, what kind of behavior would he use to choose where he casts?

From what I did understand from the bottom part of the top post is, if you make a dummy non-targetable spell you could cast it, get rid of the non-targetable spell and then you can just replace it with a shockwave like spell I also think there is some way to force hot key pushes, but I have never had a use for them so I don't know exactly how it works, but I'm willing to bet that if you had it auto hit the hot key that you could bring up the target immediately after.
 
Level 9
Joined
Mar 25, 2005
Messages
252
JASS:
function True takes nothing returns boolean
    return true
endfunction
function IssueAimOrder takes unit whichUnit, string key returns nothing
    local player p = GetOwningPlayer(whichUnit)
    local group g  = CreateGroup()
    call GroupEnumUnitsSelected(g, p, Filter(function True))
    if (GetLocalPlayer() == p) then
        call ClearSelection()
        call SelectUnit(whichUnit, true)
        call ForceUIKey(key)
        call ForGroup(g, function SelectGroupBJEnum)
    endif
    call DestroyGroup(g)
    set g = null
endfunction

This function does what you want. I have only tested it in single player but it should work in multiplayer also afaik. It worked with shockwave and channel, but for some reason not with attack. When I called it with "A" as key (hotkey of attack), it seemed as if the unit attack-moved to his own position. But I guess that that doesnt bother you.

key is the hotkey of the spell
 
Level 6
Joined
Apr 27, 2006
Messages
186
Nvm, someone on another... forum told me how to do it doing the way Super Good thought wasn't possible, thanks for the help anyways :).
 
Last edited:
Status
Not open for further replies.
Top