View previous topic :: View next topic |
Author |
Message |
gagekilmer Ninja... nuff said
Joined: 09 Jan 2013 Posts: 53
|
Posted: Mon May 20, 2013 5:37 pm Post subject: Simple plotscripting question |
|
|
so I want our hero to be able to recieve a certain number of item (138) based off of the level they just gained, using the formula (level/4)+1
I understand i will need to use the
get hero level (me) command and the
get item (138, ((level/4)+1)) command
but I dont know what to put in place of "level" in the second command to make it refer to the previous value found by the first command |
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Mon May 20, 2013 5:52 pm Post subject: |
|
|
Variables!
To declare a (local) variable, write "variable (level)" inside a script. The variable will only be visible inside that script, and the value is forgotten when it exits.
To assign a value to a variable, write "level := get hero level (me)"
Wow, I've just noticed that the Plotscripting Tutorial doesn't even cover variables. We really could do with a longer/more tutorials.
BTW, note that level/4 rounds down. e.g. 7/4 is 1. _________________ "It is so great it is insanely great." |
|
Back to top |
|
 |
gagekilmer Ninja... nuff said
Joined: 09 Jan 2013 Posts: 53
|
Posted: Mon May 20, 2013 6:04 pm Post subject: |
|
|
thanks TMC, is it possible to make things round up? thats how we calculated it when we decided upon a formula, its not a huge deal but is it possible? |
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Mon May 20, 2013 7:26 pm Post subject: |
|
|
Yes, you just add a little to the numerator. If you want a/b to round up, then write (a + b/2)/b. So level/4 becomes (level+2)/4. _________________ "It is so great it is insanely great." |
|
Back to top |
|
 |
|