• 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.

Inverted Geometric progression in Galaxy editor?

Status
Not open for further replies.
Level 2
Joined
Aug 6, 2009
Messages
21
Hello everyone,

So my problem is that I need that formula in my calculations.

I'm creating trigger upgrade system, that unit training an upgrade and the trigger build time decreases.
Hm... Maybe it's hard to explain.
It's like that:

0 Level Upgrade: 90 sec train time
1 Level Upgrade: 75 sec train time
2 Level Upgrade: 63 sec train time
3 Level Upgrade: 54 sec train time
4 Level Upgrade: 46 sec train time
etc... So the level grows, but the time bonus decreases.

Any ideas with formula?
 
Level 2
Joined
Jun 27, 2010
Messages
10
Hello everyone,

So my problem is that I need that formula in my calculations.

I'm creating trigger upgrade system, that unit training an upgrade and the trigger build time decreases.
Hm... Maybe it's hard to explain.
It's like that:

0 Level Upgrade: 90 sec train time
1 Level Upgrade: 75 sec train time
2 Level Upgrade: 63 sec train time
3 Level Upgrade: 54 sec train time
4 Level Upgrade: 46 sec train time
etc... So the level grows, but the time bonus decreases.

Any ideas with formula?
You make with variables. Like this

Set variables when 1 second time game elapsed.

Round = 0. Is an Integer
Time[Round]= 90. Is a Real developing variable

Round=Round+1
Time[Round]= 75.

Round=Round+1
Time[Round]= 63

Round=Round+1
Time[Round]= 44.
Round=0

or

Round = 0. Is an Integer
Time[Round]= 90. Is a Real developing variable

Round=Round+1
Time[Round]= Time[Round]-15

Round=Round+1
Time[Round]= Time[Round]-15

Round=Round+1
Time[Round]= Time[Round]-15

Round=Round+1
Time[Round]= Time[Round]-15
Round=0

After that, you can use your variable in your action's trigger.

action:
Set time construction to unit type ....... to Time[Round]
Maybe is not the good action's name, but is that you must make.

For sur, you have to increase the variable Round to Round+1, each end round or start round. Look at well how you use it.
 
Level 13
Joined
Feb 28, 2007
Messages
477
This isn't a complicated concept. It's a simple use of powers:

x(n) = x(0)*(y^n); where x = the train time, n = the level (counting from 0), and y is the geometric constant (in this case, 5/6)

In this case:

x(0) = 90*(5/6)^0 = 90
x(1) = 90*(5/6)^1 = 75
x(2) = 90*(5/6)^2 = 62.5
x(3) = 90*(5/6)^3 = 52.08
x(4) = 90*(5/6)^4 = 43.403
 
Level 2
Joined
Aug 6, 2009
Messages
21
Oh, great, thanks.

But one problem.... I can't find exponentiation in galaxy editor... Is there any, or any simulation variant?
 
Level 9
Joined
Nov 28, 2008
Messages
704
You dont even need to bother with exponents. You could just specify the starting time (60 seconds) and then whenever they buy the upgrade times it by 5/6 and store it in a variable.

Depends if every player gets their own upgrade, but if its a one for everyone, that could be easier.
 
Status
Not open for further replies.
Top