Author Topic: IMPORTANT! How to attract NPCs (Zombies)  (Read 4007 times)

Offline JamesTerrano

  • Trained Member
  • *
  • Posts: 28
  • LV: 2
  • Gender: Male
    • View Profile
IMPORTANT! How to attract NPCs (Zombies)
« on: February 26, 2014, 03:50:20 AM »
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.
My current RMXP projects:
- AMC's The Walking Dead: RPG Fan-Game
- Lonely Warrior
- Dead World
My temporarily postponed RMXP projects:
- Pokemon X (lost after the collapse of my pc)
- High School of the Dead
My Canceled RMXP projects:
- Survivors of War
- Legend of the Seeker: Clones of Evil [trailer]

Offline Jackolas

  • Ethereal Devastator
  • ****
  • Posts: 499
  • LV: 31
  • Gender: Male
  • Its just me
    • View Profile
    • My Clan
Re: IMPORTANT! How to attract NPCs (Zombies)
« Reply #1 on: February 26, 2014, 12:17:35 PM »
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 (if your using xp) to path find your zombies to that location.


just an idea
« Last Edit: February 26, 2014, 12:21:41 PM by Jackolas »

Offline PhoenixFire

  • Moderator
  • Astral Trancist
  • ***
  • Posts: 918
  • LV: 6
  • Gender: Female
  • ~That's an interesting notion, in it's own way~
    • View Profile
Re: IMPORTANT! How to attract NPCs (Zombies)
« Reply #2 on: February 26, 2014, 03:58:34 PM »
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.
Next off, how to create a first person shooter using microsoft excel.

<Remember when computers had turbo buttons?

Offline JamesTerrano

  • Trained Member
  • *
  • Posts: 28
  • LV: 2
  • Gender: Male
    • View Profile
Re: IMPORTANT! How to attract NPCs (Zombies)
« Reply #3 on: February 27, 2014, 02:11:26 AM »
And how can I do that? I'm not very good with variables and switches. 
:???:
My current RMXP projects:
- AMC's The Walking Dead: RPG Fan-Game
- Lonely Warrior
- Dead World
My temporarily postponed RMXP projects:
- Pokemon X (lost after the collapse of my pc)
- High School of the Dead
My Canceled RMXP projects:
- Survivors of War
- Legend of the Seeker: Clones of Evil [trailer]

Offline PhoenixFire

  • Moderator
  • Astral Trancist
  • ***
  • Posts: 918
  • LV: 6
  • Gender: Female
  • ~That's an interesting notion, in it's own way~
    • View Profile
Re: IMPORTANT! How to attract NPCs (Zombies)
« Reply #4 on: February 27, 2014, 07:16:15 AM »
(click to show/hide)

The script would simply need to read the two variables and make the event move towards the new X/Y coordinates.
Next off, how to create a first person shooter using microsoft excel.

<Remember when computers had turbo buttons?

Offline JamesTerrano

  • Trained Member
  • *
  • Posts: 28
  • LV: 2
  • Gender: Male
    • View Profile
Re: IMPORTANT! How to attract NPCs (Zombies)
« Reply #5 on: February 28, 2014, 03:12:08 AM »
Well, let's say that I have set the variables. What else I have to do?  :???:
My current RMXP projects:
- AMC's The Walking Dead: RPG Fan-Game
- Lonely Warrior
- Dead World
My temporarily postponed RMXP projects:
- Pokemon X (lost after the collapse of my pc)
- High School of the Dead
My Canceled RMXP projects:
- Survivors of War
- Legend of the Seeker: Clones of Evil [trailer]

Offline WhiteRose

  • Trying to code in Ruby
  • Moderator
  • Lexima Warrior
  • ***
  • Posts: 2339
  • LV: 127
  • Gender: Female
  • <3
    • View Profile
Re: IMPORTANT! How to attract NPCs (Zombies)
« Reply #6 on: February 28, 2014, 05:06:53 AM »
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
2. For each zombie, you'll need to make an event page like this:
(click to show/hide)

Make sure that it is set to parallel process. Also, the second conditional branch is cut off in the image. It should be:
Code: [Select]
$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 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.
« Last Edit: February 28, 2014, 07:28:13 AM by WhiteRose »

Offline JamesTerrano

  • Trained Member
  • *
  • Posts: 28
  • LV: 2
  • Gender: Male
    • View Profile
Re: IMPORTANT! How to attract NPCs (Zombies)
« Reply #7 on: March 01, 2014, 01:49:59 AM »
Thank you very much! This was very helpful. That's exactly how I wanted it. Thanks...  :)
My current RMXP projects:
- AMC's The Walking Dead: RPG Fan-Game
- Lonely Warrior
- Dead World
My temporarily postponed RMXP projects:
- Pokemon X (lost after the collapse of my pc)
- High School of the Dead
My Canceled RMXP projects:
- Survivors of War
- Legend of the Seeker: Clones of Evil [trailer]

Offline PhoenixFire

  • Moderator
  • Astral Trancist
  • ***
  • Posts: 918
  • LV: 6
  • Gender: Female
  • ~That's an interesting notion, in it's own way~
    • View Profile
Re: IMPORTANT! How to attract NPCs (Zombies)
« Reply #8 on: March 01, 2014, 07: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?
Next off, how to create a first person shooter using microsoft excel.

<Remember when computers had turbo buttons?

Offline WhiteRose

  • Trying to code in Ruby
  • Moderator
  • Lexima Warrior
  • ***
  • Posts: 2339
  • LV: 127
  • Gender: Female
  • <3
    • View Profile
Re: IMPORTANT! How to attract NPCs (Zombies)
« Reply #9 on: March 01, 2014, 07:28:18 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.