Log in to reply
 

Read and manipulate projectile info?



  • Does anyone know if it's some how possible to read and manipulate information from a projectile (possibly via memory editing?)? For example getting where a RPG is going to or changing it's target.
    @CamxxCore @Unknown-Modder ?


  • MODERATOR

    @Oskar I haven't looked into that yet but what I do know is that the projectile list can be retrieved like this:

    class CProjectile : public CObject
    {
    };
    
    class CProjectileList
    {
    public:
        uint32_t count() const
        {
    	return m_count;
        }
    
        CProjectile* at(uint32_t index) const
        {
    	return m_projectiles[index];
        }
    
    private:
        CProjectile* m_projectiles[50];
        uint32_t m_count;
    };
    
    CProjectileList* g_projectileList;
    
    // use this to get the list address
    uintptr_t address = Pattern::Scan("48 8D 1D ?? ?? ?? ?? 4C 8B 0B 4D 85 C9 74 67");
    if (address)
    {
        g_projectileList = reinterpret_cast<decltype(g_projectileList)>(address + *(int*)(address + 3) + 7);
    }
    

    Now you can open up ReClass and get the info about all projectiles. Example for what you'll see:

    *-><DATA>GTA5.exe.141937AB8 CProjectileRocket : CProjectile : CObject : CPhysical : CDynamicEntity : CEntity : fwEntity@rage : fwExtensibleBase@rage : fwRefAwareBase@rage : ?$fwRefAwareBaseImpl@VdatBase@rage : datBase@rage
    

    Now you know the projectile at the current list item is a rocket. As I said before I haven't looked into that yet so I can only tell you that the model info is at 0x20, the matrix at 0x60 etc.


  • MODERATOR

    @Oskar Had a quick look into it. The target entity of a CProjectileRocket is at CProjectileRocket + 0x630.



  • @Unknown-Modder So the target is an entity and not a set of coordinates?


  • MODERATOR

    @Oskar Yep.



  • @Unknown-Modder How does that work? If I shoot a projectile in the air for example, what would the target entity be? Or does the game create an entity exactly at the target coordinates? And do you have an idea how I could get the projectile I created with GAMEPLAY::SHOOT_SINGLE_BULLET_BETWEEN_COORDS and not any other one so I could modify it's data?


  • MODERATOR

    @Oskar If no entity is the target (e.g. when you shoot a rocket in the air) then the target is just a nullptr and the rocket flies a straight line. Since SHOOT_SINGLE_BULLET_BETWEEN_COORDS doesn't return a value I think it's impossible to get the projectile without some tricks like this:

    SHOOT_SINGLE_BULLET_BETWEEN_COORDS(...);			
    uint32_t index = g_projectileList->count() - 1;
    CProjectile* projectile = g_projectileList->at(index);
    // now you have the projectile you just created
    


  • @Unknown-Modder Wait, do pools fill nullptr gaps between inserted items? If they don't move all the items of nullptr to the last when some item pointers are set to null, this code can fail to get the projectile.


  • MODERATOR

    @kagikn afaik this should work in most cases but I haven't checked how the list fills the items yet so yeah this may be unsafe.



  • @Unknown-Modder I tested Pattern::Scan("48 8D 1D ?? ?? ?? ?? 4C 8B 0B 4D 85 C9 74 67")(strictly speaking I tested equivalent methods but not the same) in both C# and C++ today, but I couldn't find the projectile list. Is there something wrong with this pattern?

    Probably I can make my tracer dart gun script without using the projectile pool, but getting projectiles from the object pool can cause heavy fps drop. By the way, I'm wondering if you can get the entity pointer that the player is locking on to with homing launcher or vehicle missiles or something.


  • MODERATOR

    @kagikn The pattern is valid for at least all versions from 678 to 1103 (I don't have the older versions anymore). Something must be wrong with your code.



  • @Unknown-Modder Yeah, you're right, I realized why I'd thought the pattern wrong. I just thought CProjectileList had poolStartAddress like the entity pool or something (it's a stupid thought, yes).
    Btw, I found CProjectileList doesn't fill empty gaps when occerred, it always puts new projectile pointers to the first empty 8 bytes, though. So when you shoot a projectile with SHOOT_SINGLE_BULLET_BETWEEN_COORDS or something, you need to store the index that points to the first null pointer to get the projectile address.

    And here is one question, is CProjectileList's max item count fixed or hardcoded? There aren't the CEntity, CPed, CVehicle, CObject, CProjectile entries, and so on in gameconfig.xml.


  • MODERATOR

    @kagikn It's hardcoded to be 50.



  • I don't need to worry about the max item count then.



  • Can anyone give me an example on how to get/modify the target entity when using SHOOT_SINGLE_BULLET_BETWEEN_COORDS?
    I tried it on my own but I'm not really into stuff like that.


Log in to reply
 

Looks like your connection to GTA5-Mods.com Forums was lost, please wait while we try to reconnect.