ID:140436
 
Code:
//The Datum
Group
var
Damage
Health
MaxHealth
Range
Defense
Abilties
Faction
Builder = 0
Speed = 0
Undead
Units
Skeleton
Builder = 1
MaxHealth = 40
Defense = 5
Speed = 5
Faction = "Undead"
Zombie
Faction = "Undead"
MaxHealth = 60
Defense = 6
Ghoul
Faction = "Undead"
Abilties = "Feast"
MaxHealth = 100
Defense = 10
Lich
Faction = "Undead"
Abilties = "MagicPower"
MaxHealth = 80
Defense = 10
Ghast
Faction = "Undead"
Abilties="NoDense"
MaxHealth = 150
Defense = 15
Elves
Beasts
Humans
Dinosaurs

//the Faction and etc
mob
var
Faction
verb
ChooseFaction()
usr.Faction = input("Select a Faction", "Faction",usr.Faction) in list ("Undead",
"Dinosaur")
ShowUnits()
for(var/Group/G)
world << G


Problem description:
Ok, I'm trying to get it to show the units under a faction but it won't show the name of the groups. I am trying to get it to show the units under the users faction.
Because the datum doesn't have a proper parent_type, it has no name variable. The name variable belongs to the /atom type. You can set parent_type to /atom/movable and it should work as expected.
In response to Nadrew
I've just tried this and put parent_type = /atom/movable under the Group datum and it still doesn't output anything still.
In response to Gamemakingdude
That would come from the fact that no Group datums exist in the game. If you want to loop over them before they're created use typesof() to loop over the typepaths, then you can create new ones based on the types it returns.
In response to Nadrew
Oh! I forgot. I should put in when the world starts up it should create a new datum right?
Part of your problem is that you don't understand inheritance in DM. When you indent one object under another in DM, that means that the lower one is a derived type of the higher one. Take this for example:
Building
var
construction_material = "wood"
House
Barn
Walmart
construction_material = "pure evil"
Shed


That little bit of code says that there are things called Buildings in your program, and that buildings have a variable called construction_material. House, Barn, Walmart, and Shed are all buildings, and they all inherit the variable construction_material from house. If you take any type of Building, such as House or Barn, it'll have construction_material set to "wood", except Walmart objects which redefine construction_material as "pure evil".

Now consider the next example:
House
var
construction_material = "wood"
Father
Mother
Johny
Dan
Fuzzy_the_cat
Refridgerator


This does not say that your program has an object called House with the following contents: Father, Mother, Johny, Dan, Fuzzy_the_cat, Refridgerator. What it does say is that there are types of objects in your game called House, and they are made of wood - and there are types of objects called Father that are also houses, and made of wood. In fact, Refridgerators are houses and are made of wood.

You will never get your grouping system to work so long as you are trying to make groups as types of units, or units are types of groups, and that's what your code says. It says that you have defined an object type called Group. You then defined a type of sub-group called Skeleton, meaning that your Skeleton is a type of group... are you starting to see why this doesn't make sense?

I hate to say this, but read the DM Guide. Indentation and Inheritance are very important concepts, and you must understand them before you can start working with more complicated systems.
In response to IainPeregrine
lol @ Walmart's construction material ^-^
In response to IainPeregrine
Is this design flawed?

mob
monster
var
hp
troll
In response to Tsfreaks
Not at all, that's correct because a Troll is a type of monster.. and monsters are a type of mob.
In response to Zjm7891
Except you would likely want other things than monsters to have hit points as well. Namely, players.
In response to Kaioken
Yah. Good catch. My point of the question was to find out if people had some other method for creating Monsters(npc).

ts