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

    1. GTA Online

      1. The Diamond Casino Heist
      2. Find Lobbies & Players
      3. Guides & Strategies
      4. Vehicles
      5. Content Creator
      6. Help & Support
    2. Red Dead Online

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

      1. Events
    1. Red Dead Redemption 2

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

    1. Grand Theft Auto Series

    2. GTA 6

    3. GTA V

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

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA Chinatown Wars

    6. GTA Vice City Stories

    7. GTA Liberty City Stories

    8. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
    9. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
    10. GTA III

      1. Guides & Strategies
      2. Help & Support
    11. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

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

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    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
    3. Gangs

    1. News

    2. Forum Support

    3. Site Suggestions

A_SN

Avoiding hospital respawn and death cam

Recommended Posts

A_SN

I really want to be able to cancel death/handle death myself by which I mean instead of dying normally I want other things to happen, like switching to another ped instead of respawning. That would be really useful when you lead a team of peds, when you die you can switch to one of them and not respawn until the last one is gone. But how can I prevent respawning?

 

It seems like GAMEPLAY::DISABLE_HOSPITAL_RESTART(), GAMEPLAY::IGNORE_NEXT_RESTART() and GAMEPLAY::SET_FADE_OUT_AFTER_DEATH() or even GAMEPLAY::_0x2C2B3493FBF51C71 might be the way to go, however all I can do so far is make the slomo effect during death go away (the fade to black still occurs). It seems like some bits might have to be set, but that's really arcane, I have no idea how that might be used.

 

Any ideas?

Edited by A_SN

Share this post


Link to post
Share on other sites
NTAuthority

Run the game in network mode - this should allow manual control of player ped resurrection.

 

If for whatever reason (EXE limitations on natives such as host initiation you are incapable of bypassing) this is not an option, I don't know either.

  • Like 1

Share this post


Link to post
Share on other sites
PlsGoobez

Run the game in network mode - this should allow manual control of player ped resurrection.

 

If for whatever reason (EXE limitations on natives such as host initiation you are incapable of bypassing) this is not an option, I don't know either.

 

Bumping this up, how exactly could I run it in network mode? What would be different with it in that mode?

Share this post


Link to post
Share on other sites
c39687

pretty sure he means play online, not really a good solution

Share this post


Link to post
Share on other sites
PlsGoobez

pretty sure he means play online, not really a good solution

            Function.Call(Hash.NETWORK_REQUEST_CONTROL_OF_ENTITY, Game.Player.Character);            Function.Call(Hash.NETWORK_RESURRECT_LOCAL_PLAYER, Game.Player.Character.Position.X, Game.Player.Character.Position.Y, Game.Player.Character.Position.Z, 0.0, 0.0, 0.0);

Just tested these out, they work great. No infinite loading screen when using a different Ped model for the Player, just instantly brings the Ped back to life at the specified coordinates.

Share this post


Link to post
Share on other sites
c39687

so you can just call that on death? to override game respawn? Is that on single player?

Edited by c39687

Share this post


Link to post
Share on other sites
PlsGoobez

so you can just call that on death? to override game respawn? Is that on single player?

Yep, I just checked if the player was dead OnTick and then executed the code above.

 

Single player.

Share this post


Link to post
Share on other sites
c39687

sounds good, it appears network has nothing to do with online then

Share this post


Link to post
Share on other sites
PlsGoobez

sounds good, it appears network has nothing to do with online then

 

Well, Online uses the NETWORK:: functions, but you can use them in SP.

Edited by PlsGoobez

Share this post


Link to post
Share on other sites
A_SN

 

pretty sure he means play online, not really a good solution

            Function.Call(Hash.NETWORK_REQUEST_CONTROL_OF_ENTITY, Game.Player.Character);            Function.Call(Hash.NETWORK_RESURRECT_LOCAL_PLAYER, Game.Player.Character.Position.X, Game.Player.Character.Position.Y, Game.Player.Character.Position.Z, 0.0, 0.0, 0.0);

Just tested these out, they work great. No infinite loading screen when using a different Ped model for the Player, just instantly brings the Ped back to life at the specified coordinates.

 

Amazing!

 

Noob question, since last I posted I actually bought the game on Steam and now I don't know how to make SP modding work without getting into trouble with Online, is there any guide for that anywhere? Wait nvm looks like ScriptHook disables itself with Online.

Edited by A_SN

Share this post


Link to post
Share on other sites
Lovono

 

pretty sure he means play online, not really a good solution

            Function.Call(Hash.NETWORK_REQUEST_CONTROL_OF_ENTITY, Game.Player.Character);            Function.Call(Hash.NETWORK_RESURRECT_LOCAL_PLAYER, Game.Player.Character.Position.X, Game.Player.Character.Position.Y, Game.Player.Character.Position.Z, 0.0, 0.0, 0.0);

Just tested these out, they work great. No infinite loading screen when using a different Ped model for the Player, just instantly brings the Ped back to life at the specified coordinates.

 

I try this

