The turning: A marine has no TurretZ attachment point, so it cannot turn itself with a turret. This is solved quite easily by adding an invisible model, which supports a turret (for example a phoenix) and attaching the marine to it.
The animation: A marine has no animations to run while shooting or to run backwards or sideways. So you can only make him play the Attack animation (causing his legs to not move) or the Move animation (causing his rifle to not point at the enemy, also he will "moonwalk" when moving backwards). Both of them would not look very good.
To fix this, you would need to edit the animations of the model with a 3d modelling program. You could possibly add an additional .m3a anmations file to avoid having to import a whole new model.
The turning: A marine has no TurretZ attachment point, so it cannot turn itself with a turret. This is solved quite easily by adding an invisible model, which supports a turret (for example a phoenix) and attaching the marine to it.
This sound good and easy, its basically a marine riding on a silver surf board thats invisible :)
Exactly how is this done? I have been trying to search for something just like this but i cant really find any good guides or examples i have good use of.
Look at the changes made to the marine unit, the marine actor and the weapon. Also look at the newly added turret and the 2 actors for the turret (the turret itself needs an actor and the model the turret uses needs another one).
Now all i have to do is try to understand how all this works, kinda wanna learn it as well. Is there some good guide out there that explain what each item that you made do and not just say "do this and ta da it works, now figure out what you just did" :) way to many guides like that out there.
Ok so here we go, You create a new model actor when the unit is created and then attach the unit actor (marine) to the model actor.
What i dont get is how the whole turret thing work.
I don't know any, so I will try to explain what I did, and why I did it:
First of all, we need to think about, what we can do, and what we will use to achieve it. We want a marine to fire his weapon while moving, and we want him to turn in the direction of his target while doing so.
The first thing is easily done by modifying the weapon. We set the Allowed Movement to Move (obviously) and uncheck the flags for Only fire at attack target and Only fire while attacking , because both of these flags prevent the unit from firing, when it is moving. This can be looked up in the Phoenix weapon, which has a similar setup.
Now the marine can fire while moving, but it cannot turn, so it will only fire, if the enemy stands directly in front of him. We could set the Arc of the weapon to 360 degrees now to fix this, but this would not cause the marine to turn the way it fires.
Instead, we will use a Turret object, which is designed to make models turn with weapons. So we create a new turret. It has a whole bunch of settings, but we don't really need to change them for now. You can try for yourself what changing these values does to the marine.
Then we add the turret to the marine. This is done in the Weapons field, just change the turret for the main weapon from none to the new turret.
Now the marine can fire in all directions, but still doesn't turn to his target, because we didn't set up any actors for the turret yet.
The turret needs 2 actors, one is an actor of type Turret and the other one is a model actor, which should use a model with a TurretZ attachment point.
So we create a new actor, type Model, based on ModelAnimationStyleContinuous (without spaces). I took this actor base, because it does not get attached to the unit actor, it just follows its scope. This way, we can attach the unit actor to it (if this actor is attached to the unit actor and we would try to attach the unit actor to it, we have an attachment loop and it wouldn't work).
We set the model to Phoenix or any other model with a TurretZ attachment point and add an event like this:
UnitBirth.Marine
Create
Then we create the 2nd actor, this time of type Turret. We need to change the Turret Body field to the previously created turret model actor and add following event:
TurretEnable.(MyTurret)
Create
Again, most of these things can be figured out by looking at the phoenix turret actors. Also, it is covered in some turret tutorials.
Now we have an attached phoenix, which turns in the direction of the target the marine is shooting. But the marine itself still doesn't turn
So we need to attach the marine to the phoenix. This is done by setting the Hosting: Host+ field from the marine unit actor to the turret model actor. Additionaly, we need to add a site operation, usually SOpAttachTurret.
That should do it, now we have the marine turning into the direction he fires. Some minor adjustments, like hiding the phoenix by setting his opacity to 0. Notice, that I use the timer, so the phoenix is hidden correctly within the editor as well. You could hide it directly at ActorCreation, which would work ingame, but it would still be visible within the editor.
...and not just say "do this and ta da it works, now figure out what you just did" :) way to many guides like that out there.
Frankly, I learn a lot from these kinds of guides. I follow their instructions, get a working result. Quite some of the stuff already makes sense after that, and then I start experimenting with the result, change some values, observe the resulting changes ingame, try to create my own version.
Sure, a little background information is nice, but I usually learn faster from a good step-by-step tutorial, it is more result-oriented :)
The normal weapon cant target a point and i have to use a ability but how does that play out with the whole turret thing sense it weapon based?
Is there a way to turn the turret wherever i have the mouse?
How to make a unit always facing mouse pointer and be able to move in any direction at the same time? Kinda like a cannon on train you want to be able to aim with the mouse while the train is traveling. However, its an ability not a weapon the cannon use.
Please help me the whole concept of the map need this :)
Maybe not, I made a data testmap for this. It has some problems, but maybe they can be solved.
Select the stimpack ability for the marine, and it will face the mouse. If we can disable cancelling the ability via right-click or hitting escape, and we disable the alert when trying to target the ground we could edit the UI to make the ability button a sort of big "Start" button and it would work :)
How about adding a unit to the mouse that are constantly moved to the mouse pointer and then have the marine attacking that unit with a weapon doing 0 dmg?
I have been trying to do the above. When i press left mouse button a unit is created at the mouse pointer and i order the marine to attack it, and when i move the mouse the created unit follow the pointer, making the marine facing the mouse.
However for some freaking stupid reason does the marine start moving as well to that location. I press A key to move the unit left and i click left mouse button to the right of the unit and then the unit start moving right towards the newly created unit just like ti was planing to melee attack it. Check the uploaded file if the weapon has some flags wrong?
I would also like it to be a "passive weapon" that dont fire on enemy unit unless i tell it to..
So what i did was that i have a unit attached the the mouse pointer with triggers and then give the marine a weapon that can only fire on that target and nothing else so as soon as that unit is created then the marine will always face it (attack it).
Just the thing I was looking for. I spent so much time trying to figure it out that I almost gave up. Good thing there is someone like Kueken around :)
I read this nice explanation and the map attached. It was great and managed to fix my problem. Thank you !
hi, sorry for the bump.
i tried replicating the first linked example, and when i try moving the unit, the unit remains immobile but an invisible thing moves instead, when that thing gets near an enemy, the static unit will shot. what is wrong there?
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
How can make a a unit, for example a marine attack while moving AND tuning towards the target?
The attack while moving is easy but to make it turn towards the target (for example run backwards and shot of the target is behind the marine).
Well, 2 problems with this one:
To fix this, you would need to edit the animations of the model with a 3d modelling program. You could possibly add an additional .m3a anmations file to avoid having to import a whole new model.
This sound good and easy, its basically a marine riding on a silver surf board thats invisible :)
Exactly how is this done? I have been trying to search for something just like this but i cant really find any good guides or examples i have good use of.
I would do it like this.
Look at the changes made to the marine unit, the marine actor and the weapon. Also look at the newly added turret and the 2 actors for the turret (the turret itself needs an actor and the model the turret uses needs another one).
That look great.
Now all i have to do is try to understand how all this works, kinda wanna learn it as well. Is there some good guide out there that explain what each item that you made do and not just say "do this and ta da it works, now figure out what you just did" :) way to many guides like that out there.
Ok so here we go, You create a new model actor when the unit is created and then attach the unit actor (marine) to the model actor.
What i dont get is how the whole turret thing work.
I don't know any, so I will try to explain what I did, and why I did it:
Now the marine can fire while moving, but it cannot turn, so it will only fire, if the enemy stands directly in front of him. We could set the Arc of the weapon to 360 degrees now to fix this, but this would not cause the marine to turn the way it fires.
Now the marine can fire in all directions, but still doesn't turn to his target, because we didn't set up any actors for the turret yet.
We set the model to Phoenix or any other model with a TurretZ attachment point and add an event like this:
Now we have an attached phoenix, which turns in the direction of the target the marine is shooting. But the marine itself still doesn't turn
That should do it, now we have the marine turning into the direction he fires. Some minor adjustments, like hiding the phoenix by setting his opacity to 0. Notice, that I use the timer, so the phoenix is hidden correctly within the editor as well. You could hide it directly at ActorCreation, which would work ingame, but it would still be visible within the editor.
Frankly, I learn a lot from these kinds of guides. I follow their instructions, get a working result. Quite some of the stuff already makes sense after that, and then I start experimenting with the result, change some values, observe the resulting changes ingame, try to create my own version.
Sure, a little background information is nice, but I usually learn faster from a good step-by-step tutorial, it is more result-oriented :)
crap got stuck again :D
The normal weapon cant target a point and i have to use a ability but how does that play out with the whole turret thing sense it weapon based? Is there a way to turn the turret wherever i have the mouse?
Badly need help with this matter.
How to make a unit always facing mouse pointer and be able to move in any direction at the same time? Kinda like a cannon on train you want to be able to aim with the mouse while the train is traveling. However, its an ability not a weapon the cannon use.
Please help me the whole concept of the map need this :)
Those both involve triggers.
Contribute to the wiki (Wiki button at top of page) Considered easy altering of the unit textures?
https://www.sc2mapster.com/forums/resources/tutorials/179654-data-actor-events-message-texture-select-by-id
https://media.forgecdn.net/attachments/187/40/Screenshot2011-04-17_09_16_21.jpg
Maybe not, I made a data testmap for this. It has some problems, but maybe they can be solved.
Select the stimpack ability for the marine, and it will face the mouse. If we can disable cancelling the ability via right-click or hitting escape, and we disable the alert when trying to target the ground we could edit the UI to make the ability button a sort of big "Start" button and it would work :)
How about adding a unit to the mouse that are constantly moved to the mouse pointer and then have the marine attacking that unit with a weapon doing 0 dmg?
I have been trying to do the above. When i press left mouse button a unit is created at the mouse pointer and i order the marine to attack it, and when i move the mouse the created unit follow the pointer, making the marine facing the mouse.
However for some freaking stupid reason does the marine start moving as well to that location. I press A key to move the unit left and i click left mouse button to the right of the unit and then the unit start moving right towards the newly created unit just like ti was planing to melee attack it. Check the uploaded file if the weapon has some flags wrong?
I would also like it to be a "passive weapon" that dont fire on enemy unit unless i tell it to..
Getting the actor to face the mouse is a non issue. The problem is getting it to shoot in the direction of the cursor.
Contribute to the wiki (Wiki button at top of page) Considered easy altering of the unit textures?
https://www.sc2mapster.com/forums/resources/tutorials/179654-data-actor-events-message-texture-select-by-id
https://media.forgecdn.net/attachments/187/40/Screenshot2011-04-17_09_16_21.jpg
So what i did was that i have a unit attached the the mouse pointer with triggers and then give the marine a weapon that can only fire on that target and nothing else so as soon as that unit is created then the marine will always face it (attack it).
@Kueken531: Go
Just the thing I was looking for. I spent so much time trying to figure it out that I almost gave up. Good thing there is someone like Kueken around :) I read this nice explanation and the map attached. It was great and managed to fix my problem. Thank you !
hi, sorry for the bump. i tried replicating the first linked example, and when i try moving the unit, the unit remains immobile but an invisible thing moves instead, when that thing gets near an enemy, the static unit will shot. what is wrong there?