ID:271156
Feb 12 2007, 4:49 pm
|
|
Ok well ive created coding where I create a new mob(the pet) when a specific event happen. each mob has a random name (picked from a list) and a random icon_state (picked from a single icon file). What i want is the name, owner and icon state to load when the player logs in. What i cant figure out is how to incorporate it into my current save mob code. when its saved I dont want the name and icon_state to be random but now set. Please help me with this. thanks.
|
In response to Mecha Destroyer JD
|
|
ahhh gotcha, i didnt think about just recreating it. ill keep you posted if something comes up.
|
In response to Chase_Hammer
|
|
I made this but for some reason it creates the mob (it lists on the mob list) however it either has no icon or no icon state. FYI the savedd* vars are assigned to the usr which seems to have the correct name. please inlighten me whats wrong.
if(src.downer == 1) |
In response to Chase_Hammer
|
|
Hmm, I don't see why you have /mob/dragons/Dragon(usr.x-1,usr.y,usr.z) after new..But I'm thinking that for icon state you'd have to put:
D.icon_state = "[usr.savedstate]" Also you might want to put: if(src.downer) //if its not 0 instead unless equaling a different number would trigger something different. |
In response to Mecha Destroyer JD
|
|
ok i got the dragon to reappear with all the vars in correctly however now it will not move with the player anymore
EDIT: I got it. THANKS!! |
In response to Chase_Hammer
|
|
That's a horrible and silly way of doing it. Just have the usual vars stored on the mob/pet, have a variable referencing the player's pet(s) on the player mob, and that's actually it, it will automatically save when you normally save the player's mob.
You'd possibly want to save and load the pet's coords manually as you do the players in the mob/pet/Write() and Read() procs, or possibly just put it on the player's turf or next to him (but actually make sure it's a valid location first -_-) after he's loaded. Also, Mecha Destroyer, there's no point in embedding a string in an empty string...It obviously has the same results as using the string directly. var/string = "some sample text" |
Then when they load, you could possibly make a new pet and reassing the variables to it.: