• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Other Question] Make NPC battle eachother

18
Posts
4
Years
  • Age 24
  • Seen Jun 29, 2019
I just began using pokémon essentials and I can't seem to find how to accomplish what I desire.

I need 4 NPCS to battle eachother in 2 groups of 2.
It is kinda like when a character showed you how to catch a pokémon.

I'm not sure if this is even possible.

I'd love it if someone could assist me.
Go through all of the steps I have to do.
Cause I don't know if I have to make a trainer script for all 4 NPCS or not. As I don't want to end up battling them after the scene ends.
 

Ego13

hollow_ego
311
Posts
6
Years
Weeell this can be done. And it can be done.... like super easily... I'm surprised how easy it is.
Technically all you need to do is hand te command phase to the AI instead of the player. and we can do this easily with one game switch and one line of code.

In PokeBattle_Battle find this line
Code:
if !pbOwnedByPlayer?(i) || @controlPlayer
and right before that line add the following
Code:
@controlPlayer=true if $game_switches[id]
where id refer to the number of the switch that you want to use.
if you for example use switch 103 the line would look like this
Code:
@controlPlayer=true if $game_switches[103]

Now all you need to do, is turn the switch on right before the battle and the AI will do the rest.

Edit: I forgot about the part where it was 4 NPCs battling withouth the player. That means you probably need to pass the NPCs as the trainers

Edit of the edit: I made a script that allows to initialize NPC battles. Will publish it on Relic Castle and post the link here
 
Last edited:
18
Posts
4
Years
  • Age 24
  • Seen Jun 29, 2019
Thank you, I'll add the command already and will look forward to the script.

You're my absolute hero :D :P
 
18
Posts
4
Years
  • Age 24
  • Seen Jun 29, 2019
Thank you soooooo much, once again :D

I just got it to work. The code :D Had abit of problems first, synthax errors and stuff, cause i'm still quite new and have no super great grasp of coding. But after trying stuff and pondering I get the test to work :D
I'm gonna work on the real deal now haha :D thank you once again! =D
 
18
Posts
4
Years
  • Age 24
  • Seen Jun 29, 2019
Hey, so I've been working on the real deal and I came across a certain thing.

So I got 2 enemies, team rocket, both go fine, but when we go to the 2 on the trainers team, only the latter appears to get their name shown. Is it correct to assume that this has to do with the "players" role by any chance?

I mean, in my case Trainer 2 is called Bill and Trainer 4 John. When the battle starts, however, it says: "John John sent out Growlithe" for instance XD Kinda funny but weird HAHA :D
Was wondering if I messed up somewhere XP

I also wondered if you had any advice on making sure a certain side wins? It's a kind of set scene. Should I give the Pokémon certain moves in the trainer listings or items?
Or do you think that still wouldn't guaranty it? Thanks for all the help :)
 

Ego13

hollow_ego
311
Posts
6
Years
Hey,

I can't quite replicate your scenario. Could you attach some screenshot of how you set up your event and what the meontioned text looks like in battle?

Well you can't guarentee a certain outcome unless one side is truly overpowered (like a Lv80 Mon vs a Lv10 Mon). BUt it does help to make the losing sides Skill Levle the lowest possible and the winning sides one as high as possible. Also adding certain advantges to th winning side helps, like the mentioned moves or items.
 
18
Posts
4
Years
  • Age 24
  • Seen Jun 29, 2019
it's not allowing me to upload untill I at least have 5 posts so... guess this is post 5? XD
 
18
Posts
4
Years
  • Age 24
  • Seen Jun 29, 2019
bP1JHmc

Tbf951T

The images aren't showing for me, above here... so links below...
https://ibb.co/Tbf951T
https://ibb.co/bP1JHmc
 
Last edited:

Ego13

hollow_ego
311
Posts
6
Years
RIght, so I'm guessing that the first "John" in "John John" is the trainer type. LIke it usually says "Birdkeeper Tobi" or "Rival Gary". If you rename the in game nam for the trainer type to "Ally" then it should show up as "Ally John".
 
18
Posts
4
Years
  • Age 24
  • Seen Jun 29, 2019
73,ALLY_JOHN,John,100,Pokémon trainer,,,Male,,
this was what I have in trainer types. So, if anything I would expect Ally_John John then? Is it the second John it takes then?

And in the trainers.txt I might need to make it so it's Bill & John to show both npc's names? Correct? :) Sorry for all these questions and thanks for all the assistance =D
 

Ego13

hollow_ego
311
Posts
6
Years
Yes, the second John in trainertypes is the display name of the trainer type. I recommend changing it to "Ally"

Well that depends on whether they are two separate trainers or just one. If they are just one appearing as a duo, then yes, you need to change the name too

Thanks for your appreciation :)
 
18
Posts
4
Years
  • Age 24
  • Seen Jun 29, 2019
Alright :D thanks for all the info :) Got it settled =D

One more question, unrelated to the subject at hand. When I beat an encounter or trainer, it doesn't appear to give any xp when playtesting.
I read about hard mode giving 1 EXP but it gives nothing at all.
 
18
Posts
4
Years
  • Age 24
  • Seen Jun 29, 2019
When I'm playtesting the game. After a battle or an encounter, when it says their pokémon fainted, there is no notification or anything that indicates that my pokémon gained any xp. In fact, I am quite sure they aren't receiving any.
Is there some kind of setting that needs to be turned on?
 
Last edited:

Ego13

hollow_ego
311
Posts
6
Years
The only reason I could find why you wouldn't get any Exp is if its either an NPC battle or an internal battle
Can you show me your "def pbGainExp"?

Other than that I don't think there is anything else. Do you get exp when playing normally?
 
18
Posts
4
Years
  • Age 24
  • Seen Jun 29, 2019
I'm not quite sure how large of a section I had to copy, I apologize
Spoiler:
 
18
Posts
4
Years
  • Age 24
  • Seen Jun 29, 2019
I discovered something. Starting a new game appears to fix it. Not sure what causes it. So it must be either one of my events or a bug cause I changed something before my save perhaps?
 
Back
Top