Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. Red Dead Redemption 2

      1. PC
      2. Gameplay
      3. Missions
      4. Help & Support
    2. Red Dead Online

      1. Gameplay
      2. Find Lobbies & Outlaws
      3. Help & Support
      4. Frontier Pursuits
    1. Crews & Posses

      1. Recruitment
    2. Events

    1. GTA Online

      1. DLC
      2. Find Lobbies & Players
      3. Guides & Strategies
      4. Vehicles
      5. Content Creator
      6. Help & Support
      7. The Diamond Casino Heist
    2. Grand Theft Auto Series

    3. GTA 6

    4. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    5. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA IV Mods
    6. GTA Chinatown Wars

    7. GTA Vice City Stories

    8. GTA Liberty City Stories

    9. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA SA Mods
    10. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA VC Mods
    11. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA III Mods
    12. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    13. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    3. Featured Mods

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption

    2. Rockstar Games

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Programming
      5. Movies & TV
      6. Music
      7. Sports
      8. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. News

    2. Forum Support

    3. Site Suggestions

Sign in to follow this  
ES_SENCE

[Script C#] It is possible that dead peds in vehicle get out of vehicle by itself ?

Recommended Posts

ES_SENCE

Hey, guys.

I'm writing a simple script mod in C# and I'm in a kind of trouble.

I want peds which died in vehicle to get out its vehicle by itself when the vehicle stops.

I've tried: (Please don't mind names of variables. They are different in real codes.)

  • if (ped.IsDead) ped.Task.LeaveVehicle(vehicle, false); // in onTick
  • Function.Call(Hash.SET_PED_DIES_IN_VEHICLE, ped, false); // when creating ped

But I've got nothing. Peds are still dead in vehicle even if vehicle stopped.

If you have any suggestions, every idea is welcome.

Thank you for reading and have a great day.

 

Share this post


Link to post
Share on other sites
Guest

I think this can be best answered with a real-life scenario.

 

Imagine you're driving and you have a heart attack and die. When the car stops, would you be able to get out of the car?

 

SET_PED_DIES_IN_VEHICLE might be for when the car dies if it falls into water etc... (yep, the cars are actually classed as dead) Maybe that function is to determine if the ped automatically dies at the same time as the car, or whether they stay alive and can get out of the car to save themselves... like the player can.

Edited by Guest

Share this post


Link to post
Share on other sites
ES_SENCE

I think this can be best answered with a real-life scenario.

 

Imagine you're driving and you have a heart attack and die. When the car stops, would you be able to get out of the car?

 

SET_PED_DIES_IN_VEHICLE might be for when the car dies if it falls into water etc... (yep, the cars are actually classed as dead) Maybe that function is to determine if the ped automatically dies at the same time as the car, or whether they stay alive and can get out of the car to save themselves... like the player can.

 

Thank you so much for taking your time to leave a comment for me.

 

Yes, you are right. Giving a task to "dead" entity is really weird command.

 

But I think I could implement it because I think I saw some peds fall out of their vehicles when dead inside them.

 

I want my ped to play that animation.

 

I hope someone knows how to do it.

 

Sorry but thank you for helping me.

Edited by ES_SENCE

Share this post


Link to post
Share on other sites
Guest

I must confess, I have never seen a ped get out if they have been shot, or die in a car crash... and I've killed a lot of peds that way. :)

 

Maybe the ones you saw get out, weren't actually dead yet... as far as the game is concerned, so the game made them get out and then they died. Or perhaps it's because they went into ragdoll mode and fell out due to the physics engine moving them.

 

From what I have seen through various test scripts I have written, when something is dead, it pretty much stops responding to anything other than being removed from the game world. You could try seeing if you can set a dead ped into ragdoll mode but I am not sure what would happen.

Edited by Guest

Share this post


Link to post
Share on other sites
Guest

Here's another thing you could try but again, I have no idea if it would work.

 

You could open the driver's door on the vehicle, set the ped to ragdoll mode and then apply a force to the ped to try and push it out of the vehicle. I have never done anything with applying forces to entities though, so you'll need someone with more experience with that to offer help on that part.

Share this post


Link to post
Share on other sites
NModds

Here's another thing you could try but again, I have no idea if it would work.

 

You could open the driver's door on the vehicle, set the ped to ragdoll mode and then apply a force to the ped to try and push it out of the vehicle. I have never done anything with applying forces to entities though, so you'll need someone with more experience with that to offer help on that part.

 

I mostly use scripthookdotnet's ApplyForce implementation and like you said before, dead peds don't respond to anything. The only way that I found for dead peds to respond to a force is to task clear all immediately before applying the force, or if they bump into something while force is being applied, or if the force was being applied before they died.

Edited by nm710

Share this post


Link to post
Share on other sites
ES_SENCE

Here's another thing you could try but again, I have no idea if it would work.

 

You could open the driver's door on the vehicle, set the ped to ragdoll mode and then apply a force to the ped to try and push it out of the vehicle. I have never done anything with applying forces to entities though, so you'll need someone with more experience with that to offer help on that part.

 

 

Here's another thing you could try but again, I have no idea if it would work.

 

You could open the driver's door on the vehicle, set the ped to ragdoll mode and then apply a force to the ped to try and push it out of the vehicle. I have never done anything with applying forces to entities though, so you'll need someone with more experience with that to offer help on that part.

 

I mostly use scripthookdotnet's ApplyForce implementation and like you said before, dead peds don't respond to anything. The only way that I found for dead peds to respond to a force is to task clear all immediately before applying the force, or if they bump into something while force is being applied, or if the force was being applied before they died.

 

 

Hey guys, thank you for leaving detailed comments.

 

I thought I could implement it, as you guys said, it seems difficult.

 

I'll give it a try what you said.

 

Thank you again for your time.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.