|
Aselarin Beginner
Joined: 23 Jul 2005 Posts: 26
|
Posted: Mon Aug 08, 2005 11:11 pm
#if question |
I've been trying to make a trigger calculate exp needed to next level, which is easy, but allso calculate exp for lvl after that again, which i made work.
But my question is, i have stored total exp needed to a certain lvl in different variables for each lvl (@1 = lvl 1, @11 = lvl 11)
the trigger i have made looks like this
#if (@level = 1) {
#var exptnl2 %eval( @2-@1)
#var goldtnl2 %eval( @2/2)
#var ttexptnl %eval( @3-@exptotal)
#var tttexptnl %eval( @4-@exptotal)
}
#if (@level = 2) {
#var exptnl2 %eval( @3-@2)
#var goldtnl2 %eval( @3/2)
#var ttexptnl %eval( @4-@exptotal)
#var tttexptnl %eval( @5-@exptotal)
}
etc.
it works, but i got 35 if commands, one for each lvl, is it possible to make it work same way with only 1 #if command ? |
|
|
|
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: Tue Aug 09, 2005 8:49 am |
Yes, it should be quite simple.
Could you post the formula you use though, I'm not quite sure from the example you posted.
Something similar to
#if (@level = x) {
#var exptnl(x+1) %eval( @(x+1)-@x)
#var goldtnl(x+1) %eval( @(x+1)/2)
#var ttexptnl %eval( @(x+2)-@exptotal)
#var tttexptnl %eval( @(x+3)-@exptotal)
}
So we can see what relates to what at any level. |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Tue Aug 09, 2005 9:16 am |
#var exptnl2 %eval( @{%eval(@level+1)}-@{@level})
#var goldtnl2 %eval( @{%eval(@level+1)}/2)
#var ttexptnl %eval( @{%eval(@level+2)}-@exptotal)
#var tttexptnl %eval( @{%eval(@level+3)}-@exptotal) |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
Aselarin Beginner
Joined: 23 Jul 2005 Posts: 26
|
Posted: Tue Aug 09, 2005 2:12 pm |
@level = current level
@2 = total exp needed to lvl 2
@3 = total exp needed to lvl 3 |
|
|
|
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: Tue Aug 09, 2005 3:37 pm |
It looks like Vijilante has cracked it anyway, but if not then what I meant was what is the formula you use to calculate. You've given two examples, but if you ditch the numbers and use variables the whole way through.
So if
experience required for level(x) = y
experience required for level(x+1) = what (in terms of x and y)
though it looks like Vihilante has already got it licked - have you tried that? |
|
|
|
Aselarin Beginner
Joined: 23 Jul 2005 Posts: 26
|
Posted: Tue Aug 09, 2005 4:46 pm |
thx for the help
Vijilante's trigger works perfect |
|
|
|
|
|