Code:
Problem description:
I've tried this many times, I've used many different things, I've even tried taking the character creation from the Graphical MUD Kit! And all I want to know is, HOW DO YOU CHANGE A PLAYERS MOB?!?! I use src.client.mob, but it ALWAYS gives me a runtime error: bad client. HOW CAN I DO IT?!?!
ID:144049
![]() Apr 14 2007, 10:07 am
|
|
Do you want to "stick" the client to another mob, or just change the one you alreay have?
for the former: mob/verb/bodysnatch() client.mob can be used to do this - so if that's what you were going for, you're on the right track. The runtime error may stem from an attempt to "body snatch" with a mob that isn't controlled by a client. For the latter possibility: client/verb/alter_mob(var/setvar1, var/setvar2) Which were you going for, and were you looking for something a bit more complex? Maybe we could see some code... --Vito |
I was trying to change the usr's mob to another, pre-defined mob in the game. So the usr could have special verbs that nobody else could have.
|
When will I get an answer?! Changing the src.client.mob var works in the Graphical MUD Kit, so why doesn't it work here?
|
Why not post the code you're trying to use that isn't working?
Something as simple as this should do the trick: mob However, in the case of administration abilities, you might want to consider a different path. I would suggest just adding the verbs to their verbs list without actually switching their mobs. Now, to do this, you create a fake class to put all the verbs under. Something like "mob/Admin" will work fine. Then, when you want to give the verbs to someone, just do "M.verbs+=typesof(/mob/Admin/verb)-/mob/Admin/verb," with M being the player to give the verbs to. Here's an example: mob That's about the gist of it. There may be a few mistakes, since I just did this off the top of my head. If you need me to further explain any of it, I'd be happy to oblige. |
Then modifying src.client.mob (for verbs defined under something other than the mob use usr.client.mob) should do nicely. Again, if I could see code, I could <s>shoot it full of holes</s> - err, show you what's going wrong to give you "error: bad client".
--Vito |
You should probably have the mob/Login() code in client/New(), or somewhere similar. mob/Login() isn't all that safe if you're moving people around between mobs.
|
Jp wrote:
mob/Login() isn't all that safe if you're moving people around between mobs. True. His code like there will make an infinite loop. Note however generally you should use client/New() instead I guess, but you CAN easily distinguish between connecting/disconnecting from the game and between mob-switching in both Login() and Logout(). Their reference entries tell about this. |
I understand all of it, but I used your code and it still gives me this error:
runtime error: bad client proc name: Login (/mob/Login) usr: Red Team (/mob/Red_Team) src: Red Team (/mob/Red_Team) call stack: Red Team (/mob/Red_Team): Login() I'llpost the code here: mob |
Kaioken wrote:
His code like there will make an infinite loop. Whoops. Sorry, I was tired last night. Nice catch. Armiris wrote: I understand all of it, but I used your code and it still gives me this error: Well, there are a few problems with your code (most of them my fault, sorry), but none of them that would lead to a bad client (which makes me think you're manually calling login on something) First, let's take their suggestion and use client/New() instead for choosing a team: client Now, we'll re-setup the teams to match this: (Oh god, Firefox just crashed, curse you QuickTime update!) mob You'll also notice that I defined team under the actual team mobs. This way, you could even change the teams to something more simple, like just "White", "Red", and "Blue". |
DarkCampainger wrote:
Kaioken wrote: Sure, no problem. Stuff like that happens. A lot. Well, there are a few problems with your code (most of them my fault, sorry) Really, screw him, he shouldn't be copying your code in the first place... |
1. Allow them to look different(Change icon?)
2. ALlow them to control someone else(temporarily/permanently)
2a. Allow them to be an EXACT copy
1. Just change their icon..
2. Click here
2a. Just manipulate stats:
src.hp = M.hp // of course you have to select who M or whatever is first
Also in the future for code problems, show your code..Otherwsie, it might be a better Developer How To..