Action Battle Script: Getting the Enemy to Attack

I'm new to scripting and making an action battle system so I'm probably gonna be in here a lot. I have the shell set up for the player character attacking and doing damage and all that, but I'm sure I'll run into a problem with that later because I barely know what I'm doing. But hell, I can only get experience by writing my own scripts and asking questions so here we go:

I was wondering how to put enemies on the map and get them to detect that my player is in front of them for an attack. I've looked through the help file and google but I couldn't really find anything. I was able to accomplish this with an event and some variables in the RPG Maker engine but it feels... clunky if that makes sense. I would rather script it all myself than rely on a workaround method.
I'm new to scripting and making an action battle system
You know, picking the most complex and problematic type of script to write might not be the ideal choice for a beginner to programming...
Can you tell us what your experience with programming is? Because if you're still learning, you can basically forget this and should place it on hold for a year or so while gaining experience with simpler scripts.


If you have some programming knowledge - enemies on the map are usually simulated by events. So in the basic game loop, you have to check every event for some marker that identifies it as an enemy instead of an object/decoration/story element.


Then for each event identified as an enemy, you have to check where it is in regard to the player and either move it with a pathfinding script or have it attack.
wow... that's really tedious.

And I am still kind of learning, but this is a lengthly project to put it simply. I've created a few simpler games in my youth, but I wanted to go for broke this time and actually make a GOOD game for once. I have completed a course and written a few simpler programs, so this is definitely a giant undertaking. So yes I do have programming knowledge, and yes I am a beginner.

So I can make the enemy event as normal in RPG Maker, then fish through the basic game loop, identify it, and customize and tweak it from there?
So I can make the enemy event as normal in RPG Maker, then fish through the basic game loop, identify it, and customize and tweak it from there?
No, it is not a "normal" enemy event, because it will not contain any normal enemy data. Your problem is that what you want to use doesn't exist in the engine and - more important - it doesn't exist in the editor either.
Because it doesn't exist in the editor and you can't change the editor, your only choices are either


1) use a different editor (one you would have to write yourself, so forget it)


2) use something that exists in the editor as a marker and build your own data in the engine around it.


And because events have always been intended as placeholders for NPC, you can also use them as placeholders for enemies.


I suggest you start using one of the existing ABS scripts and implement it to see how others handled the interface between the editor and their scripts.
Gotcha. Thanks for the help.

Original thread: https://forums.rpgmakerweb.com/threads/action-battle-script-getting-the-enemy-to-attack.46004/