Hey guys! I am trying to figure out a better way to implement my aiming/attacking system. Currently I am using the method thought up by OneTwo where you use a movable region that goes where you click and orders the player unit to attack the unit closest to the center of the region. Here is the code:
This works fairly well, except for a few glaring problems. For one, if your view is angled toward the horizon and you right click on a larger enemy to attack, then the region will end up way behind the unit you're trying to attack. What I would really like to do is set up a trigger where you can attack whichever unit you have your cursor on top of. Keep in mind that units are non-selectable and the UI is hidden. Any suggestions would be very appreciated :D I can also post the map if need be.
They are using tracelines in that map I believe. I was looking for something more like when you select your own unit and then right click on an enemy unit to issue the attack order. Minus the select your own unit part. The main reason I don't want you to select your own unit is because I don't want a bunch of talking, I don't want click move, and I am using the the left mouse button for changing the camera angle.
If your doing what it sounds like your doing, its a WoW style adaptation to starcraft 2? Basically your looking to be able to intuitivly right click any enemy, and your hero unit will attack that unit. What a couinkidink, im doing the same thing :). Heres how i solved the 12 target select problem.
First make a variable called Target, unit variable, and it will be your target unit (IE the enemy your attacking)
Now make it so your hero unit is always selected (in this case, i used a simple trigger that repeats every 5 seconds that causes each player to select their respective hero.
Lastly, make a trigger, with the event Unit Selection - Any Unit is clicked by Player Any Player. When the unit is clicked, store that unit in the targeting variable. This will save your butt when you decide you want to order your hero to perform an ability on the unit you have targeted (Order your hero unit to perform ABILITY on TARGET variable). Now whenever you right click any enemy in the game, your hero unit is already selected, and he will run and beat up the enemy.
There is a few polish issues, mainly you dont want the lines or cursors all over the place. Go into the data editor, select Move and Attack. In there under UI - Orders+ is the link to your actor for the lines and the selection cursor. Turn the lines to BLACK.dds and your cursor to INVISIBLEUNIT.m3. Now when you attack, move around with WASD and follow stuff, there isnt that pesky line.
Let me know if you need anything else, ive worked this pretty extensivly. My game Jaded Space will be hitting beta in about a week and a half, you can see what i did with it :)
Standard SC2 click (attack/ability/ cast) UI is the best. You can not make it better. If you try you will fail. If you dont like the normal UI functionality it prolly means you dont play much SC/WC3/SC2/WOW/D1/D2/.
IMO learn how to make the standard UI operations work better for you not against you. Players love a very functional UI where they dont have to learn a whole bunch of new UI elements.
That's terrible advice, IMHO. The engine is capable of many different styles of input and interface, and many games play better with non-RTS style controls. It's incredibly short-sighted to suggest that mapmakers should simply not use all the awesome tools to change the interface Blizzard designed for us. You'd have to be very new to gaming, or a diehard Blizz RTS fan who literally sees no entertainment value in any other genre of game to think that redesigning every potential map idea around the default UI is the best way to move forward. If you don't like more complex maps, don't play them, but I strongly disagree that most players prefer a map that sticks to the default UI. There are few things as impressive as a map with a well-implemented custom control and interface system.
For example: are you honestly suggesting that an FPS map would be better suited just having everyone a+move a unit with default style controls as opposed to, you know, FPS controls? You can say "I don't want to play FPS maps," but plenty of people *do* want to make - and play - them. The OP is clearly working on a map where a custom interface is a major part of the game design. Your suggestion may make sense for some projects, but not this one.
This is pretty much what you want. You also need to make sure when unhighlighting, that the unit being unhighlighted was clicked on in the first place. Otherwise if you click on the ground, unit, doodad etc. and then drag the mouse over a unit and release, you will begin to attack it.
Your tutorial was actually quite helpful to me Huesy. I was able to set up four triggers to make it work the way I wanted to. The way it works is that you are able to hold the right mouse button down anywhere and if you drag it over a hostile unit it will begin attacking (if you release the right mouse button you will stop attacking and will have to highlight a unit and right click to begin attacking again). I did it this way because kiting is going to be essential to the gameplay, and some of the smaller enemies like zerglings can be very difficult to pinpoint and click with the mouse while they're moving. You can also switch targets without having to release the right mouse button this way. I tried killing the attack command once the target became unhighlighted to make it more realistic, but in the end it turned out to be too tedious due to obstacles like trees. Anyways, here are the triggers.
As for using the regular UI, I think Solistus pretty much summed it up. Until Blizzard implements a cursor tracking function for Diablo type movement, I feel like clickclickclickclickclickclickclickclickclick to move is too cumbersome and unintuitive. I am aware of WASD lag which is why I am not currently planning on publishing my map to popularity.net. (It will be single player)
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hey guys! I am trying to figure out a better way to implement my aiming/attacking system. Currently I am using the method thought up by OneTwo where you use a movable region that goes where you click and orders the player unit to attack the unit closest to the center of the region. Here is the code:
This works fairly well, except for a few glaring problems. For one, if your view is angled toward the horizon and you right click on a larger enemy to attack, then the region will end up way behind the unit you're trying to attack. What I would really like to do is set up a trigger where you can attack whichever unit you have your cursor on top of. Keep in mind that units are non-selectable and the UI is hidden. Any suggestions would be very appreciated :D I can also post the map if need be.
Have you played the StarShip Troopers FPS map? Something like that is what your talking about i think but im not sure how to make it..
@Hoplite141: Go
I will go look for it, thanks.
@voodude2008: Go
They are using tracelines in that map I believe. I was looking for something more like when you select your own unit and then right click on an enemy unit to issue the attack order. Minus the select your own unit part. The main reason I don't want you to select your own unit is because I don't want a bunch of talking, I don't want click move, and I am using the the left mouse button for changing the camera angle.
@voodude2008: Go
If your doing what it sounds like your doing, its a WoW style adaptation to starcraft 2? Basically your looking to be able to intuitivly right click any enemy, and your hero unit will attack that unit. What a couinkidink, im doing the same thing :). Heres how i solved the 12 target select problem.
First make a variable called Target, unit variable, and it will be your target unit (IE the enemy your attacking)
Now make it so your hero unit is always selected (in this case, i used a simple trigger that repeats every 5 seconds that causes each player to select their respective hero.
Lastly, make a trigger, with the event Unit Selection - Any Unit is clicked by Player Any Player. When the unit is clicked, store that unit in the targeting variable. This will save your butt when you decide you want to order your hero to perform an ability on the unit you have targeted (Order your hero unit to perform ABILITY on TARGET variable). Now whenever you right click any enemy in the game, your hero unit is already selected, and he will run and beat up the enemy.
There is a few polish issues, mainly you dont want the lines or cursors all over the place. Go into the data editor, select Move and Attack. In there under UI - Orders+ is the link to your actor for the lines and the selection cursor. Turn the lines to BLACK.dds and your cursor to INVISIBLEUNIT.m3. Now when you attack, move around with WASD and follow stuff, there isnt that pesky line.
Let me know if you need anything else, ive worked this pretty extensivly. My game Jaded Space will be hitting beta in about a week and a half, you can see what i did with it :)
Chow!
@coronbale: Go
Sweet, thanks! This is what I'm looking for. I will be sure to check out your game as well :D
@voodude2008: Go
Figured this out. Pretty simple. Three triggers and one unit variable called Target.
@voodude2008: Go
Nice man, sounds great. Just curious though, were you planning on including a targeting system for special abilities?
Standard SC2 click (attack/ability/ cast) UI is the best. You can not make it better. If you try you will fail. If you dont like the normal UI functionality it prolly means you dont play much SC/WC3/SC2/WOW/D1/D2/.
IMO learn how to make the standard UI operations work better for you not against you. Players love a very functional UI where they dont have to learn a whole bunch of new UI elements.
@SouLCarveRR: Go
That's terrible advice, IMHO. The engine is capable of many different styles of input and interface, and many games play better with non-RTS style controls. It's incredibly short-sighted to suggest that mapmakers should simply not use all the awesome tools to change the interface Blizzard designed for us. You'd have to be very new to gaming, or a diehard Blizz RTS fan who literally sees no entertainment value in any other genre of game to think that redesigning every potential map idea around the default UI is the best way to move forward. If you don't like more complex maps, don't play them, but I strongly disagree that most players prefer a map that sticks to the default UI. There are few things as impressive as a map with a well-implemented custom control and interface system.
For example: are you honestly suggesting that an FPS map would be better suited just having everyone a+move a unit with default style controls as opposed to, you know, FPS controls? You can say "I don't want to play FPS maps," but plenty of people *do* want to make - and play - them. The OP is clearly working on a map where a custom interface is a major part of the game design. Your suggestion may make sense for some projects, but not this one.
This is pretty much what you want. You also need to make sure when unhighlighting, that the unit being unhighlighted was clicked on in the first place. Otherwise if you click on the ground, unit, doodad etc. and then drag the mouse over a unit and release, you will begin to attack it.
http://forums.sc2mapster.com/resources/tutorials/10136-trigger-clicking-with-camera-mouse-enabled/
@Huesy: Go
Your tutorial was actually quite helpful to me Huesy. I was able to set up four triggers to make it work the way I wanted to. The way it works is that you are able to hold the right mouse button down anywhere and if you drag it over a hostile unit it will begin attacking (if you release the right mouse button you will stop attacking and will have to highlight a unit and right click to begin attacking again). I did it this way because kiting is going to be essential to the gameplay, and some of the smaller enemies like zerglings can be very difficult to pinpoint and click with the mouse while they're moving. You can also switch targets without having to release the right mouse button this way. I tried killing the attack command once the target became unhighlighted to make it more realistic, but in the end it turned out to be too tedious due to obstacles like trees. Anyways, here are the triggers.
As for using the regular UI, I think Solistus pretty much summed it up. Until Blizzard implements a cursor tracking function for Diablo type movement, I feel like clickclickclickclickclickclickclickclickclick to move is too cumbersome and unintuitive. I am aware of WASD lag which is why I am not currently planning on publishing my map to popularity.net. (It will be single player)