Ok I've got this one and I'm check off on it to make sure it gets included in my project. But how do I call these functions??
Character Handling
http://www.byond.com/hub/hub.cgi?qd=hubIndex;hub=140
Is the one I'm asking about. I need lots of games out there that look like they are making use of this, but I can find any code or reading material on them. Also I want to add in the ability to choose Male/Female from when the character is created. Do I need to add that into the Lib code? Or is there a way to call it from my own?
LJR
ID:179796
Nov 3 2001, 7:36 pm
|
|
In response to Deadron
|
|
Ok thanks..
I've almost got it working only this area is giving me some errors, and I' not sure what to change or how to fix the problem. 64 // Set the attributes. 65 new_mob.name = char_name 66 67 // Now switch the player client over to the new mob and delete myself since I'm no longer needed. 68 src.client.mob = new_mob 69 var/turf/first_location = locate(24, 16, 1) 70 new_mob.Move(first_location) 71 del(src) ------------- Errors: 65:error:new_mob.name:bad var 68:error:new_mob:bad var 70:error:new_mob.Move:bad var |
In response to LordJR
|
|
Maybe you have to use new_mob:var instead of new_mob.var.
|
In response to Lord of Water
|
|
Lord of Water wrote:
Maybe you have to use new_mob:var instead of new_mob.var. I tried new_mob:name = char_name and nope that didn't work. Did u mean something else by this? I did change it to read name = char_name but this gave me new errors down the line. LJR |
hmm ok my mistake I accidently cut out the
var part of the code earlier. Problem solved. Now a new issue in getting this to work. I'm having problems getting the location var to work right. It places new players at 1,1,1. But I'm updated the code that should put them somewhere like 20,14,1. src.client.mob = new_mob var/turf/first_location = locate(24, 16, 1) new_mob.Move(first_location) del(src) Any ideas where I should check in the code? Also, I get the Create New Character window, but everything afterward is missing, normal in the Character Saving program you could be a nurse or a cop. I changed that to read char_gender instead, as well as changed it to male,female. I never get this option of the change to rename my character something else. LJR |
In response to LordJR
|
|
Make sure you have something sorta like this:
var/mob/newmob newmob = new /mob/PC() of course, change newmob to variable of your choice, and PC() to the mob you want your players to be when all is said and done. From your errors, it sounds like you havent assigned the variable newmob and/or instantiated it ( new /mob/PC() ) |
In response to sapphiremagus
|
|
Ok... all this OOP code is wacking me out, but I can see the power and know its good for me!!
I'm planning on using the CHL of Deadron's but I'm trying to work it into my own code. In my game the only selection you need to make besides giving a name is choose a gender, Male or Female. In the example of Deadron's I have, it uses classes like Cop or Nurse. But what I did was just change classes to gender, and make it Male or Female. But now this has caused problems for future code like having to add duplicates of information per each gender. Otherwise making it more messy for my code and going more back towards C way of thinking. I'd like to just make a base PC character to var/ off of with the genders etc. Anyone know of a good way of using Deadron's CHL code and doing this? LJR ps I'm looking for code/method using Deadron's CHL. |
In response to LordJR
|
|
LordJR wrote:
In the example of Deadron's I have, it uses classes like Cop or Nurse. But what I did was just change classes to gender, and make it Male or Female. But now this has caused problems for future code like having to add duplicates of information per each gender. I'm not sure what you are talking about...but you should look up "gender" in the reference (type F1), because BYOND already has a gender variable, in case you aren't using that. |
In response to Deadron
|
|
yeah..
I saw that.. and in the map editor for the icons too. How is the best way to make a basic /mob/pc base, and then go from there to add a gender, male or female? LJR |
In response to LordJR
|
|
LordJR wrote:
yeah.. Have you read through the tutorials and FAQ, and tried out sample code like A Step BYOND? byond://Deadron.StepBYOND What you are asking is the core of object-oriented programming, so you'll want to make sure you've familiarized yourself with the basics before you go too far. |
In response to Deadron
|
|
yeah.. more experienced with C
but I see the point in this case, and how powerful it can become, but that also makes it a bit harder to graps the basic till I got some working code I can learn from. I've printed out all the stuff I need. FAQ, Guide (which I'm reading through right now start-finish, good info, not on how to implement it well), and `198 pages of the DM Reference" It fills a 3-ring binder I have now just for DM. As for all those programs yes, I've download, read, reviewed all the basics. Reason this is directed more to you though is cause I'm trying to make use of your LIB for Char handling. And just want to know how u planned to set the character base up in that Cop & Nurse Example demo? I'm using that as my primer base code. Reason I'm asking questions is this, as I'm learning the code more and more i'm still newbie, I need a very Solid Default Character mob. Starting from 1 name, then 2 genders, 6 stats, 33 Classes, 60 Skills, and 16 Religions. I'm planning out the Character Tree out on paper ahead of time before I ever code anything, cause things can get confusing quickly with all the var. I 'm using. Also I have to include all those in your save feature correct? Just the 1st few lines of code to get me started would help. LJR |
In response to LordJR
|
|
LordJR wrote:
As for all those programs yes, I've download, read, reviewed all the basics. Reason this is directed more to you though is cause I'm trying to make use of your LIB for Char handling. And just want to know how u planned to set the character base up in that Cop & Nurse Example demo? I'm sorry but I have no idea what you are asking. I can tell you are grappling with some of the basics of OO, and you are no doubt asking a good question, but I don't understand what it is yet. Try explaining in detail what you mean by "set the character base up". It would help if you use a concrete example from your game. |
In response to Deadron
|
|
This is off the topic *sorry*.
Deadron, did you receive my mail, or has it yet to come, just wondering, as I am curious because I was wondering when I will be able to start on my game again. Lee |
In response to LordJR
|
|
But it seems like your original question was simply how to set a character's gender. Since your "character" is probably a mob, you need to familiarize yourself with how mob vars work. Specifically, gender is a var you can set at runtime on a mob, so you have several options. The easiest would probably be to prompt the usr for which gender is desired, the adjust the mob's gender accordingly. This can be done for "class" and "race" verbs that you create as well. If you aren't sure how to get info from a usr, look at "input" in the help docs. Additionally, the form library provides another useful way of getting info from a usr.
Hope that helps more than it confuses! -James |
In response to Mellifluous
|
|
Mellifluous wrote:
This is off the topic *sorry*. I did and haven't had time to look at it yet. Hopefully tonight...tomorrow at latest. |
In response to Deadron
|
|
Deadron wrote:
Mellifluous wrote: Thanks Deadron |
See either of these demos of the library:
byond://Deadron.SimpleSaving
byond://Deadron.CharacterSaving