playerPed = PLAYER::PLAYER_PED_ID();NETWORK::NETWORK_REQUEST_CONTROL_OF_ENTITY(playerPed);vec = ENTITY::GET_ENTITY_COORDS(playerPed, 0);NETWORK::NETWORK_RESURRECT_LOCAL_PLAYER((DWORD)vec.x, (DWORD)vec.y, (DWORD)vec.z, 0, 0, 0);

But the game gets freeze, I have to reset my pc to escape that freeze. I don't know if I'm doing the code right?

PS: I changed the player model with: PLAYER::SET_PLAYER_MODEL before I do the code above.

Edited by Lovono

Share this post


Link to post
Share on other sites
A_SN

 

 

pretty sure he means play online, not really a good solution

            Function.Call(Hash.NETWORK_REQUEST_CONTROL_OF_ENTITY, Game.Player.Character);            Function.Call(Hash.NETWORK_RESURRECT_LOCAL_PLAYER, Game.Player.Character.Position.X, Game.Player.Character.Position.Y, Game.Player.Character.Position.Z, 0.0, 0.0, 0.0);

Just tested these out, they work great. No infinite loading screen when using a different Ped model for the Player, just instantly brings the Ped back to life at the specified coordinates.

 

I try this

playerPed = PLAYER::PLAYER_PED_ID();NETWORK::NETWORK_REQUEST_CONTROL_OF_ENTITY(playerPed);vec = ENTITY::GET_ENTITY_COORDS(playerPed, 0);NETWORK::NETWORK_RESURRECT_LOCAL_PLAYER((DWORD)vec.x, (DWORD)vec.y, (DWORD)vec.z, 0, 0, 0);

But the game gets freeze, I have to reset my pc to escape that freeze. I don't know if I'm doing the code right?

PS: I changed the player model with: PLAYER::SET_PLAYER_MODEL before I do the code above.

 

Why do you cast to DWORD?? The coordinates are floating point.

Share this post


Link to post
Share on other sites
Lovono

 

Why do you cast to DWORD?? The coordinates are floating point.

 

I cast DWORD because in Native.h, the parameter is Any, I just cast to clear the Visual Studio warning when it compiles, anyway, It doesn't affect the function, does it?

Share this post


Link to post
Share on other sites
A_SN

 

 

Why do you cast to DWORD?? The coordinates are floating point.

 

I cast DWORD because in Native.h, the parameter is Any, I just cast to clear the Visual Studio warning when it compiles, anyway, It doesn't affect the function, does it?

 

I don't think it should break it but by casting to an integer you're rounding down the coordinates to the nearest integer, and iirc a unit in the game is one meter.

 

Actually if it doesn't cast it back to float then you're feeding an integer that is interpreted as a float, which would give you bogus coordinates (probably denormals around 0). I'm not sure which it is, but if I was you I'd try without casting anyway, on the off-chance that fixes it (and also you probably shouldn't cast anyway no matter what the compiler says).

Share this post


Link to post
Share on other sites
Lovono

 

I don't think it should break it but by casting to an integer you're rounding down the coordinates to the nearest integer, and iirc a unit in the game is one meter.

 

Actually if it doesn't cast it back to float then you're feeding an integer that is interpreted as a float, which would give you bogus coordinates (probably denormals around 0). I'm not sure which it is, but if I was you I'd try without casting anyway, on the off-chance that fixes it (and also you probably shouldn't cast anyway no matter what the compiler says).

 

I give up, I think I should not mess around with NETWORK function :)

Share this post


Link to post
Share on other sites
A_SN

I tried it myself and I get a freeze too, no matter whether I try it when dead or alive.

 

Here's my code:

	if (key_down[79])	{		if (ENTITY::IS_ENTITY_DEAD(PLAYER::PLAYER_PED_ID()))		{			NETWORK::NETWORK_REQUEST_CONTROL_OF_ENTITY(player_ped);			NETWORK::NETWORK_RESURRECT_LOCAL_PLAYER(mypos.x, mypos.y, mypos.z+100.f, 0.0, 0.0, 0.0);		}	}

Share this post


Link to post
Share on other sites
PlsGoobez

 

I tried it myself and I get a freeze too, no matter whether I try it when dead or alive.

 

Here's my code:

	if (key_down[79])	{		if (ENTITY::IS_ENTITY_DEAD(PLAYER::PLAYER_PED_ID()))		{			NETWORK::NETWORK_REQUEST_CONTROL_OF_ENTITY(player_ped);			NETWORK::NETWORK_RESURRECT_LOCAL_PLAYER(mypos.x, mypos.y, mypos.z+100.f, 0.0, 0.0, 0.0);		}	}

You're freezing without "key_down[79]" being pressed?

Share this post


Link to post
Share on other sites
A_SN

 

 

I tried it myself and I get a freeze too, no matter whether I try it when dead or alive.

 

Here's my code:

	if (key_down[79])	{		if (ENTITY::IS_ENTITY_DEAD(PLAYER::PLAYER_PED_ID()))		{			NETWORK::NETWORK_REQUEST_CONTROL_OF_ENTITY(player_ped);			NETWORK::NETWORK_RESURRECT_LOCAL_PLAYER(mypos.x, mypos.y, mypos.z+100.f, 0.0, 0.0, 0.0);		}	}

You're freezing without "key_down[79]" being pressed?

 

No of course not, with this code I freeze when I'm pressing it while being dead. I tried before while alive without the IS_ENTITY_DEAD check and in both cases I froze.

Share this post


Link to post
Share on other sites
PlsGoobez

 

 

 

I tried it myself and I get a freeze too, no matter whether I try it when dead or alive.

 

Here's my code:

	if (key_down[79])	{		if (ENTITY::IS_ENTITY_DEAD(PLAYER::PLAYER_PED_ID()))		{			NETWORK::NETWORK_REQUEST_CONTROL_OF_ENTITY(player_ped);			NETWORK::NETWORK_RESURRECT_LOCAL_PLAYER(mypos.x, mypos.y, mypos.z+100.f, 0.0, 0.0, 0.0);		}	}

You're freezing without "key_down[79]" being pressed?

 

No of course not, with this code I freeze when I'm pressing it while being dead. I tried before while alive without the IS_ENTITY_DEAD check and in both cases I froze.

 

I have no idea, I just ran mine in an OnTick loop.

Share this post


Link to post
Share on other sites
GeorgeZhang

It works fine for me, like a miracle. Many thanks!

Share this post


Link to post
Share on other sites
A_SN

It works fine for me, like a miracle. Many thanks!

Can you show your code for it please?

Share this post


Link to post
Share on other sites
uNiverselEgacy

It only skips the slow motion death screen for me. I still get a hospital respawn after that.

Plus I have to add the following code otherwise I get another respawn a few seconds after the first one.

GAMEPLAY::_RESET_LOCALPLAYER_STATE();PLAYER::RESET_PLAYER_ARREST_STATE(player);

Share this post


Link to post
Share on other sites
GeorgeZhang

 

It works fine for me, like a miracle. Many thanks!

Can you show your code for it please?

 

 

Here is my full code of better respawn_controller:

        void Respawn_Controller()        {            if (playerPed.IsDead)            {                Vector3 respawnLoc = AllySpawns[0];                Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller");                                playerPed = Game.Player.Character;                Function.Call(Hash.NETWORK_REQUEST_CONTROL_OF_ENTITY, playerPed);                Function.Call(Hash.NETWORK_RESURRECT_LOCAL_PLAYER, playerPed.Position.X, playerPed.Position.Y, playerPed.Position.Z, 0.0, 0.0, 0.0);                Function.Call(Hash.SET_PED_TO_RAGDOLL, playerPed, 10000, 10000, 0, 0, 0, 0);                playerPed.IsInvincible = true;                int s = Audio.PlaySoundFrontend("ScreenFlash", "MissionFailedSounds");                int s1 = Audio.PlaySoundFrontend("Bed", "WastedSounds");                while (!Audio.HasSoundFinished(s)) Wait(100);                int s2 = Audio.PlaySoundFrontend("TextHit", "WastedSounds");                Function.Call(Hash._START_SCREEN_EFFECT, "DeathFailOut", 10000, true);                BigMessageThread.MessageInstance.ShowMissionPassedMessage("~r~wasted", 5000);                Game.FadeScreenOut(5000);                Wait(5500);                                Function.Call(Hash._STOP_SCREEN_EFFECT, "DeathFailOut");                Audio.StopSound(s);                Audio.StopSound(s1);                Audio.StopSound(s2);                Audio.ReleaseSound(s);                Audio.ReleaseSound(s1);                Audio.ReleaseSound(s2);                                Function.Call(Hash.NETWORK_REQUEST_CONTROL_OF_ENTITY, playerPed);                Function.Call(Hash.NETWORK_RESURRECT_LOCAL_PLAYER, respawnLoc.X, respawnLoc.Y, respawnLoc.Z, 0.0, 0.0, 0.0);                                playerPed.IsInvincible = false;                                Game.FadeScreenIn(2000);            }                    }

Edit: This should be put in Tick event. And it's very buggy tho.

Edited by GeorgeZhang

Share this post


Link to post
Share on other sites
aimless

This works and looks good. When i get killed by cops it still did the hospital restart. Adding Function.Call(Hash.IGNORE_NEXT_RESTART, true); Works. I like how you put the ragdoll in. It would be nice to add some force from the killshot. Instead of just going limp when killed.

Share this post


Link to post
Share on other sites
A_SN

 

 

It works fine for me, like a miracle. Many thanks!

Can you show your code for it please?

 

 

Here is my full code of better respawn_controller:

        void Respawn_Controller()        {            if (playerPed.IsDead)            {                Vector3 respawnLoc = AllySpawns[0];                Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller");                                playerPed = Game.Player.Character;                Function.Call(Hash.NETWORK_REQUEST_CONTROL_OF_ENTITY, playerPed);                Function.Call(Hash.NETWORK_RESURRECT_LOCAL_PLAYER, playerPed.Position.X, playerPed.Position.Y, playerPed.Position.Z, 0.0, 0.0, 0.0);                Function.Call(Hash.SET_PED_TO_RAGDOLL, playerPed, 10000, 10000, 0, 0, 0, 0);                playerPed.IsInvincible = true;                int s = Audio.PlaySoundFrontend("ScreenFlash", "MissionFailedSounds");                int s1 = Audio.PlaySoundFrontend("Bed", "WastedSounds");                while (!Audio.HasSoundFinished(s)) Wait(100);                int s2 = Audio.PlaySoundFrontend("TextHit", "WastedSounds");                Function.Call(Hash._START_SCREEN_EFFECT, "DeathFailOut", 10000, true);                BigMessageThread.MessageInstance.ShowMissionPassedMessage("~r~wasted", 5000);                Game.FadeScreenOut(5000);                Wait(5500);                                Function.Call(Hash._STOP_SCREEN_EFFECT, "DeathFailOut");                Audio.StopSound(s);                Audio.StopSound(s1);                Audio.StopSound(s2);                Audio.ReleaseSound(s);                Audio.ReleaseSound(s1);                Audio.ReleaseSound(s2);                                Function.Call(Hash.NETWORK_REQUEST_CONTROL_OF_ENTITY, playerPed);                Function.Call(Hash.NETWORK_RESURRECT_LOCAL_PLAYER, respawnLoc.X, respawnLoc.Y, respawnLoc.Z, 0.0, 0.0, 0.0);                                playerPed.IsInvincible = false;                                Game.FadeScreenIn(2000);            }                    }

Edit: This should be put in Tick event. And it's very buggy tho.

 

Very interesting thank you.

 

The resurrect stuff still freezes for me, but actually just using GAMEPLAY::TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME("respawn_controller"); for as long as the player is dead does something very interesting:

 

So you die, the HUD goes away and you can't move your mouse anymore, but everything else stays normal, as when you're not dead, you just lay there helpless, which is slightly creepy but also more immersive. Then after about 5 seconds you come back to life at the same spot your body ended up, the time changes (usually alternating between 7 am and 5:10 pm), your wanted level is gone (unless you have fellow group members who are also wanted I guess), but you're back on the same spot with the same peds around you. Which is cool, you can beat up a bunch of cops, die, resume your rampage, die, repeat... You both get the advantage of being vulnerable but without the inconvenience of being sent far away, I love it.

 

So one could use that, then as soon as you pop back to life adjust the time and position or whatever.

 

A few more notes: If you use NativeTrainer's skin changer when when you die your skin changes, this has for effect to bring you back to life as Michael instantly. However after those roughly 5 seconds the time of the day changes. Maybe there's another script taking care of that. Also if you die underwater you you come back to life underwater. If you die in the air it seems it waits until you land, however it also seems that if you hit a building on your way down then after those 5 seconds you come back to life falling down (skydiving), happened to me once. If you die in a wreck you come back near that wreck, which once when I crashed with a Dodo into a building means I came back to life stuck between the skids and the rest of the falling wreck of the plane, which made me die at least once more. Also if you wait until a few seconds into the normal death and then suppress the respawn_controller script you can end up coming back to life at the hospital but with the greyed out and grainy look until you die again. If you assign a key to suppressing the script you can do some kind of weird stuff.

 

Where did you find about the respawn_controller stuff? It'd be interesting to know what other scripts one can bypass to modify the behaviour of the game.

Share this post


Link to post
Share on other sites
ShadowTV

Hey guys!

 

I made some small additions to the code (most of it was mentioned here).

 

Before:

>You die

>Script detects death

>Make screen grainy, black and white with slomo

>Start wasted sounds

>Show 'wasted' text

>Fade out

>Remove black and white

>Stop wasted sounds

>Respawn

>Fade in

 

After:

>You die

>Script detects death

>Make screen grainy, black and white without slomo

>Start wasted sounds

>(Couldn't get BigMessageThread to work somehow, can anyone tell me what I need for this? :))

>Fade out (faster)

>Remove all peds in a specified radius (if you want to keep your peds, comment it out or remove it)

>Stop wasted sounds

>Remove all screen effects and (just to be sure) slomo

>Respawn

>Give player the ability to use his/her HUD and menus again (weapon wheel not working? :( Well that's weird, got it working again. Need to reproduce for a possible fix)

>Fade in

 

Just wanted to mention that the video lags for like the first 10 seconds :D

https://youtu.be/sXgHFjGF8Hw

 

 

Here is the code:

if (player.IsDead)                {                    Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller");                    player = Game.Player.Character;                    Function.Call(Hash.NETWORK_REQUEST_CONTROL_OF_ENTITY, player);                    Function.Call(Hash.NETWORK_RESURRECT_LOCAL_PLAYER, player.Position.X, player.Position.Y, player.Position.Z, 0.0, 0.0, 0.0);                    Function.Call(Hash.IGNORE_NEXT_RESTART, true);                    Function.Call(Hash.SET_PED_TO_RAGDOLL, player, 10000, 10000, 0, 0, 0, 0);                    player.IsInvincible = true;                    int s = Audio.PlaySoundFrontend("ScreenFlash", "MissionFailedSounds");                    int s1 = Audio.PlaySoundFrontend("Bed", "WastedSounds");                    while (!Audio.HasSoundFinished(s)) Wait(100);                    int s2 = Audio.PlaySoundFrontend("TextHit", "WastedSounds");                    Function.Call(Hash._START_SCREEN_EFFECT, "DeathFailOut", 10000, true);                    Game.TimeScale = 1.0f;                    //BigMessageThread.MessageInstance.ShowMissionPassedMessage("~r~wasted", 5000);                    Game.FadeScreenOut(2000);                    Wait(2500);                    Function.Call(Hash._STOP_ALL_SCREEN_EFFECTS);                    foreach(Ped j in World.GetNearbyPeds(player, 64.0f))                    {                        j.Delete();                    }                    Game.TimeScale = 1.0f;                    Audio.StopSound(s);                    Audio.StopSound(s1);                    Audio.StopSound(s2);                    Audio.ReleaseSound(s);                    Audio.ReleaseSound(s1);                    Audio.ReleaseSound(s2);                    Function.Call(Hash.NETWORK_REQUEST_CONTROL_OF_ENTITY, player);                    Function.Call(Hash.NETWORK_RESURRECT_LOCAL_PLAYER, player.Position.X, player.Position.Y, player.Position.Z, 0.0, 0.0, 0.0);                    Function.Call(Hash.IGNORE_NEXT_RESTART, true);                    Function.Call(Hash._RESET_LOCALPLAYER_STATE);                    Function.Call(Hash.RESET_PLAYER_ARREST_STATE, player);                    player.IsInvincible = false;                    Game.FadeScreenIn(2000);                }
Edited by ShadowTV

Share this post


Link to post
Share on other sites
uNiverselEgacy

 

 

 

It works fine for me, like a miracle. Many thanks!

Can you show your code for it please?

 

 

Here is my full code of better respawn_controller:

        void Respawn_Controller()        {            if (playerPed.IsDead)            {                Vector3 respawnLoc = AllySpawns[0];                Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller");                                playerPed = Game.Player.Character;                Function.Call(Hash.NETWORK_REQUEST_CONTROL_OF_ENTITY, playerPed);                Function.Call(Hash.NETWORK_RESURRECT_LOCAL_PLAYER, playerPed.Position.X, playerPed.Position.Y, playerPed.Position.Z, 0.0, 0.0, 0.0);                Function.Call(Hash.SET_PED_TO_RAGDOLL, playerPed, 10000, 10000, 0, 0, 0, 0);                playerPed.IsInvincible = true;                int s = Audio.PlaySoundFrontend("ScreenFlash", "MissionFailedSounds");                int s1 = Audio.PlaySoundFrontend("Bed", "WastedSounds");                while (!Audio.HasSoundFinished(s)) Wait(100);                int s2 = Audio.PlaySoundFrontend("TextHit", "WastedSounds");                Function.Call(Hash._START_SCREEN_EFFECT, "DeathFailOut", 10000, true);                BigMessageThread.MessageInstance.ShowMissionPassedMessage("~r~wasted", 5000);                Game.FadeScreenOut(5000);                Wait(5500);                                Function.Call(Hash._STOP_SCREEN_EFFECT, "DeathFailOut");                Audio.StopSound(s);                Audio.StopSound(s1);                Audio.StopSound(s2);                Audio.ReleaseSound(s);                Audio.ReleaseSound(s1);                Audio.ReleaseSound(s2);                                Function.Call(Hash.NETWORK_REQUEST_CONTROL_OF_ENTITY, playerPed);                Function.Call(Hash.NETWORK_RESURRECT_LOCAL_PLAYER, respawnLoc.X, respawnLoc.Y, respawnLoc.Z, 0.0, 0.0, 0.0);                                playerPed.IsInvincible = false;                                Game.FadeScreenIn(2000);            }                    }

Edit: This should be put in Tick event. And it's very buggy tho.

 

Very interesting thank you.

 

The resurrect stuff still freezes for me, but actually just using GAMEPLAY::TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME("respawn_controller"); for as long as the player is dead does something very interesting:

 

So you die, the HUD goes away and you can't move your mouse anymore, but everything else stays normal, as when you're not dead, you just lay there helpless, which is slightly creepy but also more immersive. Then after about 5 seconds you come back to life at the same spot your body ended up, the time changes (usually alternating between 7 am and 5:10 pm), your wanted level is gone (unless you have fellow group members who are also wanted I guess), but you're back on the same spot with the same peds around you. Which is cool, you can beat up a bunch of cops, die, resume your rampage, die, repeat... You both get the advantage of being vulnerable but without the inconvenience of being sent far away, I love it.

 

So one could use that, then as soon as you pop back to life adjust the time and position or whatever.

 

A few more notes: If you use NativeTrainer's skin changer when when you die your skin changes, this has for effect to bring you back to life as Michael instantly. However after those roughly 5 seconds the time of the day changes. Maybe there's another script taking care of that. Also if you die underwater you you come back to life underwater. If you die in the air it seems it waits until you land, however it also seems that if you hit a building on your way down then after those 5 seconds you come back to life falling down (skydiving), happened to me once. If you die in a wreck you come back near that wreck, which once when I crashed with a Dodo into a building means I came back to life stuck between the skids and the rest of the falling wreck of the plane, which made me die at least once more. Also if you wait until a few seconds into the normal death and then suppress the respawn_controller script you can end up coming back to life at the hospital but with the greyed out and grainy look until you die again. If you assign a key to suppressing the script you can do some kind of weird stuff.

 

Where did you find about the respawn_controller stuff? It'd be interesting to know what other scripts one can bypass to modify the behaviour of the game.

 

The last parameter of NETWORK_RESURRECT_LOCAL_PLAYER is actually a bool that controls whether the time should change I think so use false or an integer 0 to prevent the time change.

Share this post


Link to post
Share on other sites
GeorgeZhang

 

Hey guys!

 

I made some small additions to the code (most of it was mentioned here).

 

Before:

>You die

>Script detects death

>Make screen grainy, black and white with slomo

>Start wasted sounds

>Show 'wasted' text

>Fade out

>Remove black and white

>Stop wasted sounds

>Respawn

>Fade in

 

After:

>You die

>Script detects death

>Make screen grainy, black and white without slomo

>Start wasted sounds

>(Couldn't get BigMessageThread to work somehow, can anyone tell me what I need for this? :))

>Fade out (faster)

>Remove all peds in a specified radius (if you want to keep your peds, comment it out or remove it)

>Stop wasted sounds

>Remove all screen effects and (just to be sure) slomo

>Respawn

>Give player the ability to use his/her HUD and menus again (weapon wheel not working? :( Well that's weird, got it working again. Need to reproduce for a possible fix)

>Fade in

 

Just wanted to mention that the video lags for like the first 10 seconds :D

https://youtu.be/sXgHFjGF8Hw

 

 

Here is the code:

if (player.IsDead)                {                    Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller");                    player = Game.Player.Character;                    Function.Call(Hash.NETWORK_REQUEST_CONTROL_OF_ENTITY, player);                    Function.Call(Hash.NETWORK_RESURRECT_LOCAL_PLAYER, player.Position.X, player.Position.Y, player.Position.Z, 0.0, 0.0, 0.0);                    Function.Call(Hash.IGNORE_NEXT_RESTART, true);                    Function.Call(Hash.SET_PED_TO_RAGDOLL, player, 10000, 10000, 0, 0, 0, 0);                    player.IsInvincible = true;                    int s = Audio.PlaySoundFrontend("ScreenFlash", "MissionFailedSounds");                    int s1 = Audio.PlaySoundFrontend("Bed", "WastedSounds");                    while (!Audio.HasSoundFinished(s)) Wait(100);                    int s2 = Audio.PlaySoundFrontend("TextHit", "WastedSounds");                    Function.Call(Hash._START_SCREEN_EFFECT, "DeathFailOut", 10000, true);                    Game.TimeScale = 1.0f;                    //BigMessageThread.MessageInstance.ShowMissionPassedMessage("~r~wasted", 5000);                    Game.FadeScreenOut(2000);                    Wait(2500);                    Function.Call(Hash._STOP_ALL_SCREEN_EFFECTS);                    foreach(Ped j in World.GetNearbyPeds(player, 64.0f))                    {                        j.Delete();                    }                    Game.TimeScale = 1.0f;                    Audio.StopSound(s);                    Audio.StopSound(s1);                    Audio.StopSound(s2);                    Audio.ReleaseSound(s);                    Audio.ReleaseSound(s1);                    Audio.ReleaseSound(s2);                    Function.Call(Hash.NETWORK_REQUEST_CONTROL_OF_ENTITY, player);                    Function.Call(Hash.NETWORK_RESURRECT_LOCAL_PLAYER, player.Position.X, player.Position.Y, player.Position.Z, 0.0, 0.0, 0.0);                    Function.Call(Hash.IGNORE_NEXT_RESTART, true);                    Function.Call(Hash._RESET_LOCALPLAYER_STATE);                    Function.Call(Hash.RESET_PLAYER_ARREST_STATE, player);                    player.IsInvincible = false;                    Game.FadeScreenIn(2000);                }

You need NativeUI to show big message. Otherwise you need to make yourself another class : script to do it.

Edited by GeorgeZhang
  • Like 1

Share this post


Link to post
Share on other sites
GeorgeZhang

Bugs need fixing:

-The HUD, Pause Menu and Radar all goes away (sometimes) even though I call Function.Call(Hash.DISPLAY_HUD, true); Function.Call(Hash.DISPLAY_RADAR, true);

-The ragdoll native can't really present to us how the player died accurately. (Only velocity can be re-used).

-After the first revive(which is to stop the game from respawning), the player can be killed again so you will get double "wasted" message(one from game one from script).

 

The respawn_controller really can't be killed off completely that's what causing the above issues.(I found out respawn_controller thanks to Leftas's post in another topic)

 

Edit: I made a even better looking code. It fixes the last 2 problems mentioned above. Still no Radar and HUD fix tho. Thanks uNiverselEgacy for the time change.

        void Respawn_Controller()        {            Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller");            Function.Call(Hash.IGNORE_NEXT_RESTART, true);            Function.Call(Hash._DISABLE_AUTOMATIC_RESPAWN, true);            Function.Call(Hash.SET_FADE_OUT_AFTER_DEATH, false);            if (playerPed.IsDead)            {                Function.Call(Hash.SET_FADE_IN_AFTER_DEATH_ARREST, true);                Vector3 respawnLoc = AllySpawns[0];                                                int s = Audio.PlaySoundFrontend("ScreenFlash", "MissionFailedSounds");                int s1 = Audio.PlaySoundFrontend("Bed", "WastedSounds");                while (!Audio.HasSoundFinished(s)) Wait(10);                int s2 = Audio.PlaySoundFrontend("TextHit", "WastedSounds");                Function.Call(Hash._START_SCREEN_EFFECT, "DeathFailOut", 10000, true);                                BigMessageThread.MessageInstance.ShowMissionPassedMessage("~r~wasted", 4000);                Game.TimeScale = 0.2f;                                Wait(2000);                Game.FadeScreenOut(5000);                Wait(5000);                Yield();                Game.TimeScale = 1f;                Function.Call(Hash._STOP_ALL_SCREEN_EFFECTS);                Audio.StopSound(s);                Audio.StopSound(s1);                Audio.StopSound(s2);                Audio.ReleaseSound(s);                Audio.ReleaseSound(s1);                Audio.ReleaseSound(s2);                Function.Call(Hash.NETWORK_REQUEST_CONTROL_OF_ENTITY, playerPed);                Function.Call(Hash.NETWORK_RESURRECT_LOCAL_PLAYER, respawnLoc.X, respawnLoc.Y, respawnLoc.Z, playerPed.Heading, false, false);                                playerPed.Health = playerPed.MaxHealth;                playerPed.Task.ClearAllImmediately();                playerPed.Weapons.Select((WeaponHash)Game.GenerateHash(StartingWeapon));                Game.FadeScreenIn(3000);                                BigMessageThread.MessageInstance.ShowMissionPassedMessage("~b~resurrected", 1500);                Wait(2000);                Game.EnableAllControlsThisFrame(2);                Function.Call(Hash.DISPLAY_HUD, true);//Doesn't work here                Function.Call(Hash.DISPLAY_RADAR, true);//Doesn't work here, either                                playerPed.FreezePosition = false;            }                    }
Edited by GeorgeZhang

Share this post


Link to post
Share on other sites
ShadowTV

Bugs need fixing:

-The HUD, Pause Menu and Radar all goes away (sometimes) even though I call Function.Call(Hash.DISPLAY_HUD, true); Function.Call(Hash.DISPLAY_RADAR, true);

-The ragdoll native can't really present to us how the player died accurately. (Only velocity can be re-used).

-After the first revive(which is to stop the game from respawning), the player can be killed again so you will get double "wasted" message(one from game one from script).

 

The respawn_controller really can't be killed off completely that's what causing the above issues.(I found out respawn_controller thanks to Leftas's post in another topic)

 

Edit: I made a even better looking code. It fixes the last 2 problems mentioned above. Still no Radar and HUD fix tho. Thanks uNiverselEgacy for the time change.

 

 

void Respawn_Controller(){Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller");Function.Call(Hash.IGNORE_NEXT_RESTART, true);Function.Call(Hash._DISABLE_AUTOMATIC_RESPAWN, true);Function.Call(Hash.SET_FADE_OUT_AFTER_DEATH, false);if (playerPed.IsDead){Function.Call(Hash.SET_FADE_IN_AFTER_DEATH_ARREST, true);Vector3 respawnLoc = AllySpawns[0];int s = Audio.PlaySoundFrontend("ScreenFlash", "MissionFailedSounds");int s1 = Audio.PlaySoundFrontend("Bed", "WastedSounds");while (!Audio.HasSoundFinished(s)) Wait(10);int s2 = Audio.PlaySoundFrontend("TextHit", "WastedSounds");Function.Call(Hash._START_SCREEN_EFFECT, "DeathFailOut", 10000, true);BigMessageThread.MessageInstance.ShowMissionPassedMessage("~r~wasted", 4000);Game.TimeScale = 0.2f;Wait(2000);Game.FadeScreenOut(5000);Wait(5000);Yield();Game.TimeScale = 1f;Function.Call(Hash._STOP_ALL_SCREEN_EFFECTS);Audio.StopSound(s);Audio.StopSound(s1);Audio.StopSound(s2);Audio.ReleaseSound(s);Audio.ReleaseSound(s1);Audio.ReleaseSound(s2);Function.Call(Hash.NETWORK_REQUEST_CONTROL_OF_ENTITY, playerPed);Function.Call(Hash.NETWORK_RESURRECT_LOCAL_PLAYER, respawnLoc.X, respawnLoc.Y, respawnLoc.Z, playerPed.Heading, false, false);playerPed.Health = playerPed.MaxHealth;playerPed.Task.ClearAllImmediately();playerPed.Weapons.Select((WeaponHash)Game.GenerateHash(StartingWeapon));Game.FadeScreenIn(3000);BigMessageThread.MessageInstance.ShowMissionPassedMessage("~b~resurrected", 1500);Wait(2000);Game.EnableAllControlsThisFrame(2);Function.Call(Hash.DISPLAY_HUD, true);//Doesn't work hereFunction.Call(Hash.DISPLAY_RADAR, true);//Doesn't work here, eitherplayerPed.FreezePosition = false;}}

 

 

 

Add

Function.Call(Hash._RESET_LOCALPLAYER_STATE);Function.Call(Hash.RESET_PLAYER_ARREST_STATE, player);

to reset you player :).

 

 

 

 

 

 

Hey guys!

 

I made some small additions to the code (most of it was mentioned here).

 

Before:

>You die

>Script detects death

>Make screen grainy, black and white with slomo

>Start wasted sounds

>Show 'wasted' text

>Fade out

>Remove black and white

>Stop wasted sounds

>Respawn

>Fade in

 

After:

>You die

>Script detects death

>Make screen grainy, black and white without slomo

>Start wasted sounds

>(Couldn't get BigMessageThread to work somehow, can anyone tell me what I need for this? :))

>Fade out (faster)

>Remove all peds in a specified radius (if you want to keep your peds, comment it out or remove it)

>Stop wasted sounds

>Remove all screen effects and (just to be sure) slomo

>Respawn

>Give player the ability to use his/her HUD and menus again (weapon wheel not working? :( Well that's weird, got it working again. Need to reproduce for a possible fix)

>Fade in

 

Just wanted to mention that the video lags for like the first 10 seconds :D

https://youtu.be/sXgHFjGF8Hw

 

 

Here is the code:

if (player.IsDead)                {                    Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller");                    player = Game.Player.Character;                    Function.Call(Hash.NETWORK_REQUEST_CONTROL_OF_ENTITY, player);                    Function.Call(Hash.NETWORK_RESURRECT_LOCAL_PLAYER, player.Position.X, player.Position.Y, player.Position.Z, 0.0, 0.0, 0.0);                    Function.Call(Hash.IGNORE_NEXT_RESTART, true);                    Function.Call(Hash.SET_PED_TO_RAGDOLL, player, 10000, 10000, 0, 0, 0, 0);                    player.IsInvincible = true;                    int s = Audio.PlaySoundFrontend("ScreenFlash", "MissionFailedSounds");                    int s1 = Audio.PlaySoundFrontend("Bed", "WastedSounds");                    while (!Audio.HasSoundFinished(s)) Wait(100);                    int s2 = Audio.PlaySoundFrontend("TextHit", "WastedSounds");                    Function.Call(Hash._START_SCREEN_EFFECT, "DeathFailOut", 10000, true);                    Game.TimeScale = 1.0f;                    //BigMessageThread.MessageInstance.ShowMissionPassedMessage("~r~wasted", 5000);                    Game.FadeScreenOut(2000);                    Wait(2500);                    Function.Call(Hash._STOP_ALL_SCREEN_EFFECTS);                    foreach(Ped j in World.GetNearbyPeds(player, 64.0f))                    {                        j.Delete();                    }                    Game.TimeScale = 1.0f;                    Audio.StopSound(s);                    Audio.StopSound(s1);                    Audio.StopSound(s2);                    Audio.ReleaseSound(s);                    Audio.ReleaseSound(s1);                    Audio.ReleaseSound(s2);                    Function.Call(Hash.NETWORK_REQUEST_CONTROL_OF_ENTITY, player);                    Function.Call(Hash.NETWORK_RESURRECT_LOCAL_PLAYER, player.Position.X, player.Position.Y, player.Position.Z, 0.0, 0.0, 0.0);                    Function.Call(Hash.IGNORE_NEXT_RESTART, true);                    Function.Call(Hash._RESET_LOCALPLAYER_STATE);                    Function.Call(Hash.RESET_PLAYER_ARREST_STATE, player);                    player.IsInvincible = false;                    Game.FadeScreenIn(2000);                }

 

 

You need NativeUI to show big message. Otherwise you need to make yourself another class : script to do it.

 

 

Okay, I'll try to implement NativeUI, had problems with it.

The log said that it was missing the reference even though the reference was in VS and NativeUI.dll was in "/scripts".

Even did the "using NativeUI;" thing.

Edited by ShadowTV

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.


  • 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.