Jump to content

How kill "non-killable" NPCs?


HughJanus
 Share

Recommended Posts

28 minutes ago, Terry13143 said:

Maybe you can try this

 

 

I already tried this:

ENTITY::SET_ENTITY_CAN_BE_DAMAGED_BY_RELATIONSHIP_GROUP(ped, true, PED::GET_RELATIONSHIP_BETWEEN_PEDS(playerPed, ped));

 

But it didnt work. Do you know which int to put as the last parameter?

Link to comment
Share on other sites

It depends on the NPC. For most of them, changing yours or their relationship group or the relationship between groups is enough. For some, such as kids, it requires (at least according to my testing) some binary patching.

Link to comment
Share on other sites

5 hours ago, LMS said:

It depends on the NPC. For most of them, changing yours or their relationship group or the relationship between groups is enough. For some, such as kids, it requires (at least according to my testing) some binary patching.

 

Thats what I tried with ENTITY::SET_ENTITY_CAN_BE_DAMAGED_BY_RELATIONSHIP_GROUP(ped, true, PED::GET_RELATIONSHIP_BETWEEN_PEDS(playerPed, ped));

How is it supposed to be done?

Link to comment
Share on other sites

@LMS But how? I have tried these already:

 

if (PED::GET_RELATIONSHIP_BETWEEN_PEDS(playerPed, peds[i]) == 0) PED::SET_RELATIONSHIP_BETWEEN_GROUPS(255, PED::GET_PED_RELATIONSHIP_GROUP_HASH(playerPed), PED::GET_PED_RELATIONSHIP_GROUP_HASH(peds[i]));
if (PED::GET_RELATIONSHIP_BETWEEN_PEDS(playerPed, peds[i]) == 0)
{
	PED::CLEAR_RELATIONSHIP_BETWEEN_GROUPS(0, PED::GET_PED_RELATIONSHIP_GROUP_HASH(playerPed), PED::GET_PED_RELATIONSHIP_GROUP_HASH(peds[i]));
	PED::SET_RELATIONSHIP_BETWEEN_GROUPS(255, PED::GET_PED_RELATIONSHIP_GROUP_HASH(playerPed), PED::GET_PED_RELATIONSHIP_GROUP_HASH(peds[i]));
}
if (PED::GET_RELATIONSHIP_BETWEEN_PEDS(playerPed, peds[i]) == 0)
{
	PED::CLEAR_RELATIONSHIP_BETWEEN_GROUPS(0, PED::GET_PED_RELATIONSHIP_GROUP_HASH(playerPed), PED::GET_PED_RELATIONSHIP_GROUP_HASH(peds[i]));
	PED::SET_RELATIONSHIP_BETWEEN_GROUPS(255, PED::GET_PED_RELATIONSHIP_GROUP_HASH(playerPed), PED::GET_PED_RELATIONSHIP_GROUP_HASH(peds[i]));
	ENTITY::SET_ENTITY_CAN_BE_DAMAGED_BY_RELATIONSHIP_GROUP(peds[i], true, PED::GET_RELATIONSHIP_BETWEEN_PEDS(peds[i], playerPed));
}

 

I have done testing on what the relationships are. They seem to have stayed the same as in the GTA 5 documentation:

0 = Companion

1 = Respect

2 = Like

3 = Neutral

4 = Dislike

5 = Hate

255 = Pedestrians

 

None of my above solutions allowed me to hurt gang members.

Link to comment
Share on other sites

I have not messed with gang members, but to be able to shoot cops it worked when changing relationship between REL_PLAYER and REL_COP or by changing the player relationship group or the cop relationship group via SET_PED_RELATIONSHIP_GROUP_HASH. Have you tried that one?

Link to comment
Share on other sites

On 8/12/2020 at 11:36 PM, LMS said:

I have not messed with gang members, but to be able to shoot cops it worked when changing relationship between REL_PLAYER and REL_COP or by changing the player relationship group or the cop relationship group via SET_PED_RELATIONSHIP_GROUP_HASH. Have you tried that one?

 

No, havent tried this one yet. I hoped to achieve that only the player can harm certain NPCs and change no other relationships. I dont know what it would do if I e.g. put the player in a different group or the gang in a different group. I suppose that would cause a high risk for behavioral bugs.

How do you know the names REL_PLAYER and REL_COP and where do you put them? They dont count as group hashes, I suppose?

Do you have any other group names?

Link to comment
Share on other sites

You can find all the default information in update/common/data/relationships.meta including all groups and their relationships. Since you set the relationship group per ped, it is definitely worth trying to work with it. We did it for RDRFR and it seems fine for the most part.

  • Like 1
Link to comment
Share on other sites

So, I have given it another try. The relationship stuff seems to work. I set the relationship between the player and the van der linde gang to respected (in both ways).

Now if I aim at a gang member, they become aggressive and start shooting after a while. Yet I still cant pull the trigger when aiming at them. There seems to be something else blocking me from targetting them. I can hurt them with dynamite if I throw it close enough, but I can never aim at them and pull the trigger.

More testing will be required to solve this. I will keep you updated.

 

