ID:155451
 
I'm a newbie coder and I'm trying to figure out how to give my mob access to the icon, vars, and verbs of another mob type that's stored in a variable.

(If it gets to complicated or hard to read, just view the summary.)

(Example:)
I'm a Morpher who has a Water Dragon. I want to Morph into the Icon of the Water Dragon I've chosen in game, I already made attack buttons (verb/Attack_1, Attack_2, etc), but when I morph, the Attack verbs are redefined through the Water Dragon's redefinition of the Attack verbs (Example: Attack_1 does nothing while I'm a human. After I Morph, Attack_1 shoots a water projectile with the Water Dragon's base stats multiplied with mine.[Human Strength {15} x Water Dragon Muscle {1.8} = 27)

I've been trying to find out how to get access to Water Dragon's icon, vars, and attacks. I've tried to make the Water Dragon a var, but I think that blocks me from accessing the Water Dragon's vars because..well, the Water Dragon itself is a var. I'm not trying to make a mob switch because I think the route I'm taking would be quicker and easier in the long run because of the Login() Logout() problems. I can't figure out how to do this with my limited coding knowledge. Can you help me out? Is it a simple problem that I missed in the Byond Guide that could've helped me figure this out? Is their a better way to do this? How would you do it?

Summary: How would I make my mob able to get anything from a mob type defined in the code, when he can only have one mob type (mob/player/creature/Water_Dragon) to morph with, Morphing will change his icon, name, and Redefine blank attack verbs to those of the Water_Dragon mob type. Like I said up above, I've been racking my brain over this and tried accessing the vars of a different mob type which is supposed to be owned by the Human (Player), but my knowledge is limited..

Sorry if it's hard to read or unclear. It's really late over here and I need some sleep.

-Thanks for Reading
I think you're looking at editing the client.mob. Create dragon, change your client to the dragon, and change the player (not the dragon, the original morpher mob) loc to null. You may want to store the original mob as a variable so you can recall it easily.
In response to Lugia319
Lugia319 wrote:
I think you're looking at editing the client.mob. Create dragon, change your client to the dragon, and change the player (not the dragon, the original morpher mob) loc to null. You may want to store the original mob as a variable so you can recall it easily.


Not exactly, if I'm reading what you said right, like I stated in the first post, I didn't want to switch mobs because that would mean I'd have to Save both mobs and I would have to deal with the auto Login() and Logout().
In response to Truseeker
In theory you can access the procs and verbs of a different type via call()(). However, you cannot access the verbs from other types (well, you can attempt to access them via the : operator or via casting, but they won't exist so you'll get an error), and routing your verb and proc calls through call()() this is much less flexible than just changing the mob type which is the best thing to do from a design perspective, no matter how much effort it may seem to be to handle mob switching, since it means you can add as many mob types as you like without handling them all individually.
In response to Truseeker
Then create an area of map that you can store the person's mob temporarily. Look, you're not going to be able to change mobs without saving something if you plan to return to normal.

In addition. You could easily rewrite the login code to bypass the login code if a certain variable were edited.
In response to Lugia319
Alright, thanks a lot you guys.