ID:174636
 
Im making an rpg game, and I want it so if you talk to a guy,he asks you what class you want, and then he changes your class (type) to like soldier, mage, knight etc. how would i do this?
Creating a new mob, then setting client.mob to the new mob.
In response to Garthor
what do you mean by that?
In response to Tetra41
You create a new mob of the desired type, then set the client's mob variable to that mob.
In response to Garthor
may be annoying but could you show me how i would do that plz?
In response to Tetra41
var/mob/M = new classtype()
client.mob = M
In response to Garthor
*sigh* i still dont understand im a noob coder if you havent noticed yet :|
In response to Tetra41
if anyone can still help me, it would be easy if you would put exactly what i have to put down.
In response to Tetra41
Creating a new mob,

<code>var/mob/M = new /mob(null)</code>

then setting client.mob to the new mob.

<code>player.client.mob = M</code>


Basically what you need to do is this:

<code>mob/verb/ChangeMobType(mob_type in typesof(/mob)) var/mob/newmob = new mob_type (null) var/mob/oldmob = src.client.mob src.client.mob = newmob del(oldmob)</code>
In response to Foomer
Ok, foomer i did that but when i go to talk to the guy it says this:

runtime error: Cannot read null.mob
proc name: Talk (/mob/npcs/Trainer/verb/Talk)
usr: Tetra (/mob/characters/soldierm)
src: Trainer (/mob/npcs/Trainer)
call stack:
Trainer (/mob/npcs/Trainer): Talk(/mob/characters/clericf (/mob/characters/clericf))
In response to Tetra41
You have the verb attached to the mob you're talking to, don't you? Use usr, not src, in that situation.
Hey Tetra, you would need some more code to back this up, so that when a person DOES change their character type it will keep their level intact and won't give them a level 1 thief when they HAD a level 700 cleric. And you don't want them to become a level 1 cleric when they switch back, do you? I would personally smash my monitor in if that happened(of course I have lot's of smashed monitor's...):).