Chaos Project

RPG Maker => Tutorials => Tutorial Requests => Topic started by: JamesTerrano on February 25, 2014, 08:50:20 pm

Title: IMPORTANT! How to attract NPCs (Zombies)
Post by: JamesTerrano on February 25, 2014, 08:50:20 pm
Very important request for help!
I need for my game Dead World and The Walking Dead this:

How can I do this?
When I press Q (or any key), playable character makes a whistle or other sound to attract zombies. Zombies must come to the place from where the sound came out, but not chase the player. When I do so that the zombie switched from "random" to "approach", the zombie will chase player around the map. The purpose of this is for example to lure the zombies away from any place, etc.
So what? What I need do?

I already have a whistling sound. But I don't know how to make that Zombie only will come to the place from which the sound came.

I hope someone can help me. I'm currently doing part of the game where I need it most.
Title: Re: IMPORTANT! How to attract NPCs (Zombies)
Post by: Jackolas on February 26, 2014, 05:17:35 am
The way i would do it is to have the "q" press save the X and Y coordinates of the player current location in 2 variables.
then use a script like Advanced Pathfinding (http://forum.chaos-project.com/index.php/topic,9784.0.html) (if your using xp) to path find your zombies to that location.


just an idea
Title: Re: IMPORTANT! How to attract NPCs (Zombies)
Post by: PhoenixFire on February 26, 2014, 08:58:34 am
Honestly, that was actually my suggestion too, though I was looking for a simple way to do that with events. If you can get a simple script together that will read 2 variables and move towards that coordinate, you can always have an event that passes the player x/y coordinates to variables.
Title: Re: IMPORTANT! How to attract NPCs (Zombies)
Post by: JamesTerrano on February 26, 2014, 07:11:26 pm
And how can I do that? I'm not very good with variables and switches. 
:???:
Title: Re: IMPORTANT! How to attract NPCs (Zombies)
Post by: PhoenixFire on February 27, 2014, 12:16:15 am
Instructions in an image lolz: ShowHide
(http://i.imgur.com/VALDQSu.png)


The script would simply need to read the two variables and make the event move towards the new X/Y coordinates.
Title: Re: IMPORTANT! How to attract NPCs (Zombies)
Post by: JamesTerrano on February 27, 2014, 08:12:08 pm
Well, let's say that I have set the variables. What else I have to do?  :???:
Title: Re: IMPORTANT! How to attract NPCs (Zombies)
Post by: WhiteRose on February 27, 2014, 10:06:53 pm
Quote from: JamesTerrano on February 27, 2014, 08:12:08 pm
Well, let's say that I have set the variables. What else I have to do?  :???:


I can put together a tutorial for you. Give me a few minutes and I'll see what I can do.

EDIT: Okay, here we go! (Actually, winkio did most of the work; my mediocre scripting experience only got me so far. But we got it!)

1. Install Blizz's Lagless Pathfinder Script (http://forum.chaos-project.com/index.php/topic,12851.0)
2. For each zombie, you'll need to make an event page like this:
Spoiler: ShowHide
(http://i.imgur.com/kI3V8vm.png)


Make sure that it is set to parallel process. Also, the second conditional branch is cut off in the image. It should be:
$game_map.events[@event_id].has_path_target?


Finally, to change the button used for the whistle, set it as the condition for the first line. (I used the RMXP default "X" button here, which is actually the "A" key on the keyboard by default.)

I hope that helps! I can upload a demo if you need me to do so. :)

EDIT 2: I decided to just go ahead and put together a demo. Here (https://mega.co.nz/#!kgAETCBY!hHwZpWtqicID_z6Mwo3Wdcpjg9drSZ88C34TQrNtoQc) you go! It's really just a modified version of Blizz's demo. Press A on the keyboard to whistle and make the guy come running to the location at which you whistled.
Title: Re: IMPORTANT! How to attract NPCs (Zombies)
Post by: JamesTerrano on February 28, 2014, 06:49:59 pm
Thank you very much! This was very helpful. That's exactly how I wanted it. Thanks...  :)
Title: Re: IMPORTANT! How to attract NPCs (Zombies)
Post by: PhoenixFire on March 01, 2014, 12:09:37 am
The only thing I'm having an issue with on it now, is how do you get them to wander around at random when they're not traveling to their destination? Think zombies again here.. They'll go to the source of the noise (I even made them all slow and stuff to mimic zombies lolz), but when they reach the destination, they just stop.. How do I make it so they then go into wander mode?
Title: Re: IMPORTANT! How to attract NPCs (Zombies)
Post by: WhiteRose on March 01, 2014, 12:28:18 am
Quote from: DigitalSoul on March 01, 2014, 12:09:37 am
The only thing I'm having an issue with on it now, is how do you get them to wander around at random when they're not traveling to their destination? Think zombies again here.. They'll go to the source of the noise (I even made them all slow and stuff to mimic zombies lolz), but when they reach the destination, they just stop.. How do I make it so they then go into wander mode?


I'll put my master scripting skills to work (ha) and see what I can figure out.