Enemy chase character.

Thalldor

Making a game.
Veteran
Joined
Aug 2, 2013
Messages
56
Reaction score
1
Primarily Uses
I'm planning on having where in my forest thing "Guards" that'll walk around and they spot the player they will chase them, How would that be done or is there a script for that?
 

kerbonklin

Hiatus King
Veteran
Joined
Jan 6, 2013
Messages
1,726
Reaction score
275
First Language
English
Primarily Uses
RMMV
Last edited by a moderator:

Thalldor

Making a game.
Veteran
Joined
Aug 2, 2013
Messages
56
Reaction score
1
Primarily Uses
I have no idea how to put this into my game : |
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,367
Reaction score
7,676
First Language
German
Primarily Uses
RMMV
I have no idea how to put this into my game : |
Please specifiy your problem.
Do you have no idea on how to insert scripts at all?


Do you have problems with configuring that script?


Basically if you want to solve your problem without scripts, you can either use autonomous movement: approach player (disadvantage: the monsters will chase the player even from the other site of the map, no range limit to that) or use autonomous movement: custom move route to set up specific paths for the monsters (disadvantage: a lot of work)


Or you can use one of the scripts like the one linked above - those require a basic knowledge on configurations however, and not alle scripts are compatible to each other.
 

Berylstone

Veteran
Veteran
Joined
Jun 3, 2013
Messages
642
Reaction score
62
First Language
English
Primarily Uses
I'm planning on having where in my forest thing "Guards" that'll walk around and they spot the player they will chase them, How would that be done or is there a script for that?
I don't know about scripts, but you can do this with events.  Set your guard event to random movement under autonomous movement and make it a parallel process event with no trigger so it continuously runs.  In the event commands use Control Variables/Game Data to set this event and player coordinates to variables.

Control Variables:

[Player:X] = Game Data/Player's Map X

[Player:Y] = Game Data/Player's Map Y

[Guard:X] = Game Data/This Event's Map X

[Guard:Y] = Game Data/This Event's Map Y

Then you can create proximity variables based on this data.  I'll give a quick example:

Control Variables:

[Guard:Y+2] = [Guard:Y]

[Guard:Y+2] += 2

Just in case this is confusing - all you did was add 2 to the Y coordinates of your guard and save it to a variable.  That way you can tell when the player is standing two squares down from the guard.  Then set up a condition that flips on a switch when the player is on that tile.

Conditional Branch: [Player:x] = [Guard:X]

Conditional Branch: [Player:Y] = [Guard:Y+2]

Turn ON Chase Switch

Branch End

Branch End

This checked to see if the player was standing two tiles down from the guard and activates the switch if that's the case.  You can broaden the attack radius of your guard as much as you like.  Just create new variables and conditions like I showed you that correspond with new tiles around the Guard. 

Then add a new page to your Guard and set the condition to Chase Switch is On.   Change the autonomous movement option to approach and the guard will chase the player.
 
Last edited by a moderator:

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

Latest Threads

Latest Posts

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,085
Members
137,583
Latest member
write2dgray
Top