jd336

Villager
Member
Joined
Feb 11, 2018
Messages
8
Reaction score
8
First Language
english
Primarily Uses
RMMV
Hi, I've been trying to make an NPC ally that can attack enemies alongside the main player in my game. So far no luck, is there a way to make this work? I created a fight scene where I can battle a clone of the main actor and everything works fine attacks, skills, weapons etc. but can you turn NPC into an ally that attacks enemies alongside the main Actor?
 

mlogan

Global Moderators
Global Mod
Joined
Mar 18, 2012
Messages
16,033
Reaction score
8,904
First Language
English
Primarily Uses
RMMV

I've moved this thread to Plugin Support. Please be sure to post your threads in the correct forum next time. Thank you.

 

Jragyn

JABS codemonkey
Veteran
Joined
Aug 14, 2012
Messages
221
Reaction score
169
First Language
English
Primarily Uses
RMMZ
I don't believe moghunter's Chrono ABS for MV had a "teams" functionality where you could create battlers that fought enemies as well. (assuming MV)

At least, I didn't see anything in the code for that functionality when I was rooting through it trying to understand how it worked while I was building JABS.
 

jd336

Villager
Member
Joined
Feb 11, 2018
Messages
8
Reaction score
8
First Language
english
Primarily Uses
RMMV
I don't believe moghunter's Chrono ABS for MV had a "teams" functionality where you could create battlers that fought enemies as well. (assuming MV)

At least, I didn't see anything in the code for that functionality when I was rooting through it trying to understand how it worked while I was building JABS.
Thanks for reply, seems as though you should be able to use the same script commands the actor uses to attack events but instead use the same command script to make events damage other events?
 

Jragyn

JABS codemonkey
Veteran
Joined
Aug 14, 2012
Messages
221
Reaction score
169
First Language
English
Primarily Uses
RMMZ
Thanks for reply, seems as though you should be able to use the same script commands the actor uses to attack events but instead use the same command script to make events damage other events?
Hmm, you're not wrong with that. I believe he has "traps" or some such thing in his demo that demonstrate that (events shooting fireballs or something through script calls in the move route).

You may be able to make that work with some clever move route manipulation and/or other plugins that let you direct events to move towards other events.

My apologies, I thought you meant like, full-fledged AI battlers or something that acted like a city guard protecting a specific group of events from random monsters that appear type of thing (but maybe even that is possible if you're crafty enough with eventing). The only reason I thought about "teams" is because that is what I have on my agenda to build into JABS :aswt:.
 

jd336

Villager
Member
Joined
Feb 11, 2018
Messages
8
Reaction score
8
First Language
english
Primarily Uses
RMMV
Thanks again. Yes thats what i'm trying to do, if I can just get them to damage each other it will work.
I'll play around with it some more to see! BTW Your JABS systems sounds very interesting!! :)
 

Ryuka

Villager
Member
Joined
Feb 28, 2021
Messages
21
Reaction score
4
First Language
English
Primarily Uses
N/A
Hey, how is it going? Im interested in the same thing :)
 

Restart

Veteran
Veteran
Joined
Mar 15, 2019
Messages
770
Reaction score
628
First Language
English
Primarily Uses
RMMV
I believe you can just put
Code:
this._tool.user=$gamePlayer
into the bullet's moveroute, and it will now belong to the player
 

jd336

Villager
Member
Joined
Feb 11, 2018
Messages
8
Reaction score
8
First Language
english
Primarily Uses
RMMV
I believe you can just put
Code:
this._tool.user=$gamePlayer
into the bullet's moveroute, and it will now belong to the player
Thanks Restart it works!!!! :smile:The Ally NPC event can damage enemy events! 1 more thing; Can Ally NPC receive damage from the enemy Event? I don't really need it to take away health from the ally, just the illusion that it's receiving damage.
 
Last edited:

Ryuka

Villager
Member
Joined
Feb 28, 2021
Messages
21
Reaction score
4
First Language
English
Primarily Uses
N/A
I believe you can just put
Code:
this._tool.user=$gamePlayer
into the bullet's moveroute, and it will now belong to the player
Sorry, where should i write this? In event's route? Or what Bullet means?:D
 

jd336

