Animations NPC Car Drag Ragdoll Mod

Hello, i am working on a car drag ragdoll mod that will catch and drag NPCs that are hit with the player vehicle. Essentially leveraging the existing code examples from the mission lua script for Red Asphalt (patch\bu04.lua):

CHAR_CARLOS = "bh04_$c001"
BERGEN = "bh04_$v000"

vehicle_drag_ragdoll_start(BERGEN, CHAR_CARLOS)

Unfortunately i have a problem with dynamically detecting pedestrians in proximity of the player. I need to understand how I can refer to npc characters based on their dynamic name in game as shown by the manually declared CHAR_CARLOS variable. Is there a complete list of these possible names somewhere?
I have already tried a workaround of referencing NPCs using character_exists(NAME) by checking all character names listed in the common/character.xtbl file.

This current attached version with just player jump ragdoll is based on IdolNinja's sandbox+.

I did try and leverage the callback for on_hit_ped based on m20.lua example from saints row 3:
on_hit_ped("m20_rc_car_hit_ped_cb", M20_vehicle.rc_car)
-- Callback for the RC car hitting a ped
--
-- vehicle: (string) name of the vehicle that hit a ped
--
function m20_rc_car_hit_ped_cb(vehicle, human)

on_hit_ped is listed under the section for lua functions in SR2 for similar functionality for SR3
"The following functions are described in Kinzie's Toy Box document
and do not seem to differ between Saints Row 2 and Saints Row: The
Third." - https://www.saintsrowmods.com/forum/threads/sr2-lua-functions-list-wip.17189/


I am curious if anyone has had some success with leveraging on_hit_ped in SR2 and/or point me in the direction for referencing random npc peds in proximity to the player.


I'll keep digging in the meantime and hopefully post the final version of my mod in the coming months.
 

Attachments

  • sr2_city.lua
    20.2 KB · Views: 82
Finally managed to trigger the car drag function within the first mission under heavily scripted conditions in mission 1. Coincidentally Carlos was the first NPC that i tested it on...

Early Dev Build Video

Research and Development Progress
The vehicle_drag_ragdoll_start(get_char_in_vehicle("#PLAYER#"), CHARACTER_CARLOS) only works with the vehicle type truck_4dr_pickup04 +VARIANT "BRO4_2". Additional testing of this function only works with a single NPC at a time. I'd like to figure out if this limitation has anything to do with this or if it's some kind of specification in the truck vehicle type.

Pending Resolving
Unfortunately I have no luck with dynamically detecting peds not scripted within a CTS file. There are seemingly no places where random Peds names are created in the files so I'm afraid I will be out of luck on figuring this out until I can identify some kind of available naming scheme for random peds that the engine employs via memory reading.
 
Finally managed to trigger the car drag function within the first mission under heavily scripted conditions in mission 1. Coincidentally Carlos was the first NPC that i tested it on...

Early Dev Build Video

Research and Development Progress
The vehicle_drag_ragdoll_start(get_char_in_vehicle("#PLAYER#"), CHARACTER_CARLOS) only works with the vehicle type truck_4dr_pickup04 +VARIANT "BRO4_2". Additional testing of this function only works with a single NPC at a time. I'd like to figure out if this limitation has anything to do with this or if it's some kind of specification in the truck vehicle type.

Pending Resolving
Unfortunately I have no luck with dynamically detecting peds not scripted within a CTS file. There are seemingly no places where random Peds names are created in the files so I'm afraid I will be out of luck on figuring this out until I can identify some kind of available naming scheme for random peds that the engine employs via memory reading.
Nice work, carlos moving on the car was hilarious
 
Back
Top