MemoriesLP

Veteran
Veteran
Joined
Jun 12, 2016
Messages
41
Reaction score
10
First Language
Portuguese
Primarily Uses
Years ago I was trying to make a bestiary, and someone gave a code to create a temporary enemy, so I can get all his attributes and stats for my bestiary.
I don't remember who helped me with that. I decided to use it again, and a problem is happening just like it did years ago (I did not try to fix it). So even though I'm on a new project, the error is still there (the same one).

This is the script call:
Code:
var id = $gameVariables.value(41);
if (!!$gameTemp._tempEnemy) $gameTemp._tempEnemy.transform(id);
else $gameTemp._tempEnemy = new Game_Enemy(id, 0, 0);
The variable 41 is the enemy ID that I want to create so I can show his info at the bestiary.
If I use an item called Bestiary, It calls a common event that I can choose which enemy to see his information. Then it sends me to the common event that has this above script call, so I can get the attributes of the enemy and send it to the bestiary text.
If I'm in combat, I just use a Scan skill that calls the same common event.
So this script call is used inside and outside battle.

- After doing some fights, an error can occur (image 1) when I enter combat.
- I will also show the console (image 2).
If I reload the save right before the battle, the error does not occur again. So my theory is that a tempEnemy that was created on a previous fight is responsable for making the error happen on the current fight that crashed the game.

I don't understand much about the subject...
 

Attachments

  • 1675098362508.png
    1675098362508.png
    92.2 KB · Views: 3
  • imagem_2023-01-30_140646027.png
    imagem_2023-01-30_140646027.png
    186 KB · Views: 3

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
37,975
Reaction score
10,543
First Language
German
Primarily Uses
RMMV
scripts depend on context, and you give none of that.

please give a screenshot of the common event, and especially one including where you set the variable 41.

because the error basically tells that the enemy you try to handle does not exist, which means the variable 41 contains the wrong number
 

MemoriesLP

Veteran
Veteran
Joined
Jun 12, 2016
Messages
41
Reaction score
10
First Language
Portuguese
Primarily Uses
As I said, I have to use the skill Scan inside battle, or the item Bestiary outside battle.
When I start the combat, the common event is not used. So maybe the tempEnemy still exists when I start the combat, and it causes issues.

- Image 1 receives the Enemy Troup, so it tells which enemies are inside a Enemy Troup.
It is used for the Scan skill. Turn 0 tells which Enemy Troup it is (Image 4).
- Image 2 receives the ID of the enemy that needs to get info. The tempEnemy is created.
Bestiary calls this common event directly, since it does not need the steps from Image 1.
- Image 3 writes the bestiary text of the enemy, using the info that was set from Image 2.

Since it is trying to create the tempEnemy, but it can't, then maybe I have to kill-destroy-erase the tempEnemy after checking the bestiary, right? Is there a way to do that?
 

Attachments

  • imagem_2023-01-30_144012865.png
    imagem_2023-01-30_144012865.png
    204.2 KB · Views: 4
  • imagem_2023-01-30_144028271.png
    imagem_2023-01-30_144028271.png
    246.3 KB · Views: 3
  • imagem_2023-01-30_144045295.png
    imagem_2023-01-30_144045295.png
    155.9 KB · Views: 3
  • imagem_2023-01-30_144256193.png
    imagem_2023-01-30_144256193.png
    256.4 KB · Views: 4

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
37,975
Reaction score
10,543
First Language
German
Primarily Uses
RMMV
Why do you give a screenshot of troop 5 if the events are about enemy 5?
can you show us a screenshot of the enemy 5 instead?
 

MemoriesLP

Veteran
Veteran
Joined
Jun 12, 2016
Messages
41
Reaction score
10
First Language
Portuguese
Primarily Uses
Why do you give a screenshot of troop 5 if the events are about enemy 5?
can you show us a screenshot of the enemy 5 instead?
The event is about ALL enemies. All enemies are in this common event. These events can receive the ID of any enemy in the game.
The error has happened even without ever fighting or doing anything with Enemy 5. Last error occured by fighting and using the bestiary of only enemies 12 and 13 (right now on my new testing).
Just like it has happened before without ever facing enemies 12 and 13.

And the enemy troup is where it receives the Enemy Troup ID, so it is related to the entire process of creating this bestiary.

Code:
<hit plus: +100%> Hit Chance
<fdr plus: -10%> Magic Hit Chance
<AOE Hitbox Height: 10>
<Scale Sprite: 70%>
<Default Counter: 703>

<AI Priority>
Random 20% +++ State === State 44 +++ Element Water Weakness: Skill 703, random
State === State 44 +++ Random 40%: Skill 703, random
Random 40% +++ Element Water Weakness: Skill 703, random
State !== State 44 +++ Random 40%: Skill 704, random
Random 80% +++ Element Water Weakness: Skill 703, random
Always: Skill 703, random
</AI Priority>

<Enemy Drops>
Essence of Life: 25%
Essence of Mana: 25%
Goop: 40%
Wet Goop: 20%
</Enemy Drops>

edit: added another image that shows another part of the common event. As I said, the tempEnemy is created for the enemy ID I choose, and this common event writes and receives the info of any enemy I want.
 

Attachments

  • imagem_2023-01-30_145714490.png
    imagem_2023-01-30_145714490.png
    185.7 KB · Views: 2
  • imagem_2023-01-30_150341164.png
    imagem_2023-01-30_150341164.png
    224.8 KB · Views: 2
Last edited:

Latest Threads

Latest Posts

Latest Profile Posts

If anyone knows any C# programmers, please send them my way.
Chilling at night in a tavern.
ChillingAtTavern.png

After 'multiple breakdowns', it's finally over. 10/10 will do this again.
Ever notice that villains can reform and become better people, but heroes can only ever die... or live long enough to see themselves become villains?

Isn't that interesting?
xabileug wrote on Kaelan's profile.
Will you be back?


got inspired by Tekken 5's character select screen and made some new music today for my character select screen.

Forum statistics

Threads
129,842
Messages
1,205,649
Members
170,995
Latest member
RamiroWhitehead
Top