ID:176286
 
Ok Im kinda stuck on this. How could i go about making A proc to call to certain mobs if they have a certain variable true. Within the proc, I'd like it so that if your mob that you control, walks into this other mob, it pushes the other mob one step foward in the direction the player mob walked into it, and the pushed mobs dir = player mobs dir so it looks like the mob was pushed..

If anyone can help I'd be very appreciative.

-
_-ETG-_
atom/movable/Bump(var/X)
step(X, usr.dir)


something like that should do it
In response to WildBlood
WildBlood wrote:
atom/movable/Bump(var/X)
step(X, usr.dir)


something like that should do it

Do not put usr in movement procs! Gads! What does it take to get through to you people?

src is the thing that's moving, so src is correct, not usr.

[EDIT]
I should also point out that since X may be a turf, and you didn't think to check for whether it's movable, step() will cause some very interesting errors if you try to push a wall.

Lummox JR
In response to Lummox JR
Whatever*
In response to WildBlood
WildBlood wrote:
Whatever*

No, not whatever. If you can't tell the difference between src and usr you have no business offering people help with their code; all you could do is make the situation worse. I've seen too many people get confused by bonehead advice only to end up in worse shape than when they started.

usr is dumber to put in Move() and Bump() because in those cases, src is not only clearly right but it's easier to use. In Enter() and Entered() and such it's a more common mistake, because src isn't what people want to use and they forget about the argument to the proc. (That, and there's a bad entry in the reference.)

Lummox JR
In response to Lummox JR
You have no business critizing peoples help, i offered help and i forgot one thing, you dont have to mock us about it so sue me Get off your high horse. You got a correction make it but statements like "Gads! What does it take to get through to you people?" are not needed expecial when all people try to do is HELP!
In response to WildBlood
Is this gonna turn into a monkey poop slinging fight?
Cos i got a whole heap of monkey poop!

Now be good boys and kiss and make up ya'hear?

-Spoon
In response to Spoon
*MONKEY SMOOCH*
In response to WildBlood
WildBlood wrote:
You have no business critizing peoples help, i offered help and i forgot one thing, you dont have to mock us about it so sue me Get off your high horse.

I wasn't mocking you; I was correcting you in very strong terms. Mockery is something entirely different.
And yes, I do have every business criticizing you, because your "help" was nothing of the kind; you offered a half-heeled solution that included an item so outright wrong that it's more than just a mere slip. An "oops" kind of thing is when you forget to declare a var you used, or accidentally capitalized something you shouldn't have. Putting usr in Bump() is so totally wrong, though, that it falls in a different constellation.

You got a correction make it but statements like "Gads! What does it take to get through to you people?" are not needed expecial when all people try to do is HELP!

What you did was not help. You could have made the situation a lot worse if you weren't corrected right away and in strong terms.

And when literally every other day (which is an improvement, since until lately it was every day), someone is putting code up on the forums that plops usr down in a movement proc, yes, the correction has to be strong and it has to be vehement, because the people doing it aren't learning. And those who splash up that code in a misplaced attempt to help are only confounding the situation.

We all appreciate that you and so many others are willing to help people. That's good and by no means do I want to dissuade you from helping people in the future. But when you do, please be sure you have an idea what you're doing. By no means should you teach someone to commit the #1 mistake of DM coding.

Lummox JR
In response to WildBlood
He's got massive senority over you, and GURU status, you have no right to tell him he has no right to criticise him. as a matter of fact, I believe he has a right because of a certain AMENDMENT... *AHEM* anyway, don't call Deprimation of Character either, he did not insult you, he merely showed that you were ignorant by pointing out a public misconception.
Okay, since WB's Code wasn't a great ammount of help, here's my way about it!

mob
Bump(var/atom/O)
if(istype(O,/mob))
var/mob/M = O
M.Move(get_step(M,src.dir),M.dir)
M << "[src] pushes you!"
src << "You push [M]!"
return 1

yeah, erm.. I'm not certain if I used src right in this (vs. usr), but for the most part I could care less, it will work under these circumstances.
In response to WildBlood
Here's a few things to remember:

1: This will move ALL atoms no mater what they are if they are dense (or at least try to)

and on top of that, this WILL NOT work, you see, usr moves north and hits a wall: the wall is a turf, the wall cannot move from it's initial location. second: I THINK that (and I may be wrong on this) the step proc is reserved for atom/movable, not certain but I believe it is... hmmm....

anyway, this code is not effective, and dangerous. I do not think this should have been "saged" out.
In response to Ter13
I have no Care over senority, you do not go badmouthing people who are trying to help thats bogus and i dont care if your the friggen pope doing it it shoundt be done
In response to WildBlood
I suggest you go take a knife and stab yourself in your face to cure any headaches you may encounter.

...

...

...

Don't get mad at me for providing bad advice! I'm only trying to help!
In response to Garthor
Actually stabbing holes in the skull was a odd ancient remedy for something, thank you for the kind advice ill go starilize my screwdriver and hammer right now
In response to WildBlood
WildBlood wrote:
I have no Care over senority, you do not go badmouthing people who are trying to help thats bogus and i dont care if your the friggen pope doing it it shoundt be done

It's not about seniority. But what you did was not helping; you royally screwed up and could have done a lot of damage. As I said this is the #1 mistake in BYOND programming, and you went and advised someone to do it. That shows you don't know what you're doing, so you shouldn't presume to help anyone until you do. And there's no point copping an attitude about it, because you should have known better than to give bad advice in the first place, and all you really had to do was accept that and do better next time.

Lummox JR
In response to WildBlood
ahem *sterilize* is the word, just friendly advice.
In response to WildBlood
Feel like flaming? Take it to Chatters!
In response to Lummox JR
And all you had to do was put in your comment in a better tone. Better luck next time and anyone considering "Gads! What does it take to get through to you people?" a nice thing needs alittle mental check up
In response to Ter13
Actually there is no * in any word.. might wanna check the dictonary in that.. and 2 on the word wow bad mistake there
*sterilize* tsk tsk. Also why is there a period at the end of that sentance? you didnt even capitilize the starting. tsk again.. tsk tsk
Page: 1 2