I have been trying forever to get this stupid Call_Pet verb to work but it won't and I am getting very agitated. All i'm trying to is get it so that after the pet reaches you it stops following you, I have used soooo many different things and asked people, but nothing works!!!! If you cn help I would appreciate so much.
If you want my code that I already have, or just some more information on what I need done reply and tell me, I will be glad to do whatever it is you want me to do.
thanx,
The Little Kid
ID:178354
May 24 2002, 11:34 am
|
|
In response to Malver
|
|
Malver wrote:
Well, posting your code with the problem here and the errors generated should be automatic. We can't help you without knowing what the problem is. I know that, and if you would have read more carefully you would've noticed how I did explain my problem, and I have posted my code on the last 3 times I have posted my question and even though I have got plenty of help none of it has had worked. For the record there is no errors. |
In response to LittleKid15
|
|
call pet as in call it back to you?
easy mob/verb/call_pet() for(/var/mob/M as mob in world) if(M.owner==src.owner) M.walk_to(src,M) well walk_to might not be even close to being right but just look it up in teh reference |
In response to LittleKid15
|
|
LittleKid15 wrote:
I know that, and if you would have read more carefully you would've noticed how I did explain my problem That still doesn't enable me to invision the code. and I have posted my code on the last 3 times Well, if you'd want help, then a 4th would be good. :P I have posted my question and even though I have got plenty of help none of it has had worked. That's why I asked for the code, so I could try to help. For the record there is no errors. Why does it need to be 'for the record'? |
In response to Malver
|
|
here is the code:
mob pet verb Call_pet() set src in oview() walk_to(src,usr,1,2) if(get_dist(src,usr)<=0) walk(src,0) return I might as well give you the problem too. Here it is... Everything works fine, no errors, but when the pet reaches you and you decide to walk away from your pet, like a love riden stray animal it just follows you wherever it goes. If you could help, then it would be great. thanx, Little Kid |
In response to LittleKid15
|
|
LittleKid15 wrote:
here is the code: You have to realize that the interpreter reads each line of code, one line at a time, then goes on to the next one. Let's look at what you've told the computer to do. Call_pet() set src in oview() Someone calls the verb. walk_to(src,usr,1,2) The source walks towards the user. if(get_dist(src,usr)<=0) walk(src,0) return Immediately after we start the source walking, we check to see if the user and the source are on the same space to each other. If this is the case, we stop the source from walking. The proc is now over, and the computer will ignore the source until another verb or proc is called which brings it into play. See what the problems are? One, unless either the user or the source is non-dense, the distance will never be equal to 0 (and in any case, it would never be less than zero.) Two, it doesn't do any good to check once to see where the source and user are in relation to each other right at the same time you start the source walking... what you need to have it do is to keep checking until the source has reached the user. Luckily, I believe the walking procs already have a way of taking this into account... if you'd read the help files with an eye towards this, I'm sure you'll be able to figure it out. |
In response to Lesbian Assassin
|
|
first of all I have read the help files for about every single walk_to step_to and those procs and they all say that walk cancels this following action that it keeps doing, and I have put the 0 to 1 before but it still didn't work. THERE LIKE LEACHES I TELL YOU, THEY WON'T LEAVE ME ALONE.
|
In response to LittleKid15
|
|
LittleKid15 wrote:
first of all I have read the help files for about every single walk_to step_to and those procs and they all say that walk cancels this following action that it keeps doing, and I have put the 0 to 1 before but it still didn't work. Like I told you, your if statement does nothing because it's being evaluated once immediately after you start the walking. That's like asking the engineer on a train leaving Boston for Chicago, "Are you at Chicago yet?" and when they say "No," you say, "Okay, then keep on going forever!" What you want to do is find out when the train gets to Chicago, not ask it if it's at Chicago before it has a chance to get there. Try changing: walk_to(src,usr,1,2) to walk_to(src,usr,0,2) and getting rid of everything after it. This will make the pet try to keep getting closer to the user, even if it's as close as it can be, meaning, the pet will bump into the player. This will cause the pet's Bump() proc to be called, with the player passed in as an argument. Bump(atom/a) if (istype(a,/mob/whateveryourplayersmobsaredefinedas) walk(src,0) THERE LIKE LEACHES I TELL YOU, THEY WON'T LEAVE ME ALONE. Fine. We'll all leave you alone in the future. I thought you posted here because you wanted help. Should I delete my advice above? |
In response to Lesbian Assassin
|
|
LesbianAssasin wrote:
Fine. We'll all leave you alone in the future. I thought you posted here because you wanted help. Should I delete my advice above? no, you misunderstood me. I meant the pets on my game are like leaches. and thanx for the help, but it still don't work. here is what I have now: mob pet verb Call_pet() set src in oview() walk_to(src,usr,0,2) Bump(atom/a) if(istype(a/mob/PC)) walk(src,0) here is he error: coding\animalsystem.dm:66:error: proc definition not allowed inside another proc. I just don't see why it won't work. |
In response to LittleKid15
|
|
LittleKid15 wrote:
and thanx for the help, but it still don't work. You want to override the mob/pet/Bump() proc, not include it in your Call_pet() verb. You want to unindent the Bump() line and each line under it by two tabs. mob pet verb Call_pet() set src in oview() walk_to(src,usr,0,2) Bump(atom/a) if(istype(a/mob/PC)) walk(src,0) |
In response to Shadowdarke
|
|
now I get these errors:
coding\animalsystem.dm:67:error:mob:undefined var coding\animalsystem.dm:67:error:pet:undefined var coding\animalsystem.dm:67:error::unknown variable type now what should I do to fix this? mob pet verb Call_pet() set src in oview() walk_to(src,usr,0,2) Bump(atom/a) if(istype(a/mob/pet)) walk(src,0) |
In response to LittleKid15
|
|
Bump(atom/a) Two problems here. One, the istype() proc needs two arguments: a thing and the type you're comparing that thing to. You just have one argument. Split them with a comma, like this: istype(a,/mob/pet) That's one problem fixed. Now, the other one. a is what the pet has bumped into... you don't want to know if a is a pet, you want to know if a is a player. Switch /mob/pet to whatever type your player is. |
In response to Lesbian Assassin
|
|
I don't know what is wrong with it now. I hve exactely what I have told to put but it still don't work. I'll give you my code again, but if yall can't fix it this time i'll just not put it.
mob pet verb Call_pet() set src in oview() walk_to(src,usr,0,2) Bump(atom/a) if(istype(a,/mob/PC)) walk(src,0) I don't think that this would even matter towards my problem but I do define my mobs by mob/PC/other, and mob/PC/guy. I've tried changing the istype() to exactely what I have the mob that I chose defined by, but it still didn't help any. All the pet does is keep bouncing around the mob. |
Well, posting your code with the problem here and the errors generated should be automatic. We can't help you without knowing what the problem is.