ID:263656
 
Code:Inuzuka Clan Dog Verbs
mob
pet
icon = 'dog.dmi'
Move_Delay=1
tai=5000
maxhealth = 1000000
density=1
health = 1000000
isdog=1
Move()
..()
var/mob/O = src.owner
if(src.Frozen)
return
src.random = rand(5000,10000)
if(src.random==1)
src.tai += 2500
src.maxhealth += rand(5000,10000)
src.health += rand(5000,10000)
O.dogmaxhealth=src.maxhealth
O.dogtai=src.tai
Bump(mob/M)
..()
var/mob/P = src
if(istype(M,/mob/))
if(M == owner||M.name == src.name||Wfight==0||fighting)
return
if(M.PK==0)
return
if(src.PK==0)
return
else
var/Damage = P.tai
M.health -= Damage
Death(M)
view() << "[src] attacks [M] for [Damage]!"
src.fighting = 1
sleep(5)
src.fighting = 0
mob/inuzuka
verb
Tame(mob/pet/P in oview(1))
set category = "Dog"
if(P.cansave)
usr<<"You can not tame players"
return
if(istype(P,/mob/npc))
usr<<"You can not tame NPCs"
return
if(!usr.hasdog)
if(usr.Inuzuka == 1)
if(!P.named&&!P.owned)
P.loc = usr
P.owner = usr
P.owned = 1
P.tai = usr.dogtai
P.maxhealth=usr.dogmaxhealth
usr.hasdog=1
usr.dog = P
P.named = 1
P.name = input("Please select a name for your new dog.") as text
usr.dogname=P.name
usr.dogtai=P.tai
usr.dogmaxhealth=P.maxhealth
usr.verbs += typesof(/mob/dogstuff/verb)
usr.SaveK()
else
usr<<"This dog already belongs to someone."
return
else
usr<<"Only members of the Inuzuka clan are able to tame dogs."
return
else
usr<<"You already have a dog."
return

mob/var
owner
Wfight = 0
named = 0
fighting = 0
sit = 0
isdog=0
dogtai=0
mob/dogstuff
verb
Pickup()
set category = "Dog"
for(var/mob/pet/P in oview(6))
if(usr == P.owner)
P.loc = usr
P.Frozen = 0
else
usr<<"This dog does not belong to you."

Drop()
set category = "Dog"
for(var/mob/pet/P in src.contents)
if(P.health >= 1)
P.loc=locate(usr.x,usr.y-1,usr.z)
P.Frozen = 0
P.owner=usr
else
usr<<"Your dog is hurt and cannot be dropped.."
return
Aggressive()
set category = "Dog"
for(var/mob/pet/P in oview())
if(P.owner == usr&&P.Wfight == 0)
P.Wfight = 1
usr<<"Your dog will now attack anything it bumps into."
return
else if(P.owner == usr&&P.Wfight == 1)
usr<<"Your dog will no longer attack anything."
P.Wfight = 0
return
else
usr<<"This is not your dog!"
return
Sit(var/mob/pet/P in oview(1))
set category = "Dog"
if(P.owner==usr&&P.sit == 0)
P.Frozen=1
walk(src,0)
else if(P.owner==usr&&P.sit == 1)
P.Frozen=0
walk(src,0)
else
usr<<"This is not your dog."
return
Come()
set category = "Dog"
for(var/mob/pet/P in view())
if(P.owner==usr)
P.Frozen=0
walk_towards(P,src)
FollowSomeone(mob/M in view())
set category = "Dog"
for(var/mob/pet/P in oview())
if(P.owner == usr&&P.Frozen == 0)
walk_towards(P,M)


Problem description:

Simply Put, I'm stumped. The Inuzuka clan can be very successful... If not for two accursed glitches... The Pick Up Verb... Well, suffice to say, no matter what, the dog can just NOT be picked up! And if someone logs out, and logs back in, the dog is still there, but it says it isn't theirs. What's wrong with this...? I've been nearly tearing my hair out trying to figure it out...
C'mon... Doesn't anyone have any idea on how to fix this?
The dog's owner is being set to a reference to the mob, which is a highliy volatile method of determining the owner of the canine. You should try to use mob.ckey as the dog's owner, which has a lot more permanence.

