Code:
mob
pc1
pc2
pc3
pc4
mob/var
body
mind
spirit
mob/proc
charactergen()
name = pick("Aerg-Tval","Keftar","Torvul","Vatan")
var/bodygen = roll(1,6)
var/mindgen = roll(1,6)
var/spiritgen = roll(1,6)
if(bodygen > 3)
body = bodygen - 3
else
body = 0
if(mindgen > 3)
mind = mindgen - 3
else
mind = 0
if(spiritgen > 3)
spirit = spiritgen - 3
else
spirit = 0
Problem description:
I'm working on a project which has the player control a party of four characters. I have made a procedure for randomly generating character names and attributes, but I don't know how to apply it to the player character mobs instead of the user. How can I use the charactergen() procedure I made to generate attributes for other mobs?
Also, I have a feeling that pick() is the wrong procedure to use for name generation. I would like to eliminate names if they've already been assigned, so is using a list or something else better suited for this?
Lastly, if I wanted to designate these mobs as player characters for things like applying status effects, is looking into lists the direction I should be going to accomplish that?
Having four pre-defined vars for your party is really not a good idea. I suggest a more robust pattern of using a list. That will allow you to loop through your party more easily, among other things.
That list is null by default. For players, you can either initialize it to a new list in Login(), or you can just initialize it when it's needed (e.g., when they get a character to join them).
Now for generating those party members, first I'd have a global list of names you can pick through. If you're building the player's party when they log in, then I'd make a copy of that global list and remove names from it as they're picked.
A fairer way to pick character stats might be to have a set number of skill points, assign some of them automatically based on the class, and then assign the rest at random.