nintendowii111

Veteran
Veteran
Joined
Oct 12, 2019
Messages
50
Reaction score
5
First Language
English
Primarily Uses
RMMV
Looking for someone experienced with QABS (latest version found at https://quxios.github.io/plugins/QABS/) to help me with AI. I've been trying to make a simple enemy where he only shoots a projectile forward. Not AT the player. To do this I thought turning the AI off with <aiType:none> would make the enemy not move and just use his skill constantly. Thats not the case. Instead the event of the enemy doesnt move at all. I'm making a dungeon map and want fireballs to be shot in a single direction constantly and I'm having a hard time figuring out how to do that with QABS. Any help is greatly appreciated and Thanks!
 

Kenode

Veteran
Veteran
Joined
Jun 17, 2018
Messages
68
Reaction score
26
First Language
Spanish
Primarily Uses
RMMV
Late reply, but I've been fiddling with QABS lately (Trying to figure out how to expand on it, since there aren't many ABS that seem as flexible as QABS while also offering pixel movement support...)

I think you're looking towards custom AI through eventing. You can find an example of it in the demo that is included (the campfire). You set its AI type to none, and make it use its skill with
JavaScript:
var myChar = this.character();
myChar.useSkill(number);

I'm still learning about it, so I wouldn't know how exactly that works, but it's how it is set up in the demo and it does similar to what I think you're looking for. Hope this helps.
 

Minionice

Villager
Member
Joined
Dec 29, 2018
Messages
7
Reaction score
5
First Language
English
Primarily Uses
RMMV
I don't know if anyone still uses this, but here is an example AI I made that moves towards the player's x-coordinate and uses a skill thereafter.

Enemy settings:

Screenshot (46).png


Skill settings:

image_2021-04-20_181901.png


Note for the above skill (remember that you need to create a mapping for the skill in the QABS plugin settings):

<absSettings>
collider: box, 36, 24
infront: true
rotate: true
cooldown: 45
</absSettings>

<absSequence>
picture arrow true 2
move forward 384 60 false
se Attack2
wait wait 10
</absSequence>

<absOnDamage>
target cancel
target jump away 40
</absOnDamage>

(Credit to SRDude and Quxios for most of these settings)

In my plugins folder, I have this code as a separate file. It should be added as a plugin below all the Quxios plugins.


image_2021-04-20_182250.png

MinioniceAI.js (note that, for my QMovement settings, the tile size is the default, 48 pixels):

JavaScript:
Game_Event.prototype.validAI = function() {
    var AITypes=["simple", "test"];
    return AITypes.includes(this._aiType);
};

Game_Event.prototype.updateAI = function(type) {
    if (type === 'simple') {
        return this.updateAISimple();
    }
    if(type=='test'){
        return this.updateAITest();
    }
    // to add more AI types, alias this function
    // and do something similar to above
};

Game_Event.prototype.updateAITest = function() {
    var target=this.bestTarget(); //identify a target (player, troop (ally), or enemy)
    var dx=target.cx()-this.cx(); //determine the x distance between the target and this enemy
    if(this.isInRange(target)){
        if(Math.abs(dx)>18){
            if(dx>0){
                this.setRadian(0); //turn right
                this.moveStraight(6); //move right
            }
            else{
                this.setRadian(Math.PI); //turn left
                this.moveStraight(4); //move left
            }
        }
        else{
            this.turnTowardCharacter(target); //or this.setRadian(3*Math.PI/2); to face directly down
            this.useSkill(11); //In my version, skill 11 is a projectile
        }
    }
}

Game_Event.prototype.isInRange = function(target) {
    return ((Math.abs(target.cx()-this.cx())<=7*48)&&(Math.abs(target.cy()-this.cy())<=7*48)); //target must be within 7 x and y units
}


Example battlefield:

Screenshot (51).png


Enemy event settings (the one at the top of that map):

Screenshot (53).png


For the skill to work correctly, you must include an image with the same name (minus the .png) in your /img/pictures/ folder. If you use your own image or animation, remember to remove white space from the image.

arrow.png
 
Last edited:

Minionice

Villager
Member
Joined
Dec 29, 2018
Messages
7
Reaction score
5
First Language
English
Primarily Uses
RMMV
To make an enemy that shoots a projectile forward under some condition, you would probably just use an if() statement and include this.useSkill(#); in there.
 

Mike-Turtle

Veteran
Veteran
Joined
Apr 17, 2021
Messages
35
Reaction score
61
First Language
English
Primarily Uses
RMMV
That will work, but be aware that if you are using QSight to stop enemies attacking when they can't see you, this will bypass that. This method will see them casting at a wall/object in front of you (even if you are in another room). If you are using mana/ammo for skills this opens up serious flaws in the AI.

if using QSight with QABS you can just use the built in this.isTargetInRange(target) function. which checks for obstacles.
(see my profile for some videos of enemies using this method)
 

Minionice

Villager
Member
Joined
Dec 29, 2018
Messages
7
Reaction score
5
First Language
English
Primarily Uses
RMMV
I see. I haven't really experimented with QSight yet. Thanks for the correction
 

Mike-Turtle

Veteran
Veteran
Joined
Apr 17, 2021
Messages
35
Reaction score
61
First Language
English
Primarily Uses
RMMV
No problem. Qsight & QPathfind are excellent additions to QABS and really allow for some good AI to be made.
 

Latest Threads

Latest Posts

Latest Profile Posts

Phew! logged back. Seems I was too occupied with 3D learning (yeah for RPGM purposes) creating IRL space, trying to grow catnip, dealing with health and DC is good. (so MrC) ^^
Currently trying to add items in the same style as Kyrise's excellent icons. I like having a large variety of items :3 KyriseandMe.PNG
Create MiniMaps, Sprites for MV Enemies, & Aethereal Plane Battlebacks | RPG Maker News #74

Vtubers Vs MOTHER.png

This might be my next project. You like it?
I'm off to search the master script list for my skill issue. HOORAY! FUN!

Forum statistics

Threads
112,328
Messages
1,067,420
Members
145,967
Latest member
zakariadu78
Top