ID:149949
 
not sure why it's doing this...
ok so I have this for transfering from one mob to the next...
mob/verb/BecomeSlave(mob/M as mob in world) //target a mob
if(src.owner!=usr.key)
usr <<"Sorry, that is not your creature."
return
if(src.owner==usr.key)
switch(alert("switch to mob [src]??",,"Yes","No"))
if("Yes")
usr << "You are now [src]"
src.client.mob = usr
usr.client.mob = M //usr's mob is now M
return
if("No")
return
ok so I have that
that switchs me from point a to point b...
now there's so much other stuff under mob/pc I'm just going to give you a little example...
/mob/pc
var
blah blah blah=whatever
Snow_Lords // this is a class you can pick from
blah blah blah
Kharn // another class to pick from

and here's my code from switching to one mob to the mob/pc/Snow_Lords mob...

mob/player/Player
icon ='9.dmi'
verb
BuildTown()
var/mob/pc/character=new()
switch(input("Which Class would you like to be?", "Who do you want to be?") in list("Snow_Lords","Kharn"))
if("Snow_Lords")
character = new /mob/pc/Snow_Lords(usr.loc)
character.loc= usr.loc
character.owner=usr.key
if(character.owner==usr.key)
usr << "Good day sire, You may want to develop your Farms and Economy so you can get money coming in."
var/charactername = input("What is your Town's name?","Name",src.key)
character.name = charactername
if("Kharn")
character = new /mob/pc/Kharn(src.loc)
character.loc=src.loc
character.owner=usr.key
var/charactername = input("What is your Town's name?","Name",src.key)
character.name = charactername
if(character.owner==usr.key)
usr << "Good day sire, You may want to develop your Farms and Economy so you can get money coming in."
usr.client.mob = character //now, we change the player to this newly defined mob!
sleep(10)
del(src)
del(/mob/pc)
return
typechar="normal"
ok take that into mind...
you get the idea, pretty basic stuff... but when I hit becomeslave (switch to mob)
it gives me this
Snow_Lords
pc