Villager
Member
Joined
Feb 11, 2018
Messages
8
Reaction score
8
First Language
english
Primarily Uses
RMMV
Sorry, where should i write this? In event's route? Or what Bullet means?:D
Hi, Ryuka! I placed it into the tool maps move route event and it worked. It may be a way to place somewhere else like character NPC but couldn't get it working yet.
 
Last edited:

Restart

Veteran
Veteran
Joined
Mar 15, 2019
Messages
770
Reaction score
628
First Language
English
Primarily Uses
RMMV
Sorry, where should i write this? In event's route? Or what Bullet means?:D

Mog puts all the 'tools' onto their own secret hidden 'tool map', and whenever someone uses a skill they get copied onto the current map. For example, there's an original fireball tool on the tool map, and all fireballs created in the game are copies of it. If you change that original fireball (making it faster, or changing the direction it moves, or changing the sprite), all fireballs in the game will change as well.

When you put
Code:
this._tool.user=$gamePlayer
into a moveroute, after the fireball is created (belonging to the enemy), the script tells the fireball 'actually, you are one of the player's bullets now.'

The player's own bullets damage enemies and not harm the player. I believe it will also use the player's stats for damage calculations instead of whatever fired it.
 

Ryuka

Villager
Member
Joined
Feb 28, 2021
Messages
21
Reaction score
4
First Language
English
Primarily Uses
N/A
Mog puts all the 'tools' onto their own secret hidden 'tool map', and whenever someone uses a skill they get copied onto the current map. For example, there's an original fireball tool on the tool map, and all fireballs created in the game are copies of it. If you change that original fireball (making it faster, or changing the direction it moves, or changing the sprite), all fireballs in the game will change as well.

When you put
Code:
this._tool.user=$gamePlayer
into a moveroute, after the fireball is created (belonging to the enemy), the script tells the fireball 'actually, you are one of the player's bullets now.'

The player's own bullets damage enemies and not harm the player. I believe it will also use the player's stats for damage calculations instead of whatever fired it.
Restart, thanks for the answer.( I only started working with Abs today ) I think i start to understand how this system works, but as i know i must add a skill or item ID. So now i know how to add skills, items, weapons into this mode. But how should i add which nps i want to fight on my side with this code? Could you show me an example please? Need to write this in "comment" also? ( Im really sorry im new in it) :)

(This is my tool map) Need to make a separate event as moveroute?
 

Attachments

  • Tool map.png
    Tool map.png
    46.5 KB · Views: 3
  • tool map 2.png
    tool map 2.png
    80.3 KB · Views: 3

Restart

Veteran
Veteran
Joined
Mar 15, 2019
Messages
770
Reaction score
628
First Language
English
Primarily Uses
RMMV
Basically you add that code to the tool event. Since it now always belongs to the player (regardless of who shot it), make sure it's an attack only used by 'friendly' NPCs.

IIRC making the NPCs act 'friendly' is going to be fairly difficult without modding chrono engine.

If you don't do anything, they'll be impossible to hurt by enemies and take friendly fire from the player.

You can use the
Code:
collision_id : attackNumber
note tag to make NPCs react to getting hit by specific attacks (have them invoke a self-damage skill when they collide with enemy bullets).

I believe putting
Code:
this.collision(false)
into the NPC's move route will make it impossible to damage conventionally. Combined with the note tag to run custom scripts when hit by a specific tool, and you can make the npcs behave mostly like they're actually on the player's side. (Have not tested that).

As for making a friendly AI, that's really something you have to do yourself depending on how you set up the battlefield.
 

Ryuka

Villager
Member
Joined
Feb 28, 2021
Messages
21
Reaction score
4
First Language
English
Primarily Uses
N/A
Basically you add that code to the tool event. Since it now always belongs to the player (regardless of who shot it), make sure it's an attack only used by 'friendly' NPCs.

IIRC making the NPCs act 'friendly' is going to be fairly difficult without modding chrono engine.

If you don't do anything, they'll be impossible to hurt by enemies and take friendly fire from the player.

You can use the
Code:
collision_id : attackNumber
note tag to make NPCs react to getting hit by specific attacks (have them invoke a self-damage skill when they collide with enemy bullets).

I believe putting
Code:
this.collision(false)
into the NPC's move route will make it impossible to damage conventionally. Combined with the note tag to run custom scripts when hit by a specific tool, and you can make the npcs behave mostly like they're actually on the player's side. (Have not tested that).

