Im having a problem with this...
#include
client/base_num_characters_allowed = 3
world/mob = /mob/creating_character
mob/creating_character
base_save_allowed = 0
Login()
spawn()
src.CreateCharacter()
proc/CreateCharacter()
var/prompt_title = "New Character"
var/help_text = "What do you want to name the character?"
var/default_value = key
var/char_name = input(src, help_text, prompt_title, default_value) as null|text
if (!char_name)
client.base_ChooseCharacter()
return
var/ckey_name = ckey(char_name)
var/list/characters = client.base_CharacterNames()
if (characters.Find(ckey_name))
alert("You already have a character named that! Please choose another name.")
src.CreateCharacter()
return
var/list/classes = list("Warrior", "Mage")
help_text = "Which class would you like to be?"
default_value = "Warrior"
var/char_class = input(src, help_text, prompt_title, default_value) in classes
var/mob/new_mob
switch(char_class)
if ("Warrior")
usr.gender = input("What is your gender?")in list("Male","Female")
if ("Male") new_mob = new /mob/Warrior_Male
if ("Female") new_mob = new /mob/Warrior_Female
if ("Mage")
usr.gender = input("What is your gender?")in list("Male","Female")
if ("Male") new_mob = new mob/Mage_Male
if ("Female") new_mob = new mob/Mage_Female
new_mob.name = char_name
src.client.mob = new_mob
del(src)
mob
Warrior_Male
Level = 1
HP = 20
Warrior_Female
Level = 1
HP = 15
Mage_Male
icon = 'mage.dmi'
Level = 1
HP = 10
Mage_Female
Level = 1
HP = 10
Here are the errors...
save character.dm:44:error:mob:undefined var
save character.dm:44:error:Mage_Male:undefined var
save character.dm:45:error:mob:undefined var
save character.dm:45:error:Mage_Female:undefined var
Thanx Punkrock546
ID:177606
Aug 20 2002, 2:38 pm
|
|
In response to Super16
|
|
O ok i just missed that.^_^
Thanx, Punkrock546 |
Now I'm having runtime errors...
#include <deadron/characterhandling> client/base_num_characters_allowed = 3 world/mob = /mob/creating_character mob/creating_character base_save_allowed = 0 Login() spawn() src.CreateCharacter() proc/CreateCharacter() var/prompt_title = "New Character" var/help_text = "What do you want to name the character?" var/default_value = key var/char_name = input(src, help_text, prompt_title, default_value) as null|text if (!char_name) client.base_ChooseCharacter() return var/ckey_name = ckey(char_name) var/list/characters = client.base_CharacterNames() if (characters.Find(ckey_name)) alert("You already have a character named that! Please choose another name.") src.CreateCharacter() return var/list/classes = list("Warrior", "Mage") help_text = "Which class would you like to be?" default_value = "Warrior" var/char_class = input(src, help_text, prompt_title, default_value) in classes var/mob/new_mob switch(char_class) if ("Warrior") usr.gender = input("What is your gender?")in list("Male","Female") if ("Male") new_mob = new /mob/Warrior_Male if ("Female") new_mob = new /mob/Warrior_Female if ("Mage") usr.gender = input("What is your gender?")in list("Male","Female") if ("Male") new_mob = new /mob/Mage_Male if ("Female") new_mob = new /mob/Mage_Female new_mob.name = char_name src.client.mob = new_mob var/turf/first_location = locate(1,1,1) new_mob.Move(first_location) del(src) mob Warrior_Male icon = 'warrior.dmi' icon_state = "Warrior Male" Level = 1 HP = 20 Max_HP = 20 Warrior_Female icon = 'warrior.dmi' icon_state = "Warrior Female" Level = 1 HP = 15 Max_HP = 15 Mage_Male icon = 'mage.dmi' icon_state = "Mage Male" Level = 1 HP = 10 Max_HP = 10 Mage_Female icon = 'mage.dmi' icon_state = "Mage Female" Level = 1 HP = 10 Max_HP = 10 Here are the runtime errors... Welcome BYOND! (Dream Seeker release 332) Connecting to file://C:\Program Files\BYOND\bin\Eternal Quest\Eternal Quest.dmb. runtime error: bad gender proc name: CreateCharacter (/mob/creating_character/proc/CreateCharacter) usr: Punkrock546 (/mob/creating_character) src: Punkrock546 (/mob/creating_character) call stack: Punkrock546 (/mob/creating_character): CreateCharacter() Punkrock546 (/mob/creating_character): Login() Thanx, Punkrock546 |
proc/CreateCharacter() I've seen people do this in several games. Why is this so widely used, and wouldn't it be easier to just do: var/char_name = input(src,"What do you want to name the character?","New Character",src.key) as null|text Matic293 |
In response to Punkrock546
|
|
Bumpy Rooooo!
Punkrock546 |
In response to Punkrock546
|
|
If nothing else works, just do what I did. I copied the character handle and put it on my on dm. Changed what I need (base characters allow and such). For my class seletion I had it under my Login Code. Well I hoped that help if you can't get your way to work.
Creator of R.P.D. (Will be posted again as soon as I can fix a little computer problem) Creator of Soulance (Soon to be posted!) Rifthaven |
In response to Punkrock546
|
|
You're setting usr.gender to "Male" and "Female". There are only 4 possible values for genders: "male", "female", "neuter", and "plural". Since DM is case-sensitive, you might as well set usr.gender to "raw onion", because "Male" and "Female" aren't possible values for gender.
To fix this? Change all the "Male" and "Female" text strings to "male" and "female". Codewise: usr.gender = input("What is your gender?")in list("male","female") However, that won't work. Why? Because in the two if procs, you're just checking to see if "male" or "female" is true. You're not checking to see if usr.gender is either. So you'll need to change the if procs, like so: if(usr.gender == "male")new_mob = new /mob/Male_Warrior That should solve your problem. |
In response to WizDragon
|
|
Thanx that solved the problem.:P
Punkrock546 |
The lines I highlighted,
if ("Male") new_mob = new mob/Mage_Male
if ("Female") new_mob = new mob/Mage_Female
you need /mob/Mage_Male to define path or else it is determined to be a var same for /mob/Mage_Female
Simple type :)