| 01-22-2007, 03:39 AM | #1 |
I was wondering how I could make it so that units accelerate. Initially, (when they are standing still), I need their movement speed to be at 0, but when they are issued a move order, they will accelerate until they reach their maximum speed. It would need a fatigue bar, that starts to fill up once your unit has reached maximum speed, and as it fills up, the unit will begin to slow down. When it is full, the unit is paused as the fatigue level decreases, the unit is only unpaused when this bar is empty. Also, if a unit stops to rest (hold position), I want this bar's level to go down. If your unit was at say 80% fatigue, and you stopped, and waited a while until his fatigue bar went down to 50%, then you start moving your unit again. Your unit's speed is at 0, and he starts to accelerate. Your unit is semi-fatigued, and he starts running, so his fatigue bar should start going up, even though he is not at his top speed. (this is where it has become way to tricky for me ). Basically, your fatigue starts to go up once you reach max speed, and your fatigue will continue to go up as long as you keep running, until it gets full, when your unit is paused until its fatigue goes back down to 0. If your unit has fatigue (and were standing still) and they start running (ie they were fatigued, but stopped to rest, but ran too early), their fatigue will increase until it gets to full, when they are paused until it goes back down to 0. In summary, units gain fatigue once they have passed their top speed. Units also gain fatigue if they are moving (at any speed), while they already have fatigue. Perhaps the fatigue bar could be shown by text (eg. Fatigue: ||||||||||) in a leaderboard/multiboard that gets updated constantly, and is unique for each player. How can I do the acceleration/decceleration thing so that it will not lag? (each player only has 1 unit, there are only 12 units in game so that might help some). Do I use periodic triggers? Also, how can I detect when the unit stops moving (they will have to accelerate again. ie. they are resting to reduce their fatigue), or does a too sharp turn? (ie what would realistically make you have to stop). It just doesn't seem realistic that units in warcraft can be standing still then break into a full sprint, run at that speed and never get tired, and do 180 degree turns without having to stop or even slow down. Is it even possible to detect how sharp their turn is, or if they stop? .If someone could post their answer to either of the problems with in [trigger] tags that would be great. Ty. |
| 01-22-2007, 11:44 AM | #2 |
Well, I would say that this is all definately doable, but you aren't going to get a simple answer in a little trigger tag. It would be a fairly elaborate system you're gonna have to code yourself in JASS, or recruit a JASSer to help you out. |
| 01-23-2007, 01:04 AM | #3 |
Well I don't know how to do JASS, so I'm hoping this thread can generate some help. If JASS is a definite requirement, is there anyone reading this that is interested in helping? Thanks |
| 01-23-2007, 01:17 AM | #4 |
Check out the tutorials in the JASS section, in particular there's two by knutz that I think will help you. |
| 01-23-2007, 02:18 AM | #6 |
@PipeDream: I had a look at them, and perhaps you misunderstood what I was aiming at: The units are not moved by triggers, it is standard wc3 unit movement, but the longer they run the faster they will move (until they reach max speed, after that they deccelerate) - Pyrogasm is more along the right track. @Pyrogasm: In your example, how does a unit get added to Fatigue_Group[2]? I want it so the unit only starts becoming fatigued after they have reached their max movement speed, and every periodic timer from then on, they do not gain speed anymore, and will lose speed and gain fatigue until their fatigue reaches 100, then they are paused and their fatigue degenerates, they are only unpaused when they have 0 fatigue level. I also want it so that any unit that is not moving (current order = stop or hold position) degenerates their fatigue level (when a unit stops, I need their speed to go back to 0). Do I need - 1 periodic trigger picking every unit that has a custom value of 100, and adds them to Stop_Rest_Group, and pauses them (orders them to hold position first). 1 periodic trigger picking every unit that has a current order of stop / hold position, and set their movement speed to 0 and their custom value to their current custom value - 1. 1 periodic trigger picking every unit that is not in Stop_Rest_Group or Fatigue_Group or current order is stop/hold position and sets their movement speed to their current movement speed + 5. If their current movement speed is equal to/greater than than 500, they are added to Fatigue_Group. It then picks every unit in Fatigue_Group, and sets their custom value to their custom value + 1, and their movement speed to their current movement speed - 5. It then picks every unit that is in Stop_Rest_Group and sets their custom value to their custom value - 1. If their custom value is 0, they are removed from Stop_Rest_Group and unpaused. If there are any flaws in this (which undoubtedly there will be), it would be great if someone could point them out before I go and make the triggers lol. I hope that this will work as I intend it to (although I have ignored the sharp turning thing for now lol). |
| 01-23-2007, 03:59 AM | #7 | ||
You're close, but not perfectly on track. You still need all the groups I said above. Here's how I see it: - Move_Group = Units that can move either with or without increasing fatigue (movespeed less than 500) - Fatigue_Group = Units that have fatigue, but not enough to make them stop; if they continue to move, they will continue to gain fatigue. Most likely, these will be units that have a MS of 500, but haven't gained 100 fatigue. They could also be units that had fatigue, but stopped running before they became paused; they will gain fatigue for moving at any speed - Stop_Rest_Group = Units that are stopped for any reason - Any given unit can only either be in Move_Group or Stop_Rest_Group (not both), but can sometimes be in Fatigue_Group in combination with one or the other. - Minimum move speed is 5 (otherwise units could never move initially, in order to be added to Move_Group) Quote:
Quote:
Then I'd use the move trigger I posted above, modified a little bit, but still with the check for units in Fatigue_Group. There's probably something I've missed, so if someone could point it out... WTFish, if you give me a day or so, I'm sure I could set this up for you... maybe even submit it as a system ![]() |
| 01-23-2007, 04:06 AM | #8 |
Set move speed is a nightmare, if you use it with auras that change move speed, things bug out. Change move speed with abilities. Doing this in a global fashion will be very difficult in GUI though... |
| 01-23-2007, 05:56 AM | #9 |
Can't you just use Trigger: unit - Set movement speed of "unit" to x@Pyrogasm: I am going to try make it now, but if (or when) things go wrong, I will post in this thread and hopefully someone can provide answers. I was hoping this could be a unique feature of my map, but if you are willing to create it, it would be fine to have it as a submitted system lol (not sure if I am going to be able to make it anyway lol). Ty for help so far. |
| 01-23-2007, 07:56 AM | #10 |
If you attempt to change the unit's move speed while it is moving I do not think it will update until a new order is issued. I think you'll get better results with triggered movement combined with standard movement. |
| 01-23-2007, 10:22 AM | #11 |
If you change a units move speed while moving the change takes place instantly. The only problems you get when using move speed changing triggers is when items and auras increase move speed. |
| 01-23-2007, 11:41 AM | #12 |
In that case you still have the horrible problem of having to use SetUnitMoveSpeed... good luck with that.. |
| 01-23-2007, 01:10 PM | #13 |
He could just trigger his other movement-speed affecting auras and spells too, you know. |
| 01-23-2007, 07:15 PM | #14 |
There are no auras or items or w/e that affect movespeed so it is fine :). EDIT: Oh wait, I actually was going to have a "cripple" spell, but I wasn't sure what it should affect. Would it be possible to make the cripple spell affect acceleration? Ie. when it picks a unit in the move unit group, I could just do this: If unit has buff of type Cripple, then set movement speed of unit to movement speed of unit + 1, else set movement speed of unit to movement speed of unit + 5. That way their acceleration is slowed, without having to change much in the system. EDIT2: I gave the trigger a try, and there is something that isn't working for me: Trigger: Unit Group - Pick every unit in (Units in (Playable map area) matching (((Current order of (Matching unit)) Equal to (Order(stop))) or ((Current order of (Matching unit)) Equal to (Order(hold position))))) and do (Actions) |
| 01-24-2007, 01:29 PM | #15 |
Wow, just that line of code would leak bad... sorry to say but you're not going to get this working just screwing around with GUI commands... I recommend finding a JASSer or learning JASS or giving up. |
