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

Villager
Member
Joined
Apr 17, 2021
Messages
13
Reaction score
26
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

Villager
Member
Joined
Apr 17, 2021
Messages
13
Reaction score
26
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 Profile Posts

Last week I was resting and working mainly on the game!
The current progress of the character.
OxWQ7zO.gif

Pre-programmed character :
-Cleaning
-Magic Book(include blood mode)
-Kettle pot stirring
-Other specimens(flower/bug...etc)
I found a huge spider in my house but it has disappeared and now I'm living in fear and paranoia
It's funny, the only reason I haven't actually released a prototype or demo is not that I don't have one. Hahahahahaha I do, I've had a prototype for months. I'm really just concerned with someone taking it, and putting it up on Steam or something first, then saying it's theirs. I should probably look into setting all that up or something... Then again, I have no ETA on the full game so not sure it's worth it yet.
Pixel Grass Sprites, Questing & Fast Traveling w/ Items, Sci-fi & Distorted Music | RPG Maker News #35

Is it me or while modifying RTP style SV Actor sets to make them taller, the idle animation is the hardest to get right? I think it's because that's the one that you see most so seeing pixels that look wrong make you constantly seek to correct that.

Forum statistics

Threads
111,225
Messages
1,059,397
Members
144,490
Latest member
ametan
Top