MCBICK'S PROFILE

Search

Filter

[RM2K3] DynRPG AnimationInBattle

I think you're missing parentheses, but even when added, that code won't compile. I get error: conversion from 'RPG::AnimationInBattle*' to non-scalar type 'RPG::AnimationInBattle' requested. This is what I ended up using in the onFrame callback:

//isMon is one of the variables in my cbs plugin that tracks active battler along with
//currentBattler which ranges from 0-7
//Hero is defined as RPG::Actor::partyMember(currentBattler)
//Monster is defined as RPG::monsters[currentBattler]
currentFrame = (isMon) ? RPG::actors[RPG::Actor::partyMember(Monster->action->targetId)->id]->animData->currentAnimationFrame : RPG::monsters[RPG::->action->targetId]->animData->currentAnimationFrame;
//Using the battler class kept giving me issues, which is why I wrote it like this.
The purpose of this code is to know when to update my own action window with the damage number.



I should have realized the AnimationInBattle class was tied to something else when there was no cast for it. Oddly the help file doesn't mention animData or even RPG::Actor in the see also links which is why I couldn't find animData cast.

As for your question for Pepsi, I think so, at least according to the implementation.

[RM2K3] DynRPG AnimationInBattle

Wait, did I misunderstand this class? I thought it took the values of the current animation being displayed in battle? If no animation was displayed the values would be null, otherwise they would contain the values of the animation being displayed? I didn't realize the class was tied to the Actors.

If I understand correctly, then I need to do something like this to access the current animation frame being displayed?


currentFrame = (!battler->isMonster()) ? RPG::monsters[battler->id]->animData->currentAnimationFrame : RPG::actors[battler->id]->animData->currentAnimationFrame;

This seems to work, but the frames do not match the cels. Are cels displayed every other frame or something?

Edit: So it seems animations display each cel for 2 frames before drawing the next one.

[RM2K3] DynRPG AnimationInBattle

Trying to access the members in this class results in an Access violation at 66D110A3 and offset 00000018 of type read. Am I doing something wrong here:

RPG::AnimationInBattle *currentAnim
if(currentAnim->currentAnimationId == specialAnimId)
    getSpecialAction(); //This is not the issue. I have tried omitting this.

I can't find any information on this class aside from this:
https://www.rewking.com/dynrpg/_animation_in_battle_8h_source.html

[RM2K3] Does DynRPG support map manipulation?

author=Cherry
I guess the only useful way would be to modify the actual graphics of the chipset that is loaded (in memory).

Doing that would retain the pathing/terrain properties, wouldn't it? Also if I changed the graphic of a tile, then wouldn't that change all tiles on the map also? I guess I will start by experimenting with the Chipset class first and see how rm2k3 handles the changes to the tile graphics..

[RM2K3] Does DynRPG support map manipulation?

@Cherry
Would it be possible to change a tile to one that is from a different chipset, without changing the chipset?

[RM2K3] Does DynRPG support map manipulation?

@Cherry
Ah, that makes a lot of sense now. It seems I have been misunderstanding how DynRPG works until now. I thought it was replacing rm2k3's source code, but in fact it is just occupying the same memory which allows you to manipulate rm2k3. This explains why most, if not all, changes made in DynRPG are volatile too. Your example gives me a much better idea on how to approach DynRPG too now. Thanks for the explanation!

If I am understanding correctly, I should be able to expand DynRPG, by creating my own headers that points to new memory?

[RM2K3] Does DynRPG support map manipulation?

@Cherry
I am unfamiliar with void **vTable(virtual table function?), but if I am understanding correctly the variables width, height, loopX, and loopY are being dereferenced by dbMap? I am guessing these variables point to an offset in 0x4CDD14(Map Data)? Also is the width and height variables just the size of the chipset in pixels or is divided into tiles? Just to be clear, I understand how the classes work for the most part, but I am confused about those variables because I don't completely understand where they are getting their values, so that they function in the if statement properly.

author=Cherry
No, they are used by the RPG Maker itself (the pointer to the DbMap instance of the currently map is located at the address that you can get by dereferencing address 0x4CDD14 twice, as is written in the last line of my code).

I understand that, but how does that work? Aren't variables locked in their scope? I see dbMap is dereferenced, but how does that apply to width, height, loopX, loopY, and unknown? I am guessing void **vTable is doing something to them?

author=Cherry
#include <stdio.h>

// in onStartup:
AllocConsole(); // No include needed because DynRPG already includes the WinAPI headers
freopen("CON", "w", stdout);

This is interesting. I never thought of doing something like this in DynRPG.

I have rarely used virtual tables before, so sorry if my questions sound stupid. I tried looking up void **vTable, but nothing really comes up beside virtual tables, so I am unsure what this is exactly. I am guessing it is part of RPGMaker or DynRPG in some way.


[RM2K3] Does DynRPG support map manipulation?

author=DNKpp
Isn't there a change chipset command for exactly this purpose? Otherwise handle it via event.
The change chipset commad just swaps chipsets. It does not change specific tiles, but instead swaps all the tiles to the ones listed in the new chipset.

[RM2K3] Does DynRPG support map manipulation?

author=Cherry
Here is an interface for the map tiles:

class TileMap {
  public:
    void **vTable;
    int width;
    int height;
    bool loopX;
    bool loopY;
    short *tiles;
    
    inline short *tile(int x, int y) {
        if (x < 0 || x >= width || y < 0 || y >= height) return NULL;
        return &tiles[y * width + x];
    };
}

class DbMap {
  public:
    void **vTable;
    int _unknown[12];
    TileMap *lowerLayer;
    TileMap *upperLayer;
}

DbMap *&dbMap = (**reinterpret_cast<DbMap ***>(0x4CDD14))

// *** EXAMPLE: ***
// Change lower layer tile at (3, 5) to tile ID 5000
short *tile = dbMap->lowerLayer->tile(3, 5);
if (tile) {
  std::cout << "Current tile ID: " << *tile << std::endl;
  *tile = 5000;
}

Untested, but should work, let me know if it doesn't...

Note: Since this is data which is normally not changable ingame, it means any change here persists for the game session (until game is closed) and is not affected by saving/loading/resetting the game - you have to take care of this yourself.
Wow, I didn't expect to get a reply so soon, thanks! This is exactly what I was looking for. It works fine, but the tile id is confusing. It seems to include every tile the auto tile can create. Do you happen to know the order of the tile ids? If not, that is okay I will just have to test each one. Also why is there std::cout in the code, does that work in DynRPG? Also I have a few questions about this:
class TileMap {
  public:
    void **vTable;
    int width; //How is this being utilized?
    int height; //?
    bool loopX; //?
    bool loopY; //?
    short *tiles;
    inline short *tile(int x, int y) {
        if (x < 0 || x >= width || y < 0 || y >= height) return NULL;
        return &tiles[y * width + x];
    };
};
class DbMap {
  public:
    void **vTable;
    int _unknown[12]; //This is?
    TileMap *lowerLayer;
    TileMap *upperLayer;
};
DbMap *&dbMap = (**reinterpret_cast<DbMap ***>(0x4CDD14));
Are these variables getting their values somewhere else in DynRPG? Also if I change a tile, can I still retrieve its original value some how? It seems to be a volatile memory change, so the original value should still exist somewhere?

[RM2K3] Does DynRPG support map manipulation?

Is it possible to change a specific tile on the map with DynRPG? To calrify, I do not want to change multiple tile types, but a single one. Ideally I would like to be able to create a plugin that allows the user to dynamically change the maps via switches and variables, so that makers don't have to make multiple maps with slight differences when they want an area changed on their map.