Edit: all the natives with "target" in them didnt work. I searched the GTA 5 natives for clues and found "SET_CAN_ATTACK_FRIENDLY" (https://runtime.fivem.net/doc/natives/?_0xB3B1CB349FF9C75D). Maybe this is the method to use? We havent found that one in RDR2 yet, unfortunately.

 

Edited by HughJanus
Link to comment
Share on other sites

  • 9 months later...
On 6/17/2021 at 12:49 PM, Aztec2012 said:

Any news about this?

 

This is how we did it (only for Van Der Linde gang):

if (friendlyfirebool)
{
	if (PED::GET_RELATIONSHIP_BETWEEN_GROUPS(GAMEPLAY::GET_HASH_KEY("PLAYER"), GAMEPLAY::GET_HASH_KEY("REL_GANG_DUTCHS")) == 2)
	{
		PED::SET_RELATIONSHIP_BETWEEN_GROUPS(0, GAMEPLAY::GET_HASH_KEY("PLAYER"), GAMEPLAY::GET_HASH_KEY("REL_GANG_DUTCHS"));
		PED::SET_RELATIONSHIP_BETWEEN_GROUPS(0, GAMEPLAY::GET_HASH_KEY("REL_GANG_DUTCHS"), GAMEPLAY::GET_HASH_KEY("PLAYER"));
	}
}
else if (!ffchangeexecuted)
{
	if (PED::GET_RELATIONSHIP_BETWEEN_GROUPS(GAMEPLAY::GET_HASH_KEY("PLAYER"), GAMEPLAY::GET_HASH_KEY("REL_GANG_DUTCHS")) != 2)
	{
		PED::SET_RELATIONSHIP_BETWEEN_GROUPS(2, GAMEPLAY::GET_HASH_KEY("PLAYER"), GAMEPLAY::GET_HASH_KEY("REL_GANG_DUTCHS"));
		PED::SET_RELATIONSHIP_BETWEEN_GROUPS(2, GAMEPLAY::GET_HASH_KEY("REL_GANG_DUTCHS"), GAMEPLAY::GET_HASH_KEY("PLAYER"));
	}
	ffchangeexecuted = true;
}

 

friendlyfirebool is the bool for indicating the features activation.

Since we have a toggle key for the feature, the key press affects a bool called ffchangeexecuted, so if friendly fire is disabled, you only set the setting back to standard once (and not each script iteration).

Link to comment
Share on other sites

1 hour ago, HughJanus said:

 

This is how we did it (only for Van Der Linde gang):


if (friendlyfirebool)
{
	if (PED::GET_RELATIONSHIP_BETWEEN_GROUPS(GAMEPLAY::GET_HASH_KEY("PLAYER"), GAMEPLAY::GET_HASH_KEY("REL_GANG_DUTCHS")) == 2)
	{
		PED::SET_RELATIONSHIP_BETWEEN_GROUPS(0, GAMEPLAY::GET_HASH_KEY("PLAYER"), GAMEPLAY::GET_HASH_KEY("REL_GANG_DUTCHS"));
		PED::SET_RELATIONSHIP_BETWEEN_GROUPS(0, GAMEPLAY::GET_HASH_KEY("REL_GANG_DUTCHS"), GAMEPLAY::GET_HASH_KEY("PLAYER"));
	}
}
else if (!ffchangeexecuted)
{
	if (PED::GET_RELATIONSHIP_BETWEEN_GROUPS(GAMEPLAY::GET_HASH_KEY("PLAYER"), GAMEPLAY::GET_HASH_KEY("REL_GANG_DUTCHS")) != 2)
	{
		PED::SET_RELATIONSHIP_BETWEEN_GROUPS(2, GAMEPLAY::GET_HASH_KEY("PLAYER"), GAMEPLAY::GET_HASH_KEY("REL_GANG_DUTCHS"));
		PED::SET_RELATIONSHIP_BETWEEN_GROUPS(2, GAMEPLAY::GET_HASH_KEY("REL_GANG_DUTCHS"), GAMEPLAY::GET_HASH_KEY("PLAYER"));
	}
	ffchangeexecuted = true;
}

 

friendlyfirebool is the bool for indicating the features activation.

Since we have a toggle key for the feature, the key press affects a bool called ffchangeexecuted, so if friendly fire is disabled, you only set the setting back to standard once (and not each script iteration).

 

I see. May be by adding some lines with other REL groups like REL_PLAYER_ALLY, REL_COMPANION_GROUP and some others we can make it working for all npcs? But i dont know how to implemet this script in to game.

Edited by Aztec2012
Link to comment
Share on other sites

On 6/22/2021 at 12:09 PM, Aztec2012 said:

And i found file metapeds.ymt This file contains rel group for every npc in game. We can swap a hash walyes of this gropus between story and regular character if it works in game.

 

I dont know, you would have to try.

Link to comment
Share on other sites

  • 5 months later...
15 hours ago, JustGotRdr2 said:

Im not good with coding and stuff so is their like a tutorial i can use or is there steps someone can tell me?

 

There are a few good GTA 5 modding tutorials on youtube. They apply to RDR2 as well.

Here are some videos I started with almost two years ago:

https://www.youtube.com/watch?v=Oc16GjTfztQ

https://www.youtube.com/watch?v=pCIfZh0Lni4

 

Link to comment
Share on other sites

  • 2 months later...

you can not kill children in this game how ever im pretty shure there is a mod that lets you kill kids but to kill gang member use the PDO mod and turn on friendly fire or if you cant mod very well get  dynamite or molotavs and throw it next to someone in your gang

 

Link to comment
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.

 Share

×
×
  • Create New...