ID:169202
 
How do I make certain objects appear in the statpanel. Say I have a pet and I want the players current pet to appear on the statpanel. How would I do this? Note: I want the pet to show on the statpanel and he's a mob.

~>Jiskuha
I think you mean something like:
mob
Stat()
statpanel("[usr]")
stat(usr)
stat("Name:","[usr.name]")
stat("Health:","[usr.Hp]/[usr.Mhp]")
stat("Strength:","[usr.Str]")
stat("Defence:","[usr.Def]")
stat("")
stat("Experience:","[usr.Exp]/[usr.MExp]")
if(usr.haspet == 1)
statpanel("Pet")
stat("[usr]'s Pet","")
for(var/mob/pet/c in world)
if(c.owner == usr.key)
stat(c)
stat("Health:","[c.Hp]/[c.Mhp]")
stat("Strength:","[c.Str]")
stat("Defence:","[c.Def]")
stat("Level:","[c.Lvl]")
stat("")
stat("Experience:","[c.Exp]/[c.MExp]")
You could store the pet in a player variable, like this:
mob/verb/MakePet()
var/mob/Pet/P=new(usr.loc)
usr.Pet=P

Then you would just put it in the stat() like any other variable:
mob/Stat()
stat("Pet- ",Pet)
In response to Artekia
Thanks guys.

~>Jiskuha
In response to Jiskuha
Np.

--Chwgt
In response to Chwgt
Instead of starting another topic I'll just post here.

Okay, I have another mob who IS NOT the player. I want to save this mobs stats when the player logs out and loads them when the player logs in. How would I accomplish this?

~>Jiskuha
In response to Jiskuha
Just input the variable referencing the other mob into the savefile as you normally would any other.
var/savefile/S = new
S["/mymob"]<<src
S["/my_friend"]<<friend
In response to Loduwijk
Thats a tad confusing. Can you go into detail a bit more?

~>Jiskuha
In response to Jiskuha
mob/verb/SaveMyFriend()
var/savefile/F = new("MyFriend.thisextensionworks") //create a savefile for the other mob
F["friend"] << M //M is the other mob who we're trying to save
In response to DeathAwaitsU
Can you go into lamen terms and major detail? I'm afraid I still cant grasp this concept. What exactly is it doing and why and how is it doing this? Please note this is something very new for me.

~>Jiskuha
In response to Jiskuha
It can't get much simpler than that.

Reading this may help though http://www.deadron.com/Games/ByondBasicSavefiles.html
In response to Jiskuha
I didn't quite understand it at first either but now I do so here goes..The arrows point left to show whats saving and to the right to show whats being loaded.

ex.
var/savefile/S=new("save.sav")
S["A"] << src.var

var/savefile/S=new("save.sav")
S["A"] >> src.var