ID:161411
 
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.
Really, it's a matter of simple math operations. Just plan your formula first, implementing it isn't that tough.
Basic example:
mob
var
const/hitrate = 30 //base hit chance
punch_skill
proc/Attack(mob/M)
if(prob(src.hitrate+src.punch_skill/2))
viewers(src) << "[src] hits [M]"
else viewers(src) << "[src] misses [M]"
//this would generate chances such as:
//punch_skill 0: 0+30=30% chance to hit
// punch skill 30: 15+30=45% chance to hit
// punch skill 100: 50+30=80% chance to hit
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
var
current_skill // This is your punch_skill var
punch
current_skill = 15 // You have 15% out of 100
kick
current_skill = 50 // You have 50% out of 100

// Now I know how to add skills to a list, and all that. My question is can I use it like this or do I need to create a similiar variable of current_skill?
//And if I'm not getting this, I'm sorry. My mind is going is like 15 different places at once...<\dm>
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
var
current_skill //this defines a new variable for all /mobs.
punch //this defines a new mob subtype, /mob/punch. it is a new object type
current_skill = 15 //this overrides this subtype's current_skill variable to 15. objects of type /mob/punch will have a current_skill variable of 15
kick //[same as above]
current_skill = 50


You're creating new object types here, which isn't what you want. How you would do this is more like:
mob
var
punch_skill
kick_skill //define multiple variables for all mobs

//or with a list:
mob
var
list/skills = list(1,2) //define the new variable as of type /list and initialize it to a new list with 2 entries