Staredit Network > Forums > SC2 Assistance > Topic: DIsable movement with right-click
DIsable movement with right-click
Aug 14 2010, 11:34 pm
By: deathfromace  

Aug 14 2010, 11:34 pm deathfromace Post #1



I did a search on this and found nothing and have tried a lot of different triggers and nothing works. If I do get movement disabled it is at the price of taking off attacking enemies and picking up items with right-click as well and I don't want to lose those two things. Does anyone have a way that simply takes walking off of right-click but does not hinder attacking and picking up items? Or a way to just make it where a player can't simply click on the other side of a wall to get the game to auto walk there for him.



None.

Aug 14 2010, 11:48 pm Temp Post #2



You might be able to do this through detecting the right click and stopping the move order. It will really only work if you have a couple units per player though.



None.

Aug 15 2010, 12:48 am deathfromace Post #3



Yeah I made a trigger for that with rightclick being pressed down. But I could not get it to only do movement and not alter attacking and item pick up. Unless there is a way I didn't try?



None.

Aug 15 2010, 1:46 am Temp Post #4



I'm going to assume that the mouse click event will happen before an order event. So you would set a boolean variable in the mouse click trigger. In another trigger with an order (move) event have a condition that checks to see if the boolean is true.

Edit: It is probably just better to check the units order's through the Unit Order function to check to see if the unit has a move order in it's queue



None.

Aug 15 2010, 3:50 am payne Post #5

:payne:

Just wondering: the FPS maps we see around have it disabled.
Could it be because they've managed to kind of unselect the main hero?



None.

Aug 15 2010, 4:44 am deathfromace Post #6



How would I go about checking the move order? I don't know a lot of things about the editor yet other then what I have taught myself and can't save I have come across a move order and not sure on the whole boolean thing.


I tried the boolean thing but I have never done it before so I am sure I am way off.

Quote
player rightclick
Events
UI - Player 1 clicks Right mouse button Down.
Local Variables
movement = false <Boolean>
Conditions
Actions

Quote
player rightclick 2
Events
Unit - Any Unit uses Move at Generic1 - Any stage (Ignore shared abilities)
Local Variables
Conditions
movement == true
Actions
Quote
movement = true <Boolean>




None.

Aug 15 2010, 4:46 am shmeeps Post #7



Quote from payne
Just wondering: the FPS maps we see around have it disabled.
Could it be because they've managed to kind of unselect the main hero?
I believe the main difference is this trigger:

Code
Camera - Lock camera mouse relative mode On for player Counter


Which actually hides the mouse cursor, preventing any selection input. Essentially, yeah, it's because most of the times the unit is not selected. Even if it were, if that were turned on, it wouldn't register any mouse clicks.



None.

Aug 15 2010, 4:54 am deathfromace Post #8



Yeah I use a combination of the relative mode on my left click but while its good and all for hiding the cursor it also makes it so I can't attack or pick up items so im back in the same crappy boat as before.



None.

Aug 15 2010, 5:00 am shmeeps Post #9



Can you gives us a little bit more information on this? It sounds like you've created a FPS, or something similar, but still want to be able to pick up items and attack people using the right click, but not have it move if neither of the above two are valid?



None.

Aug 15 2010, 5:07 am deathfromace Post #10



Its actually a dungeon crawler type game. Every stage is going to be a labyrinth and it kind of defeats the purpose of it if they can just click on the other side of a wall and let the unit auto run though it. I really don't want it to move at all but if that can't be done with keeping attacking and item pickup I can deal with just making it so the unit can't path though the whole thing at all but I have yet to find how to do that...if that can be done.

I have done a trigger that looked something like this
Quote
event - player 1 rightclicks down

if - player uses ability move

then - make player stop

else - dont stop...or w/e that was

but it sadly you "move" to items and enemies so it didn't work.



None.

Aug 15 2010, 6:21 am shmeeps Post #11



It is possible to get the x,y,z position of the mouse on click. It could be possible to check to see if that position is within sight range of the unit, and if it is, then issue the command. From there you could check to see if an item existed close by, and attempt to pick it up if it was by making the move command target it.

It would look something like

Code
Event
   -Player press right mouse button
Local Variable
   -ClickedPoint
Actions
   -Set ClickPoint to MouseX, MouseY, MouseZ
   -If (Distance Between ClickedPoint and Position of Unit < Unit Sight Range)
       -Then
           -Move Region to ClickedPoint
           -If (At least 1 Item exists in Region)
               -Order Unit to Move Targetting Item
           -IElse
               -Order Unit to Move to ClickedPoint
       -Else
               -Wait .01 Seconds
               -Order Unit to Stop


It's very rough, and depends on if we detect items inside of regions, and even them if targetting move an item through a trigger will pick it up.



None.

Aug 15 2010, 7:33 am Temp Post #12



Sight range would not work very well. Being up against a wall you would not be able to see the other side but your range would extend there anyway.



None.

Aug 15 2010, 10:28 am deathfromace Post #13



Is there no way to just make it so the unit wouldn't just walk though the whole thing? Normally if there is not a way to the point clicked the unit just does nothing.



None.

Aug 16 2010, 1:20 am TheFreak Post #14



Have you tried removing the Move ability from the unit in the Data Editor? I don't know how you will make it move after that but I just tried it and still moves to pick up items when you right click them and still moves to attack a target when you right click them.

Just a thought.

~TheFreak.



None.

Aug 16 2010, 1:23 am Temp Post #15



Removing the move ability stops the unit from being able to move. As far as I know there is no other way to let a unit move (except triggers).


The only way I see to do this is implement your own pathing via triggers. Would be very difficult but possible to do.



None.

Aug 16 2010, 3:19 am shmeeps Post #16



Quote from Temp
Sight range would not work very well. Being up against a wall you would not be able to see the other side but your range would extend there anyway.
I was hoping there might be a way to detect if the area is visible or not, but I didn't see any actions for it. Was hoping someone might be able to extend upon it.



None.

Aug 16 2010, 4:13 am TheFreak Post #17



Alright so I went into the editor and started trying some stuff out.

I came up with this. This will cancel your move order unless it was issued at a position that is currently visible to the player. So if you are next to a wall but you can still see the other side of it then you will still move to it as pointed out before. No matter how far you have to go around it or whatever it will still move there (or try, if there is no connecting path).



For this to work, whoever player you set to be the owner of the created "dummy" unit can't have shared vision with the same player you want this trigger to apply to. in my example player 0 is neutral and is not allied with anyone so it works.

Also note, this happens so fast that even if you could see the unit spawning somehow you wouldn't actually see the "dummy" unit. if you want to make sure it is never seen then you can make it be a cloaked unit or something.

Hope this is what you need.

~TheFreak



None.

Aug 16 2010, 5:26 am Temp Post #18



You can actually make units with no models or with no draw flag checked, that would work really well.



None.

Aug 16 2010, 5:43 am TheFreak Post #19



Yeah you could do as Temp suggests, it will probably even make it more efficient. Also, I would suggest some sight blockers on top of the walls unless it goes against the design of your map.



~TheFreak



None.

Aug 16 2010, 5:53 am shmeeps Post #20



Quote from TheFreak
Alright so I went into the editor and started trying some stuff out.

I came up with this. This will cancel your move order unless it was issued at a position that is currently visible to the player. So if you are next to a wall but you can still see the other side of it then you will still move to it as pointed out before. No matter how far you have to go around it or whatever it will still move there (or try, if there is no connecting path).



For this to work, whoever player you set to be the owner of the created "dummy" unit can't have shared vision with the same player you want this trigger to apply to. in my example player 0 is neutral and is not allied with anyone so it works.

Also note, this happens so fast that even if you could see the unit spawning somehow you wouldn't actually see the "dummy" unit. if you want to make sure it is never seen then you can make it be a cloaked unit or something.

Hope this is what you need.

~TheFreak
Very innovative, wouldn't have thought of that.

No draw flag will probably be above no model, sometimes certain things will still render as a small sphere if they have no associated model.



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[06:18 am]
Sylph-Of-Space -- No complaints here, i'm just curious!
[11:05 pm]
Ultraviolet -- :wob:
[03:55 pm]
Zoan -- :wob:
[2024-5-18. : 10:34 am]
NudeRaider -- SEN doesn't rely on spammers initiate its sleep cycle. It hat fully automated rest and clean-up phases. Please understand that this is necessary for the smooth operation of the site. Thank you.
[2024-5-18. : 3:45 am]
Sylph-Of-Space -- Does the shoutbox get disabled when there's spammers?
[2024-5-17. : 6:47 am]
NudeRaider -- lil-Inferno
lil-Inferno shouted: nah
strong
[2024-5-17. : 5:41 am]
Ultraviolet -- 🤔 so inf is in you?
[2024-5-17. : 4:57 am]
O)FaRTy1billion[MM] -- my name is mud
[2024-5-17. : 4:35 am]
Ultraviolet -- mud, meet my friend, the stick
[2024-5-16. : 10:07 pm]
lil-Inferno -- nah
Please log in to shout.


Members Online: Moose, RIVE