When I start the game, all the monsters start in their respective homes. They wander about in there, keeping inside their areas. But if a player attacks them, they will follow the player outside of their area. If the player moves more than 6 tiles away, the monster will start wandering around again, but this time refusing to leave its current area.
How can I get it to return to its starting areas? And how can I get it to only leave a certain number of tiles from its home area, before it returns ignoring all players until it gets there? I've made a few attempts, and they've all gone terribly wrong.
Thank you for your time.
~Ease~
ID:170250
Feb 28 2005, 10:13 am
|
|
Feb 28 2005, 4:17 pm
|
|
you could have them teleport back to a loc after they're done chasing someone.
|
In response to Elchry
|
|
I want them to walk back to an area, not a loc. I don't know how to tell them to seek out an area.
|
In response to Ease
|
|
Ease wrote:
I want them to walk back to an area, not a loc. I don't know how to tell them to seek out an area. You could make them have a "home" area. mob That should work. :p |
In response to Hell Ramen
|
|
And how would you set the area?
I tried this under the Monster New() And this just caused it to crash |
In response to Ease
|
|
Don't forget that a turfs loc is an area, so make a Get_Area() proc:
proc/Get_Area(atom/a) Then you need a decent proc for searching out areas. I think locate() returns the closest tile. I don't know if it works for areas, though. Add a simple AI proc, with a check for distance, a check for a target, and chase procs, then finally your return proc and voila! proc/AI() |
In response to Hazman
|
|
Hazman wrote:
Then you need a decent proc for searching out areas. I think locate() returns the closest tile. I don't know if it works for areas, though. locate() does nothing of the sort. Add a simple AI proc, with a check for distance, a check for a target, and chase procs, then finally your return proc and voila! proc/AI() There's just way too much that won't work here. For starters, an AI proc is usually implemented as a loop, and the var/area/a=Get_Area(src) call should be saving the starting area. The type check against /area/home is bogus because it should be comparing to the monster's specific home area, not a single common home area type. The step_rand() proc actually doesn't take the area into account, so the monster may leave its area unintentionally even when not chasing a target. And finally, you've actually declared var/area/a twice, so this won't compile. Lummox JR |
In response to Lummox JR
|
|
Thank you Lummox, but I had already made my own Monster "AI" - all I couldn't do was amend it so that they returned to their own areas. The Get_Area proc from Hazman triggered my mind enough for me to make my own proc and amend my AI! =D
However, it is now very very messy, and doesn't even work! ai_random_wander()//random wander if no mobs are in range to attack ai_random_wander() is the main proc, called when all monsters are made anew. To make them walk randomly. ai_run_away() is not just for running away, it actually chooses which action to take: run away, run home (to "InArea" area) or run at an enemy. ai_walk_to() is to get it to walk at an enemy, and attack if near enough. ai_walk_to2() is to walk at an enemy shooting you from outside your area. Unfortunately, now they walk very erratically when a player nears, and they never, ever walk back home. Any help would be greatly appreciated! ~Ease~ |
In response to Ease
|
|
hmmm u could set the Mob's Move delay so it runs away slower. I don't know if that helps *Becasue i'm not sure on the code myself. If some1 could post it, it could realy help Ease
|
In response to Ease
|
|
I'm still stuck on this. Monsters jump erratically, and never return home. I've changed the code a little, but to no avail:
ai_random_wander()//random wander if no mobs are in range to attack Any help? ~Ease~ |
In response to ElderKain
|
|
Nope, movement delay did not affect it in the slightest. =( Thanks though!
|
In response to Ease
|
|
Fixed
|