• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Accelaration & des accelaration system

Status
Not open for further replies.

Wrda

Spell Reviewer
Level 28
Joined
Nov 18, 2012
Messages
1,993
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.
 
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]
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
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 28
Joined
Nov 18, 2012
Messages
1,993
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.
Top