There's also a myriad of issues with this program bit besides. The variables dog and hasdog do the same thing, which makes one or the other redundant, and I'm sure there's no typecasting being done on the dog variable as well. The first half of the dog creation seems to be a direct mirror of the second half, which makes me believe it's pure redundancy; if the dog variable that belongs to a player mob is typecasted, you could directly access variables belonging to the dog as so:

src.dog.tai -= 10

(given I have no idea what tai is, but the example serves its' purpose).

If the dogs are being saved, as well, the process for doing so is a little complicated.

mob/var/tmp
mob/dog = null //this variable has to be tmp so it is not saved

client/Del()
if(src.mob.dog) src.mob.contents += src.mob.dog
//rest of saving
..()

mob/Login()
..()
var/mob/pet/p = locate() in src //find the dog saved with the mob, if they have one
if(p) //they have a dog
p.loc = src.loc
src.dog = p
//rest of loading


The contents list is (for lack of a better word) re-referenced when the mob is created, so it's safe to stash the dog in there for the purposes of saving because BYOND will take care of the overhead for you.
In response to Mobius Evalon
THank you SO Much! That really helped out in making headway with fixing! THe only problem left is whenever the dog owner logs in, thier dog can't be set down to move around, because it's max health, it's current health, and it's Strength are all set down to 0...
In response to Neo-Chaos Productions
a bit late...but i would appreciate it if you didnt use the WOTS source code to make yet another rip.
In response to Axerob
Okay. So it may be a rip. But I'm reworking it as much as possible, and my staff is helping me replace a lot of the icons, and I'm trying my best to add as many unique things to make it something worth playing. Sure, a lot of rips are out there and most of them suck, but I'm gonna' try my very best to break the monotony! Besides, this is a thread for CODE PROBLEMS, not Problems with a Game's Origins.
In response to Neo-Chaos Productions
no, but 90% of the "Lurkers" here Are Rip/Anime haters and usually wont help rippers(if you have been here long enough you would know what i mean)
In response to Axerob
Axerob wrote:
no, but 90% of the "Lurkers" here Are Rip/Anime haters and usually wont help rippers(if you have been here long enough you would know what i mean)

Yeah, every so often we'll get another "I Hate Anime/Rips" topic, then everyone posts on the topic to tell them that we've seen this like a zillion times already. (I did that once.) However, I think you won't have a problem getting help.
In response to Axerob
Axerob wrote:
a bit late...but i would appreciate it if you didnt use the WOTS source code to make yet another rip.

Well, that explains some of why the posted code is so bad.
In response to ShadowUser
ShadowUser wrote:
Yeah, every so often we'll get another "I Hate Anime/Rips" topic, then everyone posts on the topic to tell them that we've seen this like a zillion times already. (I did that once.) However, I think you won't have a problem getting help.

Thanks. It feels good to hear someone give a positive comment. Already, I have an Iconner helping me with redoing all the NPCs, I'm trying my best to fix and edit a lot of the errors, and add new things whenever inspiration hits me. And, I'm working on getting new Midis, New Maps, and things like that.
In response to PureStrainZero
If you're getting all this new stuff redone, why don't you just remake the whole game from scratch, so you won't have many problems with the code.
In response to Neo-Chaos Productions
My points exactly just make the coding from scratch, WOTS coding is as bad as Zeta, your not going to learn a thing from it except get a headache. Besides like you said your going to try to make things original, It can look like a duck, act like a duck, but if under the skin its a dog. Its just not a duck. <- Okay I know that was korny but it is true.
In response to Y2kEric
Well, quite simple... I'm still pretty much Moderate when it comes to Coding... I still have trouble understanding a lot of things, and I also am the only coder on my group... Untill I can get a stable server(Hopefully the cleanup and Defragging on My PC will help this out greatly.)... So, until I, by some miracle, meet an amazing coder, or a great tutor, I'm stuck building up from a source...
In response to Neo-Chaos Productions
Try reading Zial's Tutorial or the DM Guide insead of ripping.