Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Spectre first person executions script error #910

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

NachosChipeados
Copy link
Contributor

@NachosChipeados NachosChipeados commented Nov 30, 2024

Fixes R2Northstar/Northstar#418 and the Spectre part of #885.

The reason this happens is because the fp executions code tries to find the "head" bodygroup, but Spectres have "removableHead" instead, so i fixed it by:

  1. Decompiling the Spectre model
  2. Renaming the "removableHead" bodygroup to "head"
  3. Replacing every instance in code of "removableHead" when referencing Spectres. The new code checks for "head" first, and then falls back to "removableHead" if it doesn't find it, so it shouldn't cause any issues if someone disables Northstar.Custom or uses a Spectre model that doesn't have this change
Titanfall.2.2024-11-30.10-21-29.mp4

-cl_spectre.nut was taken from englishclient_mp_common.vpk
-_ai_spectre.gnut was taken from englishclient_sp_timeshift_spoke02.vpk ( but it should be in any sp vpk )

I'd also like to note that Stalkers technically should have this issue as well, but we can't execute them so it doesn't really matter

@github-actions github-actions bot added needs testing Changes from the PR still need to be tested needs code review Changes from PR still need to be reviewed in code labels Nov 30, 2024
@ASpoonPlaysGames
Copy link
Contributor

ASpoonPlaysGames commented Nov 30, 2024

Would it not be simpler to make our execution code fall back on removeableHead if head isn't found? (And thus not need the rest of the changes)

@NachosChipeados
Copy link
Contributor Author

Would it not be simpler to make our execution code fall back on removeableHead if head isn't found? (And thus not need the rest of the changes)

Already thought about that, but i couldn't think of a good way to do it

@ASpoonPlaysGames
Copy link
Contributor

ASpoonPlaysGames commented Nov 30, 2024

Potentially replace FORCE1P_PILOT_1P_HIDDEN_BODYGROUP with an array where we iterate over it and hide any bodygroups that we find?

@NachosChipeados
Copy link
Contributor Author

where we iterate over it and hide any bodygroups that we find?

but thats the problem, we can't just tell it to hide any bodygroups because if the npc doesn't have them, we just run into the same issue again

Titanfall.2.2024-12-01.22-32-19.mp4

Here, i got an error because grunts don't have "removableHead"

	array<string> hiddenBodygroupsArray = [ "head", "removableHead" ]

	foreach ( hiddenBodygroup in hiddenBodygroupsArray )
	{
		int bodygroupValue = 1
		if ( hiddenBodygroup == "torso" )
			bodygroupValue = 2
	
		// hide annoying bodygroup
		ownerProxy.SetBodygroup( ownerProxy.FindBodyGroup( hiddenBodygroup ), bodygroupValue )
		// don't play anim until later so we can do cleanup stuff
	}

I think there's definitely a better way to handle this entire thing, but i have no idea how else to do it

@ASpoonPlaysGames
Copy link
Contributor

Copied from discord: https://discord.com/channels/920776187884732556/950322078945538058/1313222452683210825

@NachosChipeados re: #910
FindBodygroup returns -1 if the bodygroup doesnt exist

Could probably fairly easily prevent this code from crashing at all by checking the return value before trying to set the bodygroup, combined with the stuff I suggested should make a fairly robust way of doing this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs code review Changes from PR still need to be reviewed in code needs testing Changes from the PR still need to be tested
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

Hacking NPC enemys with 1st person executions
2 participants