Jump to content

[SOLVED] How to find out if I have an NPC on lasso? [C++ Scripting]


HughJanus
 Share

Recommended Posts

Hey guys,

 

I want to disarm NPCs when I got them lasso-ed automatically, but I havent found out yet how to determine wheter I got an NPC lasso-ed or not.

Can anyone give some advice?

 

BR

HJ

Edited by HughJanus
Link to comment
Share on other sites

Are animation names or IDs known yet? Cant seem to find them.

Or was this just a general hint?

 

Edit:

I found a mod online which uses C# code to do something similar (source: https://www.nexusmods.com/reddeadredemption2/mods/155)

I adapted the code a little and used the following:

Player player = PLAYER::PLAYER_ID();
Ped playerPed = PLAYER::PLAYER_PED_ID();
Entity target = playerPed;
Hash lassoHash = GAMEPLAY::GET_HASH_KEY("WEAPON_LASSO");

if (WEAPON::HAS_PED_GOT_WEAPON(playerPed, lassoHash, 0, 0))
{
	Hash lassoHash2;
	if (WEAPON::GET_CURRENT_PED_WEAPON(playerPed, &lassoHash2, 1, 0, false))
	{
		if (lassoHash == lassoHash2)
		{
			if (target != playerPed)
			{
				//DO SOMETHING WITH LASSO-ED PED
			}
			if (PED::IS_PED_SHOOTING(playerPed))
			{
				Entity playerTarget;
				if (PLAYER::GET_ENTITY_PLAYER_IS_FREE_AIMING_AT(player, &playerTarget))
				{
					target = playerTarget;
				}
			}
		}
	}
}

 

Edited by HughJanus
new information, typo
  • Like 1
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...