Giter VIP home page Giter VIP logo

Comments (5)

praydog avatar praydog commented on August 21, 2024

Hey. I haven't really worked on this project in a while, but I'd be glad to help.

I had the same problem when I was trying to port this project to DMC5, but never committed the fix. I've committed the change that should fix this. Let me know if there's anything else you need help with.

from reframework.

hntd187 avatar hntd187 commented on August 21, 2024

Thanks any improvements to the obj explorer is helpful. What I meant was I am developing my own mod https://github.com/hntd187/RE2-Mod-Framework/blob/master/src/Speedrun.cpp and I was trying to find enemy health but actually accessing this seems problematic and crashes a lot.

I get it similar to this

auto enemy_manager = globals.get<RopewayEnemyManager>("app.ropeway.EnemyManager");

but then reading it doesn't work. I was trying to read the enemy_manager->enemyList but reading into the actual list doesn't work. The resharper export marks it as a DotNetGenericList do you have any insight on reading this? Or if you know a better way to get the current enemy info I'm happy to use that instead, thanks a lot for the help

from reframework.

praydog avatar praydog commented on August 21, 2024

Here's a little example of how to get all the enemies' HP.

    auto enemy_manager = g_framework->getGlobals()->get<RopewayEnemyManager>("app.ropeway.EnemyManager");

    if (enemy_manager == nullptr) {
        return;
    }

    // Be sure to check for null pointers.
    // This is the active enemies list
    auto enemy_controllers = enemy_manager->enemyControllers;

    if (enemy_controllers == nullptr || enemy_controllers->data == nullptr) {
        return;
    }

    // numElements is the total allocated, not the actual number of elements, so there could be empty entries
    for (auto i = 0; i < enemy_controllers->data->numElements; ++i) {
        // app.ropeway.EnemyController
        auto enemy_controller = utility::REArray::getElement<RopewayEnemyController>(enemy_controllers->data, i);

        // Not valid.
        if (enemy_controller == nullptr) {
            break;
        }

        // May not be necessary, if the field is guaranteed to not be corrupted.
        if (!utility::REManagedObject::isManagedObject(enemy_controller)) {
            continue;
        }

        REBehavior* hitpoint_controller = nullptr;

        // Traverse the enemy controller's children to find the hitpoint controller
        for (auto component = enemy_controller->childComponent; component != nullptr && component != enemy_controller; component = component->childComponent) {
            if (utility::REManagedObject::isA(component, "app.ropeway.HitPointController")) {
                hitpoint_controller = (REBehavior*)component;
                break;
            }
        }

        if (hitpoint_controller == nullptr) {
            continue;
        }

        // Get the health
        auto health = utility::REManagedObject::getField<int32_t>(hitpoint_controller, "CurrentHitPoint");

        // Do whatever you wanted to do here.
    }

from reframework.

hntd187 avatar hntd187 commented on August 21, 2024

Interesting, I was doing something very similar to this, lemme try this and get back to you, thanks a lot for the help

from reframework.

hntd187 avatar hntd187 commented on August 21, 2024

Okay that works perfectly, I wonder what I was doing wrong here, but I think I wasn't traversing to the hit point controller correctly so thanks that helps a lot.

from reframework.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.