M2 Download Center
Download Here ( Internal )
Hi there everyone,
I'd like to share a small function which will give you a random name whilst creating a new character.
This will only include the function and a list of names, so you will have to set the event on your own.
Preview:
The function which will most likely be put in introCreate.py
import os
import app
#import the above lines if you don't have them already
def __randomizeName(self):
dir = os.path.dirname(os.path.abspath("introCreate.py"))
list = open("%s\\names.list" % dir, "r").read().split("\n")
rng = app.GetRandom(0, len(list)-1)
randomName = list[rng]
self.heroName.SetText("%s" % randomName) ## change variable 'heroName' with your editline's name
Also place the attached file to this thread in the main directory of the client. (i.e: where the launcher is)
names.list contains 150 names, if you ever need more names let me know so I can up the number or you can add more yourself, but do note you need to put each name as a new line so you won't mess up the function.
That's all for now, hope you all have a great day!
Cheers.