ID:149858
 
Ok, i searched and searched through the forums, as well as the reference, but i couldnt find what i was looking for. I know i have seen it on the forum, but i will ask anyway. I'm looking for a way to change the users type. Example:
mob
red_ant
icon = 'redant.dmi'
var
is_red_ant = "yes"
black_ant
icon = 'blackant.dmi'
var
is_red_ant = "no"


Upon login i want a choice to choose two mobs. In this case, red ant, or black ant. If they choose red ant, they would become a type of /mob/red_ant (have its icon, vars etc). I have tried client.mob = /mob/red_ant and usr.mob = /mob/red_ant. Neither worked. Could someone point me in the right direction before i get too lost? :]

thanks

-Rcet
I'm not real sure, but maybe something like:
<code> src.mob = new /mob/red_ant() </code>
It's worth a try.

Rcet wrote:
Ok, i searched and searched through the forums, as well as the reference, but i couldnt find what i was looking for. I know i have seen it on the forum, but i will ask anyway. I'm looking for a way to change the users type. Example:
> mob
> red_ant
> icon = 'redant.dmi'
> var
> is_red_ant = "yes"
> black_ant
> icon = 'blackant.dmi'
> var
> is_red_ant = "no"
>

Upon login i want a choice to choose two mobs. In this case, red ant, or black ant. If they choose red ant, they would become a type of /mob/red_ant (have its icon, vars etc). I have tried client.mob = /mob/red_ant and usr.mob = /mob/red_ant. Neither worked. Could someone point me in the right direction before i get too lost? :]

thanks

-Rcet
In addition to Creek's suggestion, you should also move var/is_red_ant up to the main mob type. Any var you want to exist in subtypes should be defined in the parent.

Lummox JR
In response to Creek
That wouldnt work.

error:src.mob:undefined var

Ive also tried replacing src with client, but it seems to do nothing.

-Rcet
Ok, i got it to change the mob type, but now when they pick, the box asking what one pops right back up again!

Login()
var/ant = input("Which would you like to be?") in list ("red ant","black ant")
switch(ant)
if("red ant")
src.client.mob = new /mob/red_ant()
usr.Move(locate(3,3,1))
if("black ant")
src.client.mob = new /mob/black_ant()
usr.Move(locate(1,1,1))


thanks

-Rcet

[edit]
I just found out why. I make myself a NEW mob of the type, and by doing that, it calls the Login proc contantly.. Now i need a way to stop it from calling Login.
In response to Rcet
Rcet wrote:
I just found out why. I make myself a NEW mob of the type, and by doing that, it calls the Login proc contantly.. Now i need a way to stop it from calling Login.

Why, that's easy! Instead of putting this stuff in mob.Login(), try putting it in client.New().

mob.Login() is called whenever a key is attached to a mob.
client.New() is called whenever a player connects.

The mob.Login() is being called over and over because you're attaching your key to the mob that was created. By using client.New(), it should only run once.

Good luck!