Accelaration & des accelaration system

Status
Not open for further replies.

Wrda

Spell Reviewer
Level 26
Erm, I didn't explain myself clearly.
It's something like that you said.

Imagine a car.
I didn't mean it must be car, i meant that a car accelarates and des accelarates, it was just for you to have an idea. It could be a creep, a patrol (like a maze) or anything, it doesn't need to be moving.
E.g: A footman stands on "region 000" and starts sliding increasing speed progressively to "region 001". At half of the way the speed starts to decrease progressively. When the footman reaches to "region 001", the does the same thing all the way back.

IcemanBo

Level 38
Each periodic event you set Speed[unitIndex] = Speed[unitIndex] + Accel[unitIndex].

At start Accel for each unit could be 0, so it doesn't change anything.
When unit enters RegionA --> Accel[unitIndex] = 0.005. (or something like this, idk^^)
When unit enters RegionB --> Accel[unitIndex] = -0.005

But attention, that way the speed might get faster/slower then you want, so a limit would be needed. (condition in periodic event):

If (Speed[unitIndex] + Accel[unitIndex] > MIN_SPEED) && (Speed[unitIndex] + Accel[unitIndex]) < MAX_SPEED Then
Set Speed[unitIndex] = Speed[unitIndex] + Accel[unitIndex]

Wrda

Spell Reviewer
Level 26
I've tried that before, but it never goes smoothly xD
I'll try a 2nd time

IcemanBo

Level 38
Hm, you change it each ~0.03 seconds... think it should be smooth enough. But I think you should use custom script for set new acceleration, because 0.01 (min for GUI) is maybe too much.

rulerofiron99

Level 25
I did something similar for an aura in the Zephyr contest: http://www.hiveworkshop.com/forums/2551866-post120.html

If you strip away most of the aura stuff, this will let you accelerate/decelerate units the way I think you're asking for.

If you're looking for something that allows cars to drift around corners, I've got a testmap for that lying around somewhere if you need it.

Wrda

Spell Reviewer
Level 26
Thanks for your help, but it's not really what I'm looking for.
Erm, I didn't explain myself clearly.
It's something like that you said.

Quote:
Imagine a car.
I didn't mean it must be car, i meant that a car accelarates and des accelarates, it was just for you to have an idea. It could be a creep, a patrol (like a maze) or anything, it doesn't need to be moving.
E.g: A footman stands on "region 000" and starts sliding increasing speed progressively to "region 001". At half of the way the speed starts to decrease progressively. When the footman reaches to "region 001", the does the same thing all the way back.
I'll attach a test map for you I made to understand what I mean. (ignore leaks etc)
View attachment Accelaration.w3x
Here, for some reason now that I tried another way it seems that it increases speed smoothly.

Status
Not open for further replies.

Replies
0
Views
425
Replies
2
Views
582
Replies
0
Views
725
Replies
127
Views
8K
Replies
2
Views
993