ID:1908288
 
Hello so basically I have a few races. For example the Time Traveler race, A group of people who are known for time traveling without helmets. At first It all worked ok when I had the races under one mob thing. Then I changed it to be organized since there are 9 races. So I gave them their own lines for example. mob/Races/TimeTravel yet when I did that it would skip the "icon.dmi" I set and go to a different one. For example I have a Icon base for the Time Travel simply named "TimeTravel" and I have icon base for regular bases such as npcs. The coding would directly skip the "TimeTravel.dmi" and go straight to "Base.dmi", which basically does not have the "TimeTravel icon_state" and so keeps switching icons. I therefore put the TimeTravel icon_state in "Base.dmi" as well. It worked perfectly and I thought to fix it later on. Now that I added all the races, it has the same problem yet again. It even skips the "Base.dmi" and so it does not work on either. Idk what to do an I am absolutely scared because I spent 3 hours straight coding all of this just for it to mess up. I have the portion before DblClick() because you have to click the npc to become that race. and as you see I began it at TimeTravel because there are other races above it, but it has the exact same coding, but fits to said race. Please help me
Code:
TimeTravel
icon = 'TimeTravelRace.dmi'
TimeTravel/icon_state = "TimeTravel"
DblClick()
usr << sound('YouWillNow.wav', volume=100)
sleep (80)
usr.TimeTravelRace=1
usr.loc=locate(79,18,2)
usr.dir=SOUTH
usr.icon_state = "TimeTravel"
usr.verbs+=new/mob/Travel/verb/FastFoward()
usr.verbs+=new/mob/Travel/verb/Menu()


Problem description:

I'm just strait up new with DM code but.

I'm guessing that your issue is that there is No icon for the mob. Aka invisible.

And I assume you already have that code set up under a mob, like this.

mob
enemy
icon = 'enemies.dmi'
icon_state = "inverthuman-standing"


Make sure that its declared as A mob.

You also might want to remove the TimeTravel/

to something like this...

mob
TimeTravel
icon = 'TimeTravelRace.dmi'
icon_state = "TimeTravel"


I hope this helps.

That about as far as my knowledge can help with the code provided.
so just do mob/"race name" for all of them and not just have them under one mob/?
In response to Dayvon64
Up to you.

If I had 9 different races I would make a new code file per race.


alien.dm
humans.dm
gallifreyans.dm


And start each code file this this.

mob
race
icon = '[Race Icon File]'
Click()
var/
verb/
proc/
etc etc..


Or you could do it in one file like this....

mob
races
race1
icon = 'race1.dmi'
race2
icon = 'enemies.dmi'


I'm pretty sure either way works and its down to preference

However that said ive been using DM code for like a week.

EDIT: Pretty sure mob/race-name also works, or mob/races/race-name

EDIT2: you don't delcare them as one mob, you declare the type. MOB/Moveable Object.
I think it might be better to refer to race as a variable stored in a mob, instead of a race being a derived type of mob.
mob
var/race/race

race
var/name
var/desc

proc/test_proc()
var/mob/m = new()
m.race = new/race()
m.race.name = "Some Race"
m.race.desc = "This race rules!"


If a mob doesn't have a race, one could simply leave it null
Isnt that a bit much?
Well no. If you had to compare races between mobs, all you would need to do is (a.race.name == b.race.name). I guess in the case of inheritance in BYOND you can check the mob's type path to determine its race, but that availability isn't always present in other languages.

Adding extensibility to a base class in the form of attachable datums is just one solution, but do whatever you feel is best.