Jump to content

Zombie Path-finding Stuffs


ToastedFishSandwich

Recommended Posts

Hey there forum-goers. As some of you may know, I've made a mod which duplicates zombies when you kill them. It's pretty cool.

 

For the next version I'm looking to try out a new feature. I want to spawn the zombies a little way away and have them move towards the location of the parent zombie.

my profile picture is bloody terrifying, like, seriously; wtf me?

I haven't got access to my code right now but I'll be able to recall the relevant stuff from memory.

 

Basically the function gets the location of the parent zombie, does some freaky trigonometry to it and spits out a location for the new zombie. I then create it by declaring it as a variable using whatever function creates zombies, something like: "zomb = createZombie(x,y,z)"

 

So I have a variable ("zomb") which is my zombie. I can call functions through it like " z:setX(100) " or whatever else I feel like.

 

What function or series of functions should I use to make a zombie walk, and not teleport, to a set of coordinates? ie " zomb:walkTo(x,y,z) "

Link to comment
Share on other sites

  • 4 weeks later...

well, since its a moving object. move() might work http://theindiestone.com/zomboidjavadocs/zombie/iso/IsoMovingObject.html#Move(zombie.iso.Vector2)

It's probably also a good idea to just look at that IsoMovingObject class in general for a solution.

 

Another work around which I believe should be easier to implement is that as soon as you spawn the zombies, create a sound from the player's position (and by sound I mean the type that you can't really hear but zombies can, hypothetically speaking, like when you press Q). If within radius the zombies should start making their way towards the sound (i.e. where the parent zombie was killed).

Link to comment
Share on other sites

I'd assume you use

PathTo(int x, int y, int z, boolean critical)

 

I assumed that too but all it seemed to do it make zombies lurch directly at the player rather than the coordinates given, in the rare event it does anything at all.

 

well, since its a moving object. move() might work http://theindiestone.com/zomboidjavadocs/zombie/iso/IsoMovingObject.html#Move(zombie.iso.Vector2)

It's probably also a good idea to just look at that IsoMovingObject class in general for a solution.

 

Another work around which I believe should be easier to implement is that as soon as you spawn the zombies, create a sound from the player's position (and by sound I mean the type that you can't really hear but zombies can, hypothetically speaking, like when you press Q). If within radius the zombies should start making their way towards the sound (i.e. where the parent zombie was killed).

 

 

I'll try out move() asap.

 

Thanks to both of you though.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...