ID:147389
 
It stores the pets but when i Revive the pet its named "mob" and it doesnt revive the Pets variables either for some reason.This is my code,ive been trying this for about 5 days so any help would be appreciated.
mob/var
PetStorage1 = 0
mob
NPC
PetStorage
icon = 'NPC.dmi'
icon_state = "PetStorage"
Click()
if(src in oview(1))
if(usr.action)
return
else
usr.action = 1
if(usr.move == 0)
usr.action=0
return
else
usr.move = 0
var/R = input("What do you want to do","[src]")in list("Freeze","Revive","Cancel")
switch(R)
if("Freeze")
if(usr.Pet)
usr.PetStorage1 = usr.Pet
del usr.Pet
else
usr << "You dont have a pet to freeze"
usr.move=1
usr.action=0
if("Revive")
if(usr.PetStorage1 == 0)
usr << "You dont have a pet to Revive"
else
if(usr.Pet)
usr << "You already have a pet Out"
else
usr.Pet = usr.PetStorage1
usr.PetStorage1 = 0
usr.Pet = new(usr.loc)
usr << "You revive [usr.Pet]."
usr.move=1
usr.action=0
if("Cancel")
usr.move=1
usr.action=0
return
May I see the var "Pet" from usr.pet? My guess is that you aren't saving all the variables under usr.pet, and that's why they don't come up when the pet is revived.
In response to Dragon of Ice
You mean this?
mob
var
mob/Pet

and i make the Pet variables here.
mob
var
PetStrength
//and so on
mob
Pets
PetExample
icon = 'PetExample.dmi'
PetStrength = 65
//and so on
Ok...I had a problem with this awhile ago, and I found a cheap way out of it. Just add the pet to the mob's contents, and set usr.Pet to null. It will save properly, and to take the pet out, just search through the mob's contents for it. Oh, but if you're displaying the mob's contents in a statpanel, you'll have to make sure it only displays objects.
mob
Stat()
statpanel("Inventory")
for(var/obj/O in contents)
stat(O)
In response to SSJ Radditz
Im getting the same problem.Should it be like this?
mob
NPC
PetStorage
icon = 'NPC.dmi'
icon_state = "PetStorage"
Click()
if(src in oview(1))
if(usr.action)
return
else
usr.action = 1
if(usr.move == 0)
usr.action=0
return
else
usr.move = 0
var/R = input("What do you want to do","[src]")in list("Freeze","Revive","Cancel")
switch(R)
if("Freeze")
if(usr.Pet)
usr.Pet.Move(usr)
usr.Pet = null
else
usr << "You dont have a pet to freeze"
usr.move=1
usr.action=0
if("Revive")
for(var/mob/Pets/T in usr)
if(T)
if(usr.Pet)
usr << "You already have a pet Out"
else
usr.Pet = T
usr.Pet = new(usr.loc)
usr << "You revive [usr.Pet]."
usr.move=1
usr.action=0
if("Cancel")
usr.move=1
usr.action=0
return
In response to Turles9000
usr.Pet = new(usr.loc)

Change that to usr.Pet.Move(usr.loc)
In response to SSJ Radditz
Im having 2 More problems.1 is that If i try to Revive and have no Pets in my Inventory its suppose to say "You have no Pets to Revive" But instead it does nothing.Another problem im having is depending on the amount of Pets i have stored it gives me that many "You already have a pet Out"
Messages if i try to revive with a pet.
mob/var
PetSlot
PetSlot1 = 0
PetSlot2 = 0
PetSlot3 = 0
mob
NPC
PetStorage
icon = 'NPC.dmi'
icon_state = "PetStorage"
Click()
if(src in oview(1))
if(usr.action)
return
else
usr.action = 1
if(usr.move == 0)
usr.action=0
return
else
usr.move = 0
var/R = input("What do you want to do","[src]")in list("Freeze","Revive","Cancel")
switch(R)
if("Freeze")
if(usr.Pet)
var/K = input("Which slot do you want to freeze him in?","[usr.Pet]")in list("One","Two","Three","Cancel")
switch(K)
if("One")
if(usr.PetSlot1 == 0)
usr.Pet.Move(usr)
usr.Pet.PetSlot = 1
usr.PetSlot1 = 1
usr.Pet = null
else
usr << "You already have a Pet in Slot1"
if("Two")
if(usr.PetSlot2 == 0)
usr.Pet.Move(usr)
usr.Pet.PetSlot = 2
usr.PetSlot2 = 1
usr.Pet = null
else
usr << "You already have a Pet in Slot2"
if("Three")
if(usr.PetSlot3 == 0)
usr.Pet.Move(usr)
usr.Pet.PetSlot = 3
usr.PetSlot3 = 1
usr.Pet = null
else
usr << "You already have a Pet in Slot3"
else
usr << "You dont have a pet to freeze"
usr.move=1
usr.action=0
if("Revive")
for(var/mob/Pets/T in usr)
if(T)
if(usr.Pet)
usr << "You already have a pet Out"
else
var/K = input("Which slot do you want to Revive?","[usr.Pet]")in list("One","Two","Three","Cancel")
switch(K)
if("One")
if(T.PetSlot == 1)
usr.PetSlot1 = 0
usr.Pet = T
usr.Pet.Move(usr.loc)
usr.Pet.loc = locate(usr.loc)
usr << "You revive [usr.Pet]."
else
usr << "You have no pet in Slot One"
if("Two")
if(T.PetSlot == 2)
usr.PetSlot2 = 0
usr.Pet = T
usr.Pet.Move(usr.loc)
usr.Pet.loc = locate(usr.loc)
usr << "You revive [usr.Pet]."
else
usr << "You have no pet in Slot Two"
if("Three")
if(T.PetSlot == 3)
usr.PetSlot3 = 0
usr.Pet = T
usr.Pet.Move(usr.loc)
usr.Pet.loc = locate(usr.loc)
usr << "You revive [usr.Pet]."
else
usr << "You have no pet in Slot Three"
else
usr << "You have no Pets to Revive"
usr.move=1
usr.action=0
return
if("Cancel")
usr.move=1
usr.action=0
return
In response to Turles9000
I know the reason its giving me more then one "You already have a pet Out" is because im Checking for every Pet in his inventory and its doing that everytime it finds one But i have no idea how to fix it.