Quantcast

Jump to content

» «
Photo

Script hook dot net death script help

4 replies to this topic
bigguy
  • bigguy

    Player Hater

  • Members
  • Joined: 4 weeks ago
  • United-States

#1

Posted 4 weeks ago Edited by bigguy, 4 weeks ago.

Hey folks,

 

I know I made a thread yesterday about C++ scripting, but as a beginner I am trying to learn C# as well. Wasn't sure if I should place this in that thread or if I should create a new thread in here.

 

There is a script idea that I am trying to learn how to do. It is based off of the death script that the GTA DOJ role players recently introduced, that I would really like to have for my own game.

 

Basically I want the ability to get killed without going through the "wasted" screen.

 

1) A health variable

 

2) If I am hit by a weapon, I lose a certain amount of health.

 

3) if my health variable reaches 0, I go into ragdoll mode with the option to re-spawn and come back to life.

 

What I can't seem to find in the Script hook V dot net object browser, is an option to active ragdoll. I can see the Ped.CanRagdoll boolean, found the Ped.IsRagdoll boolean, which is a read-only variable. How do I activate ragdoll mode?

 

I hate to ask for a complete script, but I have looked around youtube videos, the wiki, and tried to download mods(but source code is usually hidden) without much like, so if anyone is bored, any code would be appreciated.

 

Thanks!


Bob_74
  • Bob_74

    Crackhead

  • Members
  • Joined: 05 Jan 2018
  • None

#2

Posted 4 weeks ago Edited by Bob_74, 4 weeks ago.

Well, I don't understand why but in SHVDN source code, we see ragdolls functions are implemented but I'm unable to call them using the API Oo

 

https://github.com/c...ds/Ped.cs#L1540

public void Ragdoll(int duration = -1, RagdollType ragdollType = RagdollType.Normal)
{
	CanRagdoll = true;
	Function.Call(Hash.SET_PED_TO_RAGDOLL, Handle, duration, duration, ragdollType, false, false, false);
}

public void CancelRagdoll()
{
	Function.Call(Hash.SET_PED_TO_RAGDOLL, Handle, 1, 1, 1, false, false, false);
}

So basically, you'd need to set Ped.CanRagdoll  to True and call SET_PED_TO_RAGDOLL as in the function.

 

Anyone can explain why the source code has some part the release doesn't? It has been added June 2016, i think I'm missing something...

 

EDIT: Nevermind, I was looking at SHVDN v3... The code above would still work though.

  • Jitnaught likes this

Jitnaught
  • Jitnaught

    Grass tastes bad

  • Members
  • Joined: 24 Aug 2013
  • United-States

#3

Posted 4 weeks ago

I know this doesn't help you with coding but I just wanted to let you know that there is a script available that does exactly what you want: https://www.gta5-mod...atch-your-death

  • OfficerJohnson likes this

bigguy
  • bigguy

    Player Hater

  • Members
  • Joined: 4 weeks ago
  • United-States

#4

Posted 4 weeks ago

I know this doesn't help you with coding but I just wanted to let you know that there is a script available that does exactly what you want: https://www.gta5-mod...atch-your-death

Interesting, will definitely have a look at it. Would still like to figure out how to do this on my own though, but thanks for the link.


OfficerJohnson
  • OfficerJohnson

    Crackhead

  • Members
  • Joined: 07 Jan 2018
  • United-States

#5

Posted 4 weeks ago

I know this doesn't help you with coding but I just wanted to let you know that there is a script available that does exactly what you want: https://www.gta5-mod...atch-your-death


Literally was about to suggest the same thing.

As for learning it, if it is DLL, you can use a .NET de compiler to find out what natives are being called and then see how they are used via NATIVEDB.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users