to choose from...
and when I join pc (which shouldn't even be there in the first place) it gives me this mob, black screen, but has all the stats a normal class would.

why is that?



ok I played with it a little
and changed a few things...
on the mob/player part...
I took out...
var/mob/pc/character=new()
and stuck in...
var/mob/pc/character (got rid of the =new())
I just got back from not coding for quite a long time I sorta remember this stuff and sorta don't...
ok now I noticed a problem when I do this
when I hit becomeslave()...
it gives me these options, jon_Snow (what I namedte snow_lords)
and snowmonsters
if I pick one of these...
it puts me back as mob/player/creating_character()
I don't know why....

JonSnow13 wrote:
if("Yes")
usr << "You are now [src]"
src.client.mob = usr
usr.client.mob = M //usr's mob is now M
return

Im not sure but I think it could be because you are becoming the mob before setting M as your old mob.
Maybe this would work
if("Yes")
usr << "You are now [src]"
usr.client.mob = M //usr's mob is now M
src.client.mob = usr
return

But that might not be it.
-DogMan
In response to Dog Man
no...
see everything is fine, I can teleport from one mob to the other just fine...
the only problem I'm having so far
is when I click becomeslave() and it gives me a list of the mobs I can become...
it shows this
Snow_Lords(or whatever I named my city)
pc

note that snow_lords is under /mob/pc/Snow_Lords

and when I change this...
var/mob/pc/character=new()...
to say...
var/mob/character=new()
instead of pc showing up in the list
it shows mob
is this a bug?
In response to JonSnow13
ya I still need help on this if anyone knows how to fix it...
In response to JonSnow13
bump
In response to JonSnow13
JonSnow13 wrote:
bump

Just for that, I'm not helping.

--Tarmas.
In response to Tarmas
hmmm? I was bumping it so I could get help (something I got used to do doing and everyone does on high post forums.)

sorry if this offended you in any way?
lol
In response to JonSnow13
JonSnow13 wrote:
hmmm? I was bumping it so I could get help (something I got used to do doing and everyone does on high post forums.)

It is frowned on in the BYOND forum. Bumping uselessly creates more clutter and eats more memory. I usually start at the earliest unread messages and work up the list to the present anyway.
In response to Shadowdarke
well
I did not know that
sigh
so instead of saying bump you just don't and leave your posts un-answered? Or would you brather me copy and paste it and post it again, or what.
In response to JonSnow13
If your post wasn't answered the first time through, there's usually a reason. There are only so many hours in a day, after all, and we have to prioritize. I do it based on the following question: can I help this person? This depends on a few things: the information they've provided, and whether or not I think they'll understand the answer or be willing to do the work to put it into play.

The reason I personally passed on this post is because there's no concise question here... you have just posted several pages of code that you don't understand. If you, who wrote it and knows what it's "supposed" to do, can't make any sense of it, why would I be able to?

As for why the BecomeSlave() verb is giving you a choice between pc and Snow Lord, you told it to take as its argument any mob anywhere in the world. The input box screens out redundancies (items with the same name), so you only get one instance of snowlord and one instance of pc to choose from. Why is there a pc? Probably gets created somewhere during your creation process and gets left behind.

How do you fix the code? The code ain't broken... it's done exactly what you've told it to. "Do not try to bend the spoon, for that is impossible. Only realize that there is no spoon, you are only bending yourself." Or words to that effect.

Step one (in coding and getting answers) is to figure out exactly what you're trying to do to the point where you can explain it sensibly to another human being. Until you can do that, you have no chance of explaining it to the computer.
In response to Lesbian Assassin
well I'm sorry for how I am but I don't have a desk job, I have a labor job and when I get tired (if you've ever done something physically exhausting for say 8-10 hours straight eachday you'd know how i feel) it's hard to think straight.
as I am now lol.
anyways...

Yes I know you're a coding guru probably and i'm still learning bits and pieces as I go along carelessly(and tired). Each day I learn something knew, (like how to use while() and for().
Anyways to tell you what I'm trying to do (just because I posted a code on here doesn't mean I haven't changed it since then, usually I post as fast as possible so I can get an answer right away instead of waiting forever, and I usually always post horribly as I'm not that great at expressing/explaining things.
When I started doing this code I ment for it to find all the mobs in the world, gather them up, then scan them for if their owner=usr.ckey. I have no idea if I did this even close to right, which I doubt... and the reason I haven't been looking for the answer RIGHT away or any solution to it at all is there's so many things to work on I usually leave this, and wait for a reply while I work on something else.
So to continue on... PC somehow popped up there, like you said, created from a fluke in my coding most likely...
BUT
recently I figured out what was causing it to create PC which is some weird bug, which for no reason creating pc since there is no such mob pc...
other than the mob/pc/ which all the races are under.
So I've played with it a little more and figured out what was creating it...
adding this line into the code
var/mob/pc/character= new()
of my mob, just a normal mob, nothing at all unique to it, it has no properties or any lines of code other than destroy this mob, and create a new mob (character, the code changes character later on, that is just the beginning)
adding this one line...
created pc
if I do this...
var/mob/character=new()
it creates a character named "mob" to choose from.

Now to tell you what my question was since you didn't understand it the first time...
Is this a bug??
or is it ment to do this for some odd reason?
or what...
that was my question

In response to JonSnow13

if I do this...
var/mob/character=new()
it creates a character named "mob" to choose from.

Now to tell you what my question was since you didn't understand it the first time...
Is this a bug??
or is it ment to do this for some odd reason?
or what...
that was my question

It's meant to do that for the odd reason that this is exactly what you've told it to do.

var/mob/character = new

creates a mob of type /mob and stores it in the variable "character"

var/mob/pc/character = new

creates a mob of type /mob/pc and stores it in the variable "character"

var/mob/shpledoingle = new

creates a mob of type /mob/shpledoingle and stores it in the variable "character"

Getting the idea? Now, mobs, like objs and turfs and all objects in the game, take the highest node in their type as their default name. mobs of type /mob are called /mob. mobs of type /mob/ork are called ork. And so on.
In response to Lesbian Assassin
so how would the storing of it work?
I mean if it creates what I told it to and then say...
I changed it so

var/mob/character = new mob/pc

would it keep each one in the memory?

or delete the original and create the 2nd when I tell it to?

Well, I tried it out and it created both a mob, and a pc.

This isn't a bug... but in fact a great knew thing I have learned thanks to you :)

Finally I understand why it was doing that hahaha...

And now I can use it to my advantage(hopefully, until I get stumped again... which happens quite often my iq I'm sure isn't exactly up there lol...)

:)
mob/verb/BecomeSlave(mob/M as mob in world) //target a mob
if(src.owner!=usr.key)
usr <<"Sorry, that is not your creature."
return
if(src.owner==usr.key)
switch(alert("switch to mob [src]??",,"Yes","No"))
if("Yes")
usr << "You are now [src]"
src.client.mob = usr
usr.client.mob = M //usr's mob is now M
return
if("No")
return

There are several problems with this. The first is that src and usr should be the same in this. The usr of the verb is also the src unless you change that directly by using something like:
src = M

So, when you test with if(src.owner!=usr.key) your seeing if the player owns himself, not if M is owned by the player.

Also, setting src.client.mob = usr is just like using:
src = src which does nothing

I've never set client.mob directly to another mob so I"m not familiar with it, another way to do it (not saying necessarily better...) is:
M.key = usr.key
In response to English
hehe ya like I said I just came back to coding from a break....
I fixed that right away after I read what src was and what usr was...