Hello, I'm in the process of making a sidescrolling arena map and I need some assistance. One of the weapons available in the game is the Grenade. The grenade is set to follow an arcing movement and explode if it hits any walls, ceilings, or any generally unpathable areas (It's a lil complicated). To keep the arc and falling speed looking atleast somewhat realistic, I've given the grenades a slow acceleration and a high top speed, so they accelerate downward correctly. Now, it looks fine as long as the unit is not moving or is moving downward, but if it's moving left or right or flying upward really fast it looks off. I need to be able to physically set the grenade's current velocity to match the player's velocity when he throws it, so the grenade moves correctly. Is there a way in the editor to set the unit's velocity?
Rowland was asking about this in chat. Actually he was asking for speed not velocity.
There is no direct function for it (though u can make it yourself)
Global_variable = saved position(current position of unit)
Periodically say 0.1 seconds
Local variable Speed
Set Speed = distance between(saved position, current position) / 0.1
{Comment: Start velocity X}
If
Condition Saved position.X > Current Position.X
Action Modify Speed *= -1
Else (Nothing)
{Comment: End velocity X}
Set Saved position = current position
if the stuff between comment were used
Speed is velocity
Interesting concept, but I'm not looking to get the unit's velocity, I'm looking to set it.
In the interest of the grenade, it would be something like this. If you were standing on a moving platform moving at 10mph and you threw a rock at a horizontal velocity of 30mph in the same direction the platform was moving, the horizontal speed of the rock would be 40mph.
In the game, I've got a reaper flying horizontally at a certain speed. He throws a grenade, which causes the game to create the grenade object with an initial moving speed of 0. The grenade then moves upward and arcs like it should, but the speed of the reaper is ignored. So in the rock - platform example it would be like the rock is ignoring the fact that you are moving when you throw it and would only be moving 30 mph. I need to physically set the units current speed to be equal to the reapers, both horizontally and vertically, at the point of it's creation.
Perhaps applying a behavior of some sorts that changes the units max and minimum movement speed to the value I need it at? But then I would either need a whole bunch of behaviors, or find a way to dynamically change the value... Hmmm...
Interesting concept, but I'm not looking to get the unit's velocity, I'm looking to set it.
In the interest of the grenade, it would be something like this. If you were standing on a moving platform moving at 10mph and you threw a rock at a horizontal velocity of 30mph in the same direction the platform was moving, the horizontal speed of the rock would be 40mph.
In the game, I've got a reaper flying horizontally at a certain speed. He throws a grenade, which causes the game to create the grenade object with an initial moving speed of 0. The grenade then moves upward and arcs like it should, but the speed of the reaper is ignored. So in the rock - platform example it would be like the rock is ignoring the fact that you are moving when you throw it and would only be moving 30 mph. I need to physically set the units current speed to be equal to the reapers, both horizontally and vertically, at the point of it's creation.
Perhaps applying a behavior of some sorts that changes the units max and minimum movement speed to the value I need it at? But then I would either need a whole bunch of behaviors, or find a way to dynamically change the value... Hmmm...
Hmmm.... I thought you needed to get unit's speed, adding more speed to projectile based on unit's speed rather than slowing the unit down. I thought I added the part where I put the extra speed to the projectile, but guess not. Must been pretty tired that day.
If you want to slow down the player while throwing the projectile, it's quite simple you can create a behavior that changes movement fraction (with short duration and hidden). Make the behavior stack-able by making the field -1. You can apply the behavior in a loop to make it look like the unit is accelerating.
Interesting concept, but I'm not looking to get the unit's velocity, I'm looking to set it.
If you can find the reaper's speed, then you can use that to set the speed of your grenade with whatever throw velocity you like added on. That's the purpose of zifoon's post I believe.
If you can find the reaper's speed, then you can use that to set the speed of your grenade with whatever throw velocity you like added on. That's the purpose of zifoon's post I believe.
Yeah that's what I thought but he wants to slow the reaper down, not add grenade speed. No idea but that's what he wants.
@zifoon: Go
I'm not looking to change the speed of the reaper unit, I'm looking to set the speed of the grenade. The grenade is a unit based off of the Baneling that I've altered to have a slow acceleration and high movement speed. When I create a grenade through triggers, I have a somewhat complex trigger that gives the unit x and y coordinates telling it where to move and alters it for gravity and that sort of thing. The problem is that it takes a bit of time for the grenade to reach top speed with the slow acceleration, and while the acceleration looks fine while the reaper isn't moving, it looks unnatural when the reaper is moving. To fix this, I need to find a way to physically set the grenade's speed to match the speed of the reaper throwing it, which I am unable to find.
@zifoon: Go I'm not looking to change the speed of the reaper unit, I'm looking to set the speed of the grenade. The grenade is a unit based off of the Baneling that I've altered to have a slow acceleration and high movement speed. When I create a grenade through triggers, I have a somewhat complex trigger that gives the unit x and y coordinates telling it where to move and alters it for gravity and that sort of thing. The problem is that it takes a bit of time for the grenade to reach top speed with the slow acceleration, and while the acceleration looks fine while the reaper isn't moving, it looks unnatural when the reaper is moving. To fix this, I need to find a way to physically set the grenade's speed to match the speed of the reaper throwing it, which I am unable to find.
Huh. I was right the first time? Then what's wrong? I told you how to find speed for the reaper. Use action to pick missile for the reaper then "Set Unit property" (picked unit)'s movement speed to Variable - Speed
Because the unit's Movement speed and the actual speed that the unit is moving are two different things? The unit's movement speed is the maximum speed the unit reaches while moving. If the unit had a high acceleration, then this wouldn't matter because it would reach it's top speed very quickly. But the grenade doesn't have a very high acceleration, and as such it takes atleast 5-10 seconds to reach it's movement speed.
I need to be able to set the unit's actual speed, not it's movement speed, to match the current actual speed of the reaper, which I can obtain through your trigger.
I'm having issues getting the actual speed set up.
Because the unit's Movement speed and the actual speed that the unit is moving are two different things? The unit's movement speed is the maximum speed the unit reaches while moving. If the unit had a high acceleration, then this wouldn't matter because it would reach it's top speed very quickly. But the grenade doesn't have a very high acceleration, and as such it takes atleast 5-10 seconds to reach it's movement speed.
I need to be able to set the unit's actual speed, not it's movement speed, to match the current actual speed of the reaper, which I can obtain through your trigger.
I'm having issues getting the actual speed set up.
Why do you have low accel if you going to change the speed of the projectile? It's contradictory.
If you want low accel then make it faster after certain range, it's in mover's option (Acceleration|Acceleration range)
Alternatively and a simpler method, you can make an upgrade that sets the baneling's acceleration speed. Use trigger to turn it on and off.
Try running it and pressing B while moving around to see what I mean. I'd like to set the grenade's speed to the reaper's speed at the moment of it's creation, then have it arc and fall smoothly like it does now with that extra movement speed added on. If this ends up becoming too much of an issue I might just keep it how it is because it's not really too huge of an issue, it just looks weird.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hello, I'm in the process of making a sidescrolling arena map and I need some assistance. One of the weapons available in the game is the Grenade. The grenade is set to follow an arcing movement and explode if it hits any walls, ceilings, or any generally unpathable areas (It's a lil complicated). To keep the arc and falling speed looking atleast somewhat realistic, I've given the grenades a slow acceleration and a high top speed, so they accelerate downward correctly. Now, it looks fine as long as the unit is not moving or is moving downward, but if it's moving left or right or flying upward really fast it looks off. I need to be able to physically set the grenade's current velocity to match the player's velocity when he throws it, so the grenade moves correctly. Is there a way in the editor to set the unit's velocity?
Velocity?
Rowland was asking about this in chat. Actually he was asking for speed not velocity.
There is no direct function for it (though u can make it yourself)
Global_variable = saved position(current position of unit)
Periodically say 0.1 seconds
Local variable Speed
Set Speed = distance between(saved position, current position) / 0.1
{Comment: Start velocity X}
If
Condition Saved position.X > Current Position.X
Action Modify Speed *= -1
Else (Nothing)
{Comment: End velocity X}
Set Saved position = current position
if the stuff between comment were used
Speed is velocity
If not
it's just speed
Interesting concept, but I'm not looking to get the unit's velocity, I'm looking to set it.
In the interest of the grenade, it would be something like this. If you were standing on a moving platform moving at 10mph and you threw a rock at a horizontal velocity of 30mph in the same direction the platform was moving, the horizontal speed of the rock would be 40mph.
In the game, I've got a reaper flying horizontally at a certain speed. He throws a grenade, which causes the game to create the grenade object with an initial moving speed of 0. The grenade then moves upward and arcs like it should, but the speed of the reaper is ignored. So in the rock - platform example it would be like the rock is ignoring the fact that you are moving when you throw it and would only be moving 30 mph. I need to physically set the units current speed to be equal to the reapers, both horizontally and vertically, at the point of it's creation.
Perhaps applying a behavior of some sorts that changes the units max and minimum movement speed to the value I need it at? But then I would either need a whole bunch of behaviors, or find a way to dynamically change the value... Hmmm...
allowing a bump for this, as I'm still looking for assistance here.
Hmmm.... I thought you needed to get unit's speed, adding more speed to projectile based on unit's speed rather than slowing the unit down. I thought I added the part where I put the extra speed to the projectile, but guess not. Must been pretty tired that day.
If you want to slow down the player while throwing the projectile, it's quite simple you can create a behavior that changes movement fraction (with short duration and hidden). Make the behavior stack-able by making the field -1. You can apply the behavior in a loop to make it look like the unit is accelerating.
If you can find the reaper's speed, then you can use that to set the speed of your grenade with whatever throw velocity you like added on. That's the purpose of zifoon's post I believe.
Yeah that's what I thought but he wants to slow the reaper down, not add grenade speed. No idea but that's what he wants.
@zifoon: Go I'm not looking to change the speed of the reaper unit, I'm looking to set the speed of the grenade. The grenade is a unit based off of the Baneling that I've altered to have a slow acceleration and high movement speed. When I create a grenade through triggers, I have a somewhat complex trigger that gives the unit x and y coordinates telling it where to move and alters it for gravity and that sort of thing. The problem is that it takes a bit of time for the grenade to reach top speed with the slow acceleration, and while the acceleration looks fine while the reaper isn't moving, it looks unnatural when the reaper is moving. To fix this, I need to find a way to physically set the grenade's speed to match the speed of the reaper throwing it, which I am unable to find.
Huh. I was right the first time? Then what's wrong? I told you how to find speed for the reaper. Use action to pick missile for the reaper then "Set Unit property" (picked unit)'s movement speed to Variable - Speed
@zifoon: Go
Because the unit's Movement speed and the actual speed that the unit is moving are two different things? The unit's movement speed is the maximum speed the unit reaches while moving. If the unit had a high acceleration, then this wouldn't matter because it would reach it's top speed very quickly. But the grenade doesn't have a very high acceleration, and as such it takes atleast 5-10 seconds to reach it's movement speed.
I need to be able to set the unit's actual speed, not it's movement speed, to match the current actual speed of the reaper, which I can obtain through your trigger.
I'm having issues getting the actual speed set up.
Why do you have low accel if you going to change the speed of the projectile? It's contradictory.
If you want low accel then make it faster after certain range, it's in mover's option (Acceleration|Acceleration range)
Alternatively and a simpler method, you can make an upgrade that sets the baneling's acceleration speed. Use trigger to turn it on and off.
@zifoon: Go
Yah this is definitely difficult to explain correctly, due to the way I have the map set up.
I uploaded a PoC to better illustrate what I'm trying to do. It's right here: http://www.sc2mapster.com/maps/sidescrolling-poc/files/1-initial-poc/.
Try running it and pressing B while moving around to see what I mean. I'd like to set the grenade's speed to the reaper's speed at the moment of it's creation, then have it arc and fall smoothly like it does now with that extra movement speed added on. If this ends up becoming too much of an issue I might just keep it how it is because it's not really too huge of an issue, it just looks weird.