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

Left and Right Clicking

Status
Not open for further replies.
Level 6
Joined
Jan 2, 2007
Messages
189
Is there any way to detect right/left clicking and where you clicked? For example, you LEFT click to move a unit to the position you left clicked, and you RIGHT click to make the unit instantly cast a spell where you right clicked. or vice versa. is there anyway i could do this?
 
Level 13
Joined
Sep 14, 2008
Messages
1,407
Mh there is the event "unit getting order targeting point" (something like this)

Maybe you can do something with that.

Something like ( I am not sure whether the condition exists..)

Event: Unit getting order targeting point
Condition: Order = move
Action: Cast spell
 
Level 6
Joined
Jan 2, 2007
Messages
189
nah, no action exists (maybe in WEU) idk.
but there is and event-unit issued order targeting a point
this works but how would i detect when a player left clicks on a point/unit now? I need to be able to detect right and left clicks.


right now i have it so i can always detect a left click and where you left clicked. but it dissables the unit from moving, not allowing me to detect right clicks!
 
Level 6
Joined
Jan 2, 2007
Messages
189
well it is possible. there is a map, i even think the hive has it. like TCX or something and its a shooter map. i'll try to find it. but basically you left click (not right click) to move your guy. i can do that. but when you right click your guy jumps, i can do that too. but what i cant do is make them work together (where you can right and left click). i'll try to find the map.

Here is the map:TcX 1.02b - The Hive Workshop - A Warcraft III Modding Site

and trackables, well from what ive heard there inneficient and use all jass, so ive never looked into it. but if this is wrong and i can use custom scripts and understand how to implement trackables into a map then i would like to know more :)
 
Level 6
Joined
Jan 2, 2007
Messages
189
well in your opinion should i find out how to use trackables? and if i spam the map with units thats a bit laggy. and i need the coordinates as exact as possible so i will need a lot of units...
and i know you probaly are busy but could you at least look at the map? i know how he/she did it but i dont know how to do it. they made you move by left clicking (casting a spell) but at the same time you could right click to jump. thanks.
 
Level 3
Joined
Aug 19, 2007
Messages
24
There are a few things you should know about trackables before you set off to learn how to use them.

1. Trackable events override all other events - selection, spell targeting, you name it. You cannot, for example, cast flame strike on a trackable nor can you select a unit at the same time you trigger a trackable event (if the unit is over the trackable, you will select the unit and the trackable event will not fire. the opposite is true if the unit is under the trackable)

2. Trackables cannot be moved or destroyed

3. There is no easy way to detect which player triggered a trackable event - there is a rather complex way, however

4. Trackable click events do not differentiate between right and left clicking

The only simple ways I've found to detect clicks are
1. Casting a point-targeted ability will let you detect left clicks
2. Having a unit selected will let you detect right clicks (by detecting the "smart" order)

I have not found a way to exploit detecting left-clicks to my satisfaction; there's no way (that I know of) to force a unit to stay in the 'targeting mode' forever - you can use ForceUIKey, but that makes a bunch of clicks and has its own issues

Detection of right-clicking can be done reasonably enough; make a trigger that cancels point, immediate, and target orders to a unit (using pause unit->issue "stop"->unpause unit) and do something when you detect a "smart" order.

If you use trackables for an entire map then you will have to re-build a lot of basic WC3 UI functionality, so good luck
 
Level 3
Joined
Sep 13, 2008
Messages
63
If you use trackables for an entire map then you will have to re-build a lot of basic WC3 UI functionality, so good luck

lol. I learned the hard way. Built the whole sha-bang; trackables for each player, alternatives to unit movement and attack, and other stuff. Then found out it just wasn't good enough. A 32 by 32 maps takes 12288 trackables alone. One word, lag.
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
even if these leak things are not true
you are expecting your unit to follow mouse while you hold mouse button
>>that<< is not posible
 
Status
Not open for further replies.
Top