ID:161411
May 9 2008, 9:40 am
|
|
You have a skill Punch & Kick. Punch's mastery is 1% and Kick is 75%. I want to use their percents added with the character's hit rate. Just to show me how to start off.
|
In response to Kaioken
|
|
Could, I use that punch_skill and make it like like current_percent so I don't have to make variables for each skill?
|
In response to Lundex
|
|
Lundex wrote:
Could, I use that punch_skill and make it like like current_percent Whaaaat? Remember to phrase your posts so others who can't read your mind or see your code can understand what you're saying. What's even current_percent to begin with? so I don't have to make variables for each skill? How else are you planning to manage it? If not a variable for each one, then you should make a list (or perhaps another kind of object) to contain the skills. |
In response to Kaioken
|
|
Ok, current_percent is the mastery out of 100. Like you have punch at 75%.
|
In response to Lundex
|
|
In my code example, the percent would already be stored by the punch_skill variable itself, because its (intended, though not posted) maximum is 100. If your variables peak at 100, they're already the percents in themselves, you don't need to do any calculations or new variables to get the percent.
If this still doesn't solve your question, perhaps posting your code will help understand what you mean. |
In response to Kaioken
|
|
I'll say it like this. The Punch skill is only one skill. The variable punch_skill in your example only deals with the Punch Skill. Is there a way to make a variable, that replaces the punch_skill variable, and I could use it for all my other skills? Or do I have to make a variable for each and every skill? Make sense now?
|
In response to Lundex
|
|
Lundex wrote:
Is there a way to make a variable, that replaces the punch_skill variable, and I could use it for all my other skills? I've kinda covered this previously. Anyway- Or do I have to make a variable for each and every skill? Naturally you're going to have to keep track of each skill mostly separately, if they're meant to be separate. What you likely may be referring to here is a list, which allows you to keep track of several values together ("grouped") and could be used to store them in a single variable. This would generally indeed be a better implementation. If you haven't used lists before and don't know much about them, this will be a good time to start some readin' up. Of course, you're welcome to request help with this as well, but >learn< >about< >this< first*. You should also probably read this article. *: Contrary to popular belief, you do not really require an associative list for things such as this. However, it is still important and good to know about them. |
In response to Kaioken
|
|
mob |
In response to Lundex
|
|
For reference, HTML tags are closed with a regular/forward slash (/), not a backslash (\).
No offense intended, but I doubt the way your posted code works is what you think it is, and you should really make a little stop and reread some beginner tutorials and the DM Guide first so you have a better hand with how to do things in the language. mob You're creating new object types here, which isn't what you want. How you would do this is more like: mob |
Basic example: