HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Detecting a Left-Click

02-06-2004, 05:44 PM#1
DoctorDoom
In a map I'm working on I need a method for the detection of both left and right clicking. Currently I have a building that can move and is always selected, the game forces you to press M whenever any order or selection occurs. But if you right click it will cancel the movement and you can then right click again, this sets a rally point allowing the detection of right clicking. Now this method works fine for detecting left and right clicks on points in map and objects. The only problem is you have to double right click the first time you switch from left click to right. Picture diablo, left click attacks a unit and then right clicking imedietly fires off a spell. Thats how I need the detection to work. Now my map will work a little diffrently than diablo but you guys get the idea. Any ideas?
02-06-2004, 05:57 PM#2
35263526
Trackables.

More information here

Trackables are special objects created via JASS that can detect mouse clicks. The drawback is that they only work for singleplayer. WEU and UMSWE have GUI trackable functions.
02-06-2004, 06:01 PM#3
AllPainful
Hmm... Here is something you might try for left/right clicking on a unit:

Code:
Left Click
Event
  Unit is selected ???
Conditions
  Unit selected is enemy of player
Actions
  Order *** to attack selected unit

Right Click
Event
  Unit is issued order targeting unit
Conditions
  Unit is enemy of player
  Order is "Smart"
Actions
  Order *** to cast *** on target of issued order

I don't know if thats what you want... Sorry if I was of no help...





EDIT: That trackables thing looks promising if its single player. 35263526 responded while I was typing my response.
02-06-2004, 06:58 PM#4
DoctorDoom
Quote:
Originally posted by AllPainful
Hmm... Here is something you might try for left/right clicking on a unit:

Code:
Left Click
Event
  Unit is selected ???
Conditions
  Unit selected is enemy of player
Actions
  Order *** to attack selected unit

Right Click
Event
  Unit is issued order targeting unit
Conditions
  Unit is enemy of player
  Order is "Smart"
Actions
  Order *** to cast *** on target of issued order

I don't know if thats what you want... Sorry if I was of no help...



That works fine for right and left clicking on objects but I need it to work on points f the map as well. And as far as that trackable thing goes I'm looking into it. Not shure if it'll be able to do exactly what I need it to do, but its a sweet effect none the less.

*Edit* The trackables doesn't allow for what I need exactly. Thanks for the help guys, I'll leave this post up and hope for some replies, in the meantime I can work around the problem or work with it in the game.
02-06-2004, 07:30 PM#5
AllPainful
Well.. for right clicking on the map.. you could

Code:
Right Click
Event
  Unit is issued order targeting a point
Conditions
  Order is "Smart"
Actions
  Order *** to...

But for left clicking on the map.... don't know...
02-07-2004, 02:49 PM#6
DoctorDoom
Well thats what I'm in need of so does anyone have any ideas? I've worked on this for quite a while so I'm almost shure it can't be done anyway but what I have but I'd truely appreciate a working means for this.
02-07-2004, 07:43 PM#7
DoctorDoom
Any ideas? If none pop up I'm just gonna adjust my RPG to coincide with that little need for double clicking to right click.
02-07-2004, 08:06 PM#8
LegolasArcher
Just out of curiousity, what is "smart" ordercode? Ive seen it, but Ive never been sure what it did.
02-07-2004, 08:12 PM#9
Shark
right click is smart...if clicked on plain ground, its move, when clicked on trees, its harvest, when clicked on enemy unit, its attack....

does right clicking and clicking "harvest" return as the same order ?
02-07-2004, 09:32 PM#10
AllPainful
Quote:
does right clicking and clicking "harvest" return as the same order ?

Yes and no.

Clicking harvest and clicking a goldmine gives that "Harvest" order.

Right clicking on a goldmind gives the "Smart" order which then gives the unit the "Harvest" order.


So either way the unit gets the "Harvest" order.
02-08-2004, 12:45 AM#11
Quetz2
Can you make a unit that has terrain art as its model? If so just remove the lifebar somehow and make a trigger so that wen you select it, the game detects the left click, and then unselects the unit.

Seriously doubt this is practical or if it will work at all.:D
02-08-2004, 01:40 AM#12
johnfn
Alright, here's my weird/best idea: Make an invisible unit, and make it really big. Turn its collision off, so nobody notices its there. Then put it where you want to detect left clicks. Make a trigger to detect if its selected. When it is, re-select the unit that was originally there. THen do whatever you want. Thats me best idea.
02-08-2004, 04:18 PM#13
DoctorDoom
Quote:
Originally posted by johnfn
Alright, here's my weird/best idea: Make an invisible unit, and make it really big. Turn its collision off, so nobody notices its there. Then put it where you want to detect left clicks. Make a trigger to detect if its selected. When it is, re-select the unit that was originally there. THen do whatever you want. Thats me best idea.


Ok idea but two things, A unit can only be truely invisible (its opaque otherwise)if it belongs to another player. And you can't select invivsible units that arn't yours. Plus I need to detect a left click anywhere on the visable map and selecting a unit will only be able to detect that you clicked left, not where. Thanks anyway though.