Hi, I have spent hours trying to figure out how to get my units to move with WASD Controls, while in third person mode, the biggest problem is that i cant get them to move with any WASD Controls, whether it is from normal view or 3rd person view or anything. I have tried implementing other peoples controls and everything but my guys just wont move. I am spawning guys from a unit menu that i created, so i choose my units and then they spawn at a spot and i can move them with my mouse and make the camera rotate with them well, with clicking, but i cant figure out how to get them to move with WASD. I think the problem may rest with adjusting the triggers where it says "unit". I've tried putting in "last created unit", "picked unit", "triggering unit". I need a little help here because i cannot figure it out. If you need more info on what i'm doing or trying to do, let me know.
You have to specify the unit you want to move. You could use "selected unit" if you want the controls to move your selected unit. If there is just one unit you want to move, you could set that unit as a variable and then move that unit using the variable.
well i just spent another hour trying to figure out what you said, but i still cant get it. the problem i'm having is i dont know how to specify the specific unit i want to move. The unit doesnt exist until i create it from the unit menu. I also dont see "selected unit" anywhere, so can you be as specific as possible, as to what i need to do, to get this dang unit to move.
Have a unit variable titled "Current Unit" then have a trigger that is triggered by "unit is selected" and then set "Current Unit" to "triggering unit.
So...
Event: Unit is Selected
Conditions: Whatever that unit needs to be. (So it it isn't a structure or whatever)
Actions: Set Variable: Current Unit = triggering unit
You are probably going to need a trigger that zooms in on the unit, and then clears the variable when the unit dies.
Well I'm too dumb to figure it out still..... so this is what it looks like on my end, and i'm going to continue to mess with it, but here is the basics
Words in Bold are variables i created and you cant see.
Events
........Unit Selection - (Triggering Unit) is Selected by player (Triggering player)
........Timer - Every 0.1 seconds of Game Time
Local Variables
........current unit = Any Unit <Unit>
Conditions
.......(Owner of (Triggering unit)) == 1
Actions
.......Variable - Set current unit = (Triggering unit)
.......General - If (Conditions) then do (Actions) else do (Actions)
..............If
..................And
........................Conditions
...............................W_on == true
...............................A_on == false
...............................D_on == false
...............................S_on == false
................Then
......................Unit - Order (Triggering unit) to ( Move targeting ((Position of (Triggering unit)) offset by 0.5 towards (Run Angle + 0.1) degrees)) (Replaced Existing Orders)
simple,
I assume you select this unit through some menu, built off of triggers,
create a variable called "PlayerUnit" and set it from "integer" to "unit" (make sure this variable is not "inside" a trigger but outside, if you want to call on this variable from other triggers.)
Find the spot in your trigger work, where you actually create said unit, then create an action "setVariable" and set "PlayerUnit" to "UnitLastCreated"
And from that point on you can call "LastCreatedUnit" to get your unit.
If you would like to set PlayerUnit, to whatever unit you select with the mouse, just create another trigger, give it an event called "TriggerAddEventUnitSelected"
then in the actions you will create an action "setVariable" and set "PlayerUnit" to "EventUnit"
I will document every piece of code for you to give you an idea of what everthing does. It wont be much, as all the code put together is only about 20 lines max.
(btw, whenever your looking for an event, condition, or action, try the search bar above the list. This will help you find stuff that has weird stuff in front of what your looking for like like TriggerAddEventUnitSelected
If you would like, send me the map, I will put in triggers that will have the camera follow any unit you select, also, your unit will face in the direction of your camera, so if you rotate your screen your unit rotates with it, so it is always facing away from you, as if it was a firstpersonshooter.
I got your map, I will continue to update you what I found wrong and fixed via this thread so everyone else may learn.
So far:
cool... I see you created my PlayerUnit variable and set that to UnitLastCreated. However you set this BEFORE you created the unit. I moved this right after your create unit command.
okay... Your camera triggers are actually pretty decent, however I have a set of triggers, that:
A. Contain about half the code.
B. Contain about half the triggers and variables
Will be more efficient.
Dont know... If you want this or not, but I also added UP, DOWN, LEFT, RIGHT keys to your WASD triggers. That way you can move your unit with either set.
wow... Also, you have like 50 million lines, just to make a unit move faster aka Run... I am going to take that out and put in a few lines that just change the current units movement properties!! (and since the wasd system uses the units movement , you will effectively move faster.
your the boss. whatever it takes. but with the up down left right movement... i had it set up so, up, made the camera on the unit look farther down, and the down button made the camera look up. if you know what i mean, but it really isnt a big deal.
uh I got a question, I just noticed what you ment by that, If I have the camera control the facing of the unit, and the mouse control the camera, then I dont need the UP/DOWN to change the way the camera looks right? If thats the case, I will keep my UP/DOWN code as is and add the mouse to camera support.
ummm.... well i dont want to control my guy like a First Person Shooter. i just want to have the camera follow him from a back position, kindof like a car game. probably should have told you that...... my bad.
It was actually very hard to find someones map that actually does that, or a tutorial or anything. I dont know if it is any easier or harder to do, but i couldn't find one. All i could really find was like a FPS style. Because i plan to make this game like a car game in the seemingly so distant future.
yep. W moves car forward, A left, S reverse (if possible, if not then thats ok), D right, left and right aroow can turn too. i'm in vent if you want to talk, i'll PM you the info.
ya first thing i did was test the map and i noticed i cant cycle through the unit menu anymore, so i will look at that, but i can finally move my unit with WASD so happy about that. now what exactly did you want to know about the camera system? was it the unit menu? or how i want the camera to follow the unit?
fixed the unit menu thing, can cycle through it again. you had deleted the (Used dialog item) == Left Button thing under the first General set under If.
Ok, thanks a lot for what you have done so far. Now that the guy is moving i need him to start moving so the camera follows his movements and what I am wanting is for W always make the unit move forward (but not always towards the North direction if you know what i mean). and A&D turn the unit from how the camera is facing (not always East and West of the map). For instance i want it to be controled like this link
Hi, I have spent hours trying to figure out how to get my units to move with WASD Controls, while in third person mode, the biggest problem is that i cant get them to move with any WASD Controls, whether it is from normal view or 3rd person view or anything. I have tried implementing other peoples controls and everything but my guys just wont move. I am spawning guys from a unit menu that i created, so i choose my units and then they spawn at a spot and i can move them with my mouse and make the camera rotate with them well, with clicking, but i cant figure out how to get them to move with WASD. I think the problem may rest with adjusting the triggers where it says "unit". I've tried putting in "last created unit", "picked unit", "triggering unit". I need a little help here because i cannot figure it out. If you need more info on what i'm doing or trying to do, let me know.
@baca25: Go
You have to specify the unit you want to move. You could use "selected unit" if you want the controls to move your selected unit. If there is just one unit you want to move, you could set that unit as a variable and then move that unit using the variable.
@Nebuli2: Go
well i just spent another hour trying to figure out what you said, but i still cant get it. the problem i'm having is i dont know how to specify the specific unit i want to move. The unit doesnt exist until i create it from the unit menu. I also dont see "selected unit" anywhere, so can you be as specific as possible, as to what i need to do, to get this dang unit to move.
@baca25: Go
Have a unit variable titled "Current Unit" then have a trigger that is triggered by "unit is selected" and then set "Current Unit" to "triggering unit.
So...
Event: Unit is Selected Conditions: Whatever that unit needs to be. (So it it isn't a structure or whatever) Actions: Set Variable: Current Unit = triggering unit
You are probably going to need a trigger that zooms in on the unit, and then clears the variable when the unit dies.
Great to be back and part of the community again!
Well I'm too dumb to figure it out still..... so this is what it looks like on my end, and i'm going to continue to mess with it, but here is the basics
Words in Bold are variables i created and you cant see.
Events
........Unit Selection - (Triggering Unit) is Selected by player (Triggering player)
........Timer - Every 0.1 seconds of Game Time
Local Variables
........current unit = Any Unit <Unit>
Conditions
.......(Owner of (Triggering unit)) == 1
Actions
.......Variable - Set current unit = (Triggering unit)
.......General - If (Conditions) then do (Actions) else do (Actions)
..............If
..................And
........................Conditions
...............................W_on == true
...............................A_on == false
...............................D_on == false
...............................S_on == false
................Then
......................Unit - Order (Triggering unit) to ( Move targeting ((Position of (Triggering unit)) offset by 0.5 towards (Run Angle + 0.1) degrees)) (Replaced Existing Orders)
......................General - Skip remaining actions
................Else
*more of the same thing
I know this is probably basic stuff, but it sure is confusing.
simple, I assume you select this unit through some menu, built off of triggers,
create a variable called "PlayerUnit" and set it from "integer" to "unit" (make sure this variable is not "inside" a trigger but outside, if you want to call on this variable from other triggers.)
Find the spot in your trigger work, where you actually create said unit, then create an action "setVariable" and set "PlayerUnit" to "UnitLastCreated"
And from that point on you can call "LastCreatedUnit" to get your unit.
If you would like to set PlayerUnit, to whatever unit you select with the mouse, just create another trigger, give it an event called "TriggerAddEventUnitSelected" then in the actions you will create an action "setVariable" and set "PlayerUnit" to "EventUnit"
I will document every piece of code for you to give you an idea of what everthing does. It wont be much, as all the code put together is only about 20 lines max.
(btw, whenever your looking for an event, condition, or action, try the search bar above the list. This will help you find stuff that has weird stuff in front of what your looking for like like TriggerAddEventUnitSelected
If you would like, send me the map, I will put in triggers that will have the camera follow any unit you select, also, your unit will face in the direction of your camera, so if you rotate your screen your unit rotates with it, so it is always facing away from you, as if it was a firstpersonshooter.
@ibebusiness: Go
I got your map, I will continue to update you what I found wrong and fixed via this thread so everyone else may learn.
So far: cool... I see you created my PlayerUnit variable and set that to UnitLastCreated. However you set this BEFORE you created the unit. I moved this right after your create unit command.
okay... Your camera triggers are actually pretty decent, however I have a set of triggers, that: A. Contain about half the code. B. Contain about half the triggers and variables Will be more efficient.
@ibebusiness: Go
Great. Thanks again.
@baca25: Go
Dont know... If you want this or not, but I also added UP, DOWN, LEFT, RIGHT keys to your WASD triggers. That way you can move your unit with either set.
wow... Also, you have like 50 million lines, just to make a unit move faster aka Run... I am going to take that out and put in a few lines that just change the current units movement properties!! (and since the wasd system uses the units movement , you will effectively move faster.
@ibebusiness: Go
your the boss. whatever it takes. but with the up down left right movement... i had it set up so, up, made the camera on the unit look farther down, and the down button made the camera look up. if you know what i mean, but it really isnt a big deal.
@baca25: Go
oh, its a 2 second change, I will just switch the two up/down buttons!
@ibebusiness: Go
uh I got a question, I just noticed what you ment by that, If I have the camera control the facing of the unit, and the mouse control the camera, then I dont need the UP/DOWN to change the way the camera looks right? If thats the case, I will keep my UP/DOWN code as is and add the mouse to camera support.
@ibebusiness: Go
ummm.... well i dont want to control my guy like a First Person Shooter. i just want to have the camera follow him from a back position, kindof like a car game. probably should have told you that...... my bad. It was actually very hard to find someones map that actually does that, or a tutorial or anything. I dont know if it is any easier or harder to do, but i couldn't find one. All i could really find was like a FPS style. Because i plan to make this game like a car game in the seemingly so distant future.
Okay... So the left and right turns the "car" and up and down changes the cameras view, down and up correct?
@ibebusiness: Go
yep. W moves car forward, A left, S reverse (if possible, if not then thats ok), D right, left and right aroow can turn too. i'm in vent if you want to talk, i'll PM you the info.
I send you a pm with a link to the file, please download and tell me if you can work with it. (I dont quite understand your camera system just yet)
@ibebusiness: Go
ya first thing i did was test the map and i noticed i cant cycle through the unit menu anymore, so i will look at that, but i can finally move my unit with WASD so happy about that. now what exactly did you want to know about the camera system? was it the unit menu? or how i want the camera to follow the unit?
@baca25: Go
fixed the unit menu thing, can cycle through it again. you had deleted the (Used dialog item) == Left Button thing under the first General set under If.
@ibebusiness: Go
Ok, thanks a lot for what you have done so far. Now that the guy is moving i need him to start moving so the camera follows his movements and what I am wanting is for W always make the unit move forward (but not always towards the North direction if you know what i mean). and A&D turn the unit from how the camera is facing (not always East and West of the map). For instance i want it to be controled like this link
Lol, that was EXACLTY what I was talking about!!! alright Ill Finnish getting that for you .
(I don't know why I almost pressed ctrl+F9 to press the reply button. Too much starcraft map testing!!!)