Visible NPC vs MOBS on region/world maps

thraggdrasil

Warper
Member
Joined
Jun 25, 2015
Messages
1
Reaction score
0
First Language
english
Primarily Uses
  HEY!! im glad you click on this topic, cause for real, that was the best way i could describe the idea that im trying to pull off.

  Okay, so this is what im trying to make:

  In my game i want to give the impression that my party isnt the only group in the world that is actually trying to go around fighting and killing monsters.

  I'm trying to make a script that will have my NPC characters:

  roam around the world map/ region map in a random fashion (OR) 

  roam around a certain area of the map

  when the NPC 'see's or 'detects' an enemy MOB, he will move towards it

  when the NPC touches the MOB, it is killed

(i will try to add more interesting stuff to that later, like damage, or status effects to the NPC, but for now, i can't even get this simple idea to work for me)

  SO!  

 I've tried a few things already, but DAMN im such a NOOB... i know that there is code for the 'approach' function for bad guys, but it only 'approaches' the main character.  I was thinking of using a script to label the different MOBS on the map as 'prey' and the NPCs as 'hunter's.  Then use the 'approach' script, but have the hunters chase the prey.  then on touch, have the MOB erased.

  From there i can work out the rest (hahahaha.... no i can't, i'll come back and ask for more help, who am i kidding)

  any help would be greatly appreciated, thank you so much guys!!!
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
One way you could approach this (which would require some scripting, or variables):

Set all the mobs on the map initially.

Set some mobs to be removed after one day passes.

Set some more to be removed after two days pass.

Etc.

If you did this you would need to decide when a day passes, and increase a variable by 1. Probably could be done every time you rested.

This is not quite the same thing as what you want, but from a design standpoint, it is probably the easiest to implement.
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,624
Reaction score
5,107
First Language
English
Primarily Uses
RMVXA
There's an "approach character" function in the code that you can reference:

#-------------------------------------------------------------------------- # * Move Toward Character #-------------------------------------------------------------------------- def move_toward_character(character) sx = distance_x_from(character.x) sy = distance_y_from(character.y) if sx.abs > sy.abs move_straight(sx > 0 ? 4 : 6) move_straight(sy > 0 ? 8 : 2) if !@move_succeed && sy != 0 elsif sy != 0 move_straight(sy > 0 ? 8 : 2) move_straight(sx > 0 ? 4 : 6) if !@move_succeed && sx != 0 end endWhat this means is that (I think) you can add something like move_toward_character($game_map.events[32]) in the Script... function inside a custom Move Route, to have a character move toward Event 32 (which might be a wandering monster).

From there, though, to really get the effect you're looking for, you'll have to figure out a way for NPCs that are moving "randomly" to notice which monsters are near them so you can direct them to move toward that monster.  You can do so with a Parallel Process that consistently looks at each event's x and y coordinate and finds the total difference.  But to actually script this would be fairly complicated.
 

Schlangan

A madman with a computer
Veteran
Joined
May 20, 2015
Messages
1,421
Reaction score
1,701
First Language
French
Primarily Uses
RMMV
From there, though, to really get the effect you're looking for, you'll have to figure out a way for NPCs that are moving "randomly" to notice which monsters are near them so you can direct them to move toward that monster.  You can do so with a Parallel Process that consistently looks at each event's x and y coordinate and finds the total difference.  But to actually script this would be fairly complicated.
No, this is fairly easy, just add a distance variable and trigger the move only if the target is close enough. If not, execute random move as usual. I did that in RMXP to code new behaviours for the monsters on the map. The difference here is that you do not compare to the player, but another character. But essentially, it's easier to do it by scirpt, as it avoids parallel process events.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Are we allowed to post about non-RPG Maker games? And, if so, would any of you be interested in a short, proof of concept type non-euclidian puzzle game?
I should realize that error was produced by a outdated version of MZ so that's why it pop up like that
Ami
i can't wait to drink some ice after struggling with my illness in 9 days. 9 days is really bad for me,i can't focus with my shop and even can't do something with my project
How many hours have you got in mz so far?

A bit of a "sparkle" update to the lower portion of the world map. :LZSexcite:

Forum statistics

Threads
105,883
Messages
1,017,232
Members
137,607
Latest member
Maddo
Top