The Updated Version:

    Create_Unit(var/obj/Unit/U, var/obj/Building/B)
src << "Computations for Creating Unit"
var/idNum = 0
var/String = ""
var/Flag = 0

src << "Prompting for Surety"
for(var/C in U.Costs)
if(istext(C))
String += "[C] "
else if(isnum(C))
String += "[C] Units, "

var/Response = sd_Alert(src,"Create Unit: [U.Name]? || Requirements: [String]","Create Unit",list("Yes","No"))
if(Response == "No")
return
else
src << "Ensuring Resources for Unit Cost"
for(var/C=1, C<=U.Costs.len, C++)
if(istext(C))
if(C == "Populace")
if(B.Workers >= U.Costs[C+1])
Flag = 1
else
Flag = 0
sd_Alert(src,"You Do Not Have Enough Workers withinn Building, [B.Name]: [B.ID]","Inadequate Workers to Create Unit")
return
else if(Resources[U.Costs[C]] >= U.Costs[C+1])
Flag = 1
else
Flag = 0
sd_Alert(src,"You Do Not Have Enough Resources","Inadequate Resources to Create Unit")
return

src << "Deducting Resources for Unit Cost"
if(Flag == 1)
for(var/C=1, C<=U.Costs.len, C++)
if(istext(C))
if(C == "Populace")
B.Workers -= U.Costs[C+1]
else
Resources[U.Costs[C]] -= U.Costs[C+1]

src << "Delay for Spawning Unit"
spawn(U.Time)
for(var/obj/Unit/T in src.Units)
if(U.Name == T.Name)
idNum++

src << "Creating unit..."
src << "Building Location: [B.x], [B.y], [B.z]"
new U.type (B.x, B.y, B.z, idNum)

obj/Unit

Infantry
icon = 'Infantry.dmi'
icon_state = "Infantry"
Name = "Infantry" // Name of the Unit
Desc = "A foot soldier armed with a automatic machine gun, trained and used for military purposes"
Type = "Land" // Whether the Unit is a Land, Air, or Sea Type
Time = 30
Power = 3
Health = 10 // The Health of the Unit
MaxHealth = 10
Costs = list("Populace", 1, "Steel", 10, "Oil", 10)
Targets = list("Land") // Unit-Types which a Unit can attack
Vulnerable = list("Air","Sea") // Unit-Types which a Unit cannot attack
Requirements = list(/obj/Research/CodeOfArms, /obj/Research/Gunpowder) // The Research Requirements needed to create a Unit

Click()
if(usr.Action != src)
usr << "Unit Clicked"
usr.Unit_Info(src)
else
usr << "Unit Unselected"
usr.Action = ""

New(var/X, var/Y, var/Z, var/ID)
src.Owner = usr
src.ID = ID
src.loc = locate([X+2],[Y+2],[Z])
usr.Units.Add(src)
usr << "Unit Location: [X+2], [Y+2], [Z]"
usr << "Unit Created!"
..()


Only two lines have changed [with some added debugging statements]: The call to the New() for /obj/Unit and the loc of a /obj/Unit upon creation.

Edit: My call to the Create_Unit() as below (if that helps any):
    Building_Info(obj/Building/B)
src << "Building Info"
if(B.Built)
src << "Building Already Built"
var/list/Buttons = list("Cancel")
var/Response = sd_Alert(src,"[B.Desc]","[B.Name]: [B.ID]",B.Uses)

if(Response == "Create Units")
for(var/U in B.Units)
Buttons.Add(U)
var/Unit = sd_Alert(src,"Create Which Unit?","Create Unit",Buttons, "Cancel")
if(Unit != "Cancel")
src << "Check... [Unit]"
for(var/obj/Unit/U)
src << "[U.Name] == [Unit] || Checking"
if(U.Name == Unit)
src.Create_Unit(U, B)
else
return

else if(Response == "Provide Jobs")
Response = input(src,"How many Citizens do you wish to employ at this [B.Name]?","Employing Citizens")
if(Response > src.Resources["Populace"])
sd_Alert(src, "You do not have that many Citizens","Inadequate Citizens")
return
else if(isnum(Response))
B.Workers += Response
src.Resources["Populace"] -= Response
else
sd_Alert(src,"You must enter a number","Non-Numeric Value Entered")
return

else
src << "Building Selected"
src.Action = B

The above procedure itself is only called upon when a building is clicked.
In response to YoukoSieg
YoukoSieg wrote:
(Oddly enough however, should I past the values through in actual numbers, they appear with no flaw or problem)
Are you saying here that you are passing text to the locate() still? Make sure you are using text2num().
Oh no, by that I meant if I placed "src.loc = locate(2,2,1)" it'd work [which is to be expected, yet baffles me as to why it wouldn't work with variables]. Not that I was still passing text.
Logical thinking should lead you to believe that if hard-coded numeric values work but variables don't, then those variables must not be holding numeric values.
But they are. If you haven't noticed, I've taken the values directly from the Building.x, Building.y, and Building.z. Those are normally numeric values, and I pass those values right into the New(), never once touching them / changing them.
I just scrolled back up. Why do you have brackets here?
src.loc = locate([X+2],[Y+2],[Z])
To add the change in locations by just a slightly different x and y, by adding the 2. Thinking it over now, I suppose it never really mattered, but I don't believe by having brackets, it would change the numeric value to a string/text value, would it?
Who knows. I've only really used brackets outside of strings to access list indices, so it may or may not work. Try it out, and maybe give X, Y, and Z a default value of 0 (Just so it knows that it is a number).

You should also really not use usr unless you have to. It can make things quite confusing later when you don't remember and have to search through the code to find what is calling New() to see what the usr is.
Tried all of that and still no change. This is really baffling to me... I might just go about spawning this thing in a completely different way...
In response to YoukoSieg
YoukoSieg wrote:
>                   for(var/obj/Unit/U)
>

You realize that this loops through every /obj/Unit that is created already, right? If you want to loop through every Unit that is coded in you need to use typesof().
That was actually supposed to be, "for(var/obj/Unit/U in B.Units)".... Should probably correct that, lol. Thanks.
Page: 1 2