(See the best response by Boubi.)
AssignVillageTest(var/v as text)
l["Name"] = v //doesn't matter what the vars are set to
l["Squad"] = v //only testing
l["Mouse"] = v
l["Chat"] = v
l["Limit"] = 0
l["Chuunin Items"] = list("1")
world << "LOADED: [v]"
src.village = new(l)
village = list(

"Leaf" = new/village(list("Name" = "Konohagakure", "Squad" = "Konoha", "Mouse" = "Konoha", "Chat" = "Konoha", "Limit" = null, "Chuunin Items" = list("1"))),
"Mist" = new/village(list("Name" = "Kirigakure", "Squad" = "Kiri", "Mouse" = "Kiri", "Chat" = "Kiri", "Limit" = null, "Chuunin Items" = list("2"))),
"Sand" = new/village(list("Name" = "Sunagakure", "Squad" = "Suna", "Mouse" = "Suna", "Chat" = "Suna", "Limit" = null, "Chuunin Items" = list("3"))),







return null

. = ..()

name = village_info["Name"]
squad = village_info["Squad"]

mouse_icon = village_info["Mouse"]
chat_icon = village_info["Chat"]

limit = village_info["Limit"]

var/chuunin_num = 1

if(village_info["Chuunin Items"])
for(var/v in village_info["Chuunin Items"])


village_info["Chuunin Items"][chuunin_num] = text2num(v)

chuunin_items[chuunin_num] = village_info["Chuunin Items"][chuunin_num]

Problem description:
So, I'm not sure why, but say I assign one of the villages above to a mob's 'village' variable upon logging in, the game won't recognize that it's created (or otherwise, anything that references the player's 'village' variable will cause a null run-time error). On the other hand, if I say, assign a completely new village (not one of the defaults) using an in-game verb (like the 'AssignVillageTest' verb above) to the mob's 'village' variable, it works fine.

Pretty odd problem really. I've never had this issue before [until recently] and it's getting pretty annoying. I'm sure whatever the problem is, it's simple haha.

Any thoughts?
Best response
I can't simply tell you what's wrong in text form, but I commented on some things. I don't have the ENTIRE code redone, but I changed some things. You can decide whether or you use it or not.

usr.myvillage = new/village(global.villagelist["[pick("Leaf", "Mist", "Sand")]"])
// just a simple bit of debugging here
world <<
world << usr.myvillage.squad

var/list/villagelist = list(
"Leaf" = list("Name" = "Konahagakure", "Squad" = "Konoha", "Mouse" = "Konoha", "Chat" = "Konoha", "Limit" = null, "Chuunin Items" = list("a", "b", "c")),
"Mist" = list("Name" = "Kirigakure", "Squad" = "Kiri", "Mouse" = "Kiri", "Chat" = "Kiri", "Limit" = null, "Chuunin Items" = list("a", "b", "c")),
"Sand" = list("Name" = "Sunagakure", "Squad" = "Suna", "Mouse" = "Suna", "Chat" = "Suna", "Limit" = null, "Chuunin Items" = list("a", "b", "c")),

// this was returning index out of bounds errors, btw
list/chuunin_items = new

if(!istype(l, /list)) CRASH("/village/New() ERROR: bad list arguement.")

name = l["Name"]
squad = l["Squad"]
mouse_icon = l["Mouse"]
chat_icon = l["Chat"]
limit = l["Limit"]

// i'm cross-assuming you were checking if it wasn't null?
if(istype(l["Chuunin Items"], /list))
for(var/a in l["Chuunin Items"])
// this will return everything obviously
// so do whatever you need to do here
world << a

// now if you were setting this to be for the mob, return it
return src
Sup, Boubi.

Thanks for your response. I put your version of the code into the environment and tested it, and it ran perfectly. Though, I'm wondering, why does yours work and mine does not? For future reference, I'd like to know, that way I don't repeat the same bad habits.
In response to Cloud Six
What mainly confused me was your setup on naming. The datum, the global list, and the mob's variable were all named village so I decided to change that much. I tried running your snippet and it returned the same problem, so I removed a couple of redundancies.

Your . = ..() call is used incorrectly, AFAIK, and is pretty much unneeded. If you were to change the village/New() proc in different occurrences you should just be calling ..().

Also, I didn't see any return in your snippet so it's safe to assume that your village has always been null. If you're going to set something to a newly created datum, you must 'return' it like I've shown in my previous post.
world << procthatreturns(100 + 69, "some value")

proc/procthatreturns(var/sum, var/val)
return "SUM: [sum]<BR>TEXT: [val]"
Ah, duh. I'm glad you mentioned the fact that [most] vars used had the same name, I didn't realize that until then. Needless to say, that played a huge part in my problem, but now it's fixed. Thanks bro.

Also, while we're here, care to explain exactly what '.=..()' does in detail? I've used it before regarding Login(), and all it did (from what I saw, at least) was call the other Login() before it called itself. So, yeah, I was assuming putting that there would "create" the village (or un-null it, basically).

But yeah, thanks again. I should've saw my mistake(s), but I was so annoyed, I didn't even want to look at it anymore haha. >_<
It does basically what you said about Login(), and it will take arguments. Since there weren't any return values anywhere in village/New(), the mob never received any of the data from the village datum.
In response to Boubi
Please do not post copy-pastable codes into the developer help forum. This forum isn't to get people to do things for others, but to help them figure it out themselves.
In response to NNAAAAHH
You do your way of helping and I'll do my way of helping.
In response to Boubi
It's not a matter of my way or your way- or I wouldn't ask you to do or not to do something. A BYOND moderator would tell you the same; as they told me.
In response to Boubi
Boubi wrote:
The list index out of bounds error was probably produced by:
// this list isn't being initialized at runtime
> chuunin_items[0]

If you look in the reference list[0] is the same as list = list(). You can change the 0 to a higher number which will automatically place that many null entries into the list (Meaning that if you do list[4] and do list += "hi", "hi" will be at the 5th place in the list.).

If the list wasn't initialized, it would tell you a different error. This was just an error of trying to access an index in the list that was higher than the list's length.

Also, I agree with NNAAAAHH here. It is a good thing the OP asked why it worked - I commend him for that. However this place is to help them work out their problems, not do it for them.
In response to Albro1
Up voted; you provided more knowledge without simply providing the fix for them.
In response to Boubi