I made a game where I could attack, kill, and earn money but the mob being attacked couldn't fight back. I'm not sure how to make it so that when I attack them, they attack me.
Please help!
(P.S. The mob isn't another player online, it is just a figure sitting there.)
I will take any answers because I have tried and failed many times.
Thank you. :)
1
2
ID:161166
Jun 8 2008, 1:15 pm
|
|
In response to Eternal Desire
|
|
"Bump()" ???
What will this do? Is it a procedure? |
Don't try Bump(), it will do nothing for you in this case. I have a couple of methods in my head to help with this, but I'll let Garthor or someone experienced come in, since I think my methods are inefficient.
|
In response to Darkmag1c1an11
|
|
Ok, but who is Garthor?
|
In response to Conno1234
|
|
Garthor is a robot that's awesome at DM programming.
|
In response to Darkmag1c1an11
|
|
oh ok but does he talk to people and answer their Q's?
|
In response to Conno1234
|
|
Besides Garthor, you said that you had a couple of methods.
Would you mind sharing them with me? |
In response to Darkmag1c1an11
|
|
It wouldn't be surprising.
|
In response to Conno1234
|
|
Look it up in the ref (F1 in Dream Maker).
|
Basically, you'll need to write an AI routine for the enemies. This is a very, very broad topic, and can cover a wide range of things. The simplest AI goes something like this:
1) Pick an enemy that we can see 2) While that enemy is still in range: a) If we're close enough to attack, attack b) Otherwise, step closer c) Repeat 3) Repeat So, we'll do something like this: mob There are about a million ways to improve on that, but that's a start. |
In response to Darkmag1c1an11
|
|
Darkmag1c1an11 wrote:
Don't try Bump(), it will do nothing for you in this case. I have a couple of methods in my head to help with this, but I'll let Garthor or someone experienced come in, since I think my methods are inefficient. Really? mob/monsters/Bump(mob/player/MM) I've TESTED that - it works. Onto moving monsters... mob/var/mob/player/Target |
In response to Eternal Desire
|
|
That's bad code. Don't post bad code.
|
In response to Garthor
|
|
Garthor wrote:
That's bad code. Don't post bad code.Regardless, it works. Besides, it isnt like I'm posting source codes to C/P. |
In response to Eternal Desire
|
|
It works in the limited case you've provided. It is, however, screwing up a number of things, like using usr in procs (AGAIN, I MIGHT ADD) and using walk_towards() like step_towards(). Bad code is bad code. Don't post it.
|
In response to Garthor
|
|
Garthor wrote:
It works in the limited case you've provided. It is, however, screwing up a number of things, like using usr in procs (AGAIN, I MIGHT ADD) and using walk_towards() like step_towards(). Bad code is bad code. Don't post it. You didnt even look. There isnt any 'usr' there. And I lulz'd at the bolded. fail 4chan meme is fail????? |
In response to Eternal Desire
|
|
That wasn't a 4chan meme, it was simply a statement of identity.
As for there not being any usr in it, that just shows your own ignorance. See: http://www.byond.com/docs/ref/info.html#/proc/oview Another reason you should refrain from attempting to help people. |
In response to Garthor
|
|
Garthor wrote:
That wasn't a 4chan meme, it was simply a statement of identity. Follow your own advice. Click the post and CTRL+F "usr" |
In response to Eternal Desire
|
|
I linked you to the reference. The default center argument for oview() is usr. You did not provide a center argument for oview(). Therefore, it defaulted to usr, and you used usr in your proc.
|
In response to Garthor
|
|
Garthor wrote:
I linked you to the reference. The default center argument for oview() is usr. You did not provide a center argument for oview(). Therefore, it defaulted to usr, and you used usr in your proc.' -sigh- How come whenever you guys post over-lengthly-never-getting-to-the-point code, it's good but my short, but to the point code is 'bad'? |
1
2
Um, try Bump()