As for making a friendly AI, that's really something you have to do yourself depending on how you set up the battlefield.

Restart, I see. Thank you for the help and your patience :)
 

jd336

Villager
Member
Joined
Feb 11, 2018
Messages
8
Reaction score
8
First Language
english
Primarily Uses
RMMV
Basically you add that code to the tool event. Since it now always belongs to the player (regardless of who shot it), make sure it's an attack only used by 'friendly' NPCs.

IIRC making the NPCs act 'friendly' is going to be fairly difficult without modding chrono engine.

If you don't do anything, they'll be impossible to hurt by enemies and take friendly fire from the player.

You can use the
Code:
collision_id : attackNumber
note tag to make NPCs react to getting hit by specific attacks (have them invoke a self-damage skill when they collide with enemy bullets).

I believe putting
Code:
this.collision(false)
into the NPC's move route will make it impossible to damage conventionally. Combined with the note tag to run custom scripts when hit by a specific tool, and you can make the npcs behave mostly like they're actually on the player's side. (Have not tested that).

As for making a friendly AI, that's really something you have to do yourself depending on how you set up the battlefield.
Thanks restart for your help, I'm still working with the code to make sure I'm doing it correctly over the weekend. I'll update if successful or not! lol FYI: I'm using Galv's Move Route Extras
To get Ally NPC's to track enemy Events so far so good just missing the return damage.
 
Last edited:

jd336

Villager
Member
Joined
Feb 11, 2018
Messages
8
Reaction score
8
First Language
english
Primarily Uses
RMMV
i kinda get it using collision id for the enemy to attack friendly but its not working for some reason. I may be doing something wrong. which code do i use after attacknumber and this.collision?
Basically you add that code to the tool event. Since it now always belongs to the player (regardless of who shot it), make sure it's an attack only used by 'friendly' NPCs.

IIRC making the NPCs act 'friendly' is going to be fairly difficult without modding chrono engine.

If you don't do anything, they'll be impossible to hurt by enemies and take friendly fire from the player.

You can use the
Code:
collision_id : attackNumber
note tag to make NPCs react to getting hit by specific attacks (have them invoke a self-damage skill when they collide with enemy bullets).

I believe putting
Code:
this.collision(false)
into the NPC's move route will make it impossible to damage conventionally. Combined with the note tag to run custom scripts when hit by a specific tool, and you can make the npcs behave mostly like they're actually on the player's side. (Have not tested that).

As for making a friendly AI, that's really something you have to do yourself depending on how you set up the battlefield.
 

Restart

Veteran
Veteran
Joined
Mar 15, 2019
Messages
770
Reaction score
628
First Language
English
Primarily Uses
RMMV
the 'collision_id: attackNumber' is the same thing used to cut down grass in mog's tutorial. It makes the event page run in response to getting hit by a particular tool.

My suggestion was to do the same thing with your friendly NPCs. Put in the tool id you're using for the enemies, and either just kill the friendlies in one hit (like cutting grass), or have the triggered event call inflict damage on the NPC (so instead of instantly dying, the event getting called is one that damages them for 5 hp or whatever).

You could also have them do this.act() on a tool skill that damages the user (maybe temporarily flicker the no-collision off? Not sure if necessary offhand).
 

Latest Threads

Latest Profile Posts

image_2021-06-13_213812.png

Todays Lesson: Tiles are a pain to make xD
The game is not even 2% complete, but i just wanted to release something for funsies. :)
It's on my google drive.
It would be awesome if i could get a couple ideas and the like!
So yesterday Dad took me to Volcano Bay, and it was almost ruined by a thunderstorm... then it passed by and the lightning warning got lifted, leading to an awesome time sliding and swimming. Hopefully we get to go to the arcade tonight. The one we're planning on has a restaurant built in with AWESOME food. Not to mention how big the arcade itself is!
image_2021-06-13_150033.png

Maybe I'll actually try making a retro pack. Already have the shark fin made so why not xD
Hey everyone, for everybody following along with my RPG Maker MZ streams: There will unfortunately not be a stream tonight. There is a big exciting event that will go live next week that has been taking all my time, so look forward to that!

Forum statistics

Threads
112,198
Messages
1,066,528
Members
145,807
Latest member
wispy
Top