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

Player stays locked on after getting killed #9

Closed
AmmarTee opened this issue Apr 12, 2022 · 7 comments
Closed

Player stays locked on after getting killed #9

AmmarTee opened this issue Apr 12, 2022 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@AmmarTee
Copy link

In melee fighting when a player is fighting with the lock on and get's killed they just get bugged with the lock on,

I need to be able to disable the Lockon when player dies

@AmmarTee AmmarTee added the bug Something isn't working label Apr 12, 2022
@wesleywh
Copy link
Owner

Please fill out the ticket items I have put in here. That makes it so I don't have to keep asking a million annoying questions about what version of unity your running, the version of mirror, etc. This just gets me really frustrated. Just please spend the time filling out the ticket properly next time...

With that said I guessed on your setup and tried to mimic the behavior. I'm also going to guess you're running mirror version 55.3.8 and unity 2019.4 because you didn't include any of this information. I'm also going to guess you're running windows and not mac or linux for your builds. As this particular report makes it seem like it wouldn't be a build version issue. Gonna guess its not. Also going to guess you're running a supported version of invector 2.6.1b.

You mentioned "melee" in your comment so I'm also going to guess you're talking about melee based characters and not shooter based characters (which means MP_vLockOn component? eh, I'll probably check both). Could be wrong about that but, hey, you didn't fill out the ticket so I have to guess...

Here is what I did:
In MP_vLockOn and MP_vLockOnShooter, I added the following in the start method:

GetComponent<vThirdPersonController>().onDead.AddListener(OnDead);

Then added the new function:

protected virtual void OnDead(GameObject obj)
{
            if (IsLockedOn())
            {
                LockOn(false);
            }
 }

All of the above takes care of the problem when you are targeting someone and you die. What about when you are targeting someone and that someone dies? The following addition will solve that by unlocking when you kill that target. Obviously modify to your needs.

In the protected override Transform target's set add the following (included some lines to help locate):

_target = value;
if (_target != null)
    _target.GetComponent<vThirdPersonController>().onDead.AddListener(TargetDied);
if (NetworkClient.active && nc && nc.hasAuthority)
{
  ...
  ...

While digging around for the above fix I also noticed that the icon would display for none owned characters targets. To prevent this add the following to the two above meantioned scripts:

protected override void UpdateAimImage()
{
            if (nc.hasAuthority)
                base.UpdateAimImage();
}

The above doesn't solve all of the problems but was what I was able to find for today. Will keep looking at this tomorrow.

@AmmarTee
Copy link
Author

Got it thanks I'll check and inform

@AmmarTee
Copy link
Author

AmmarTee commented Apr 13, 2022

I am sorry I did not mention:

I am using EMI v 0.3.5
Unity 2020.3.27f1
I want to free Lockon from Melee Fighting only However I am using the following script
I am using Windows + Mac for the builds

This clearly does not help me understand can you be more specific about what is "TargetDied" and what do I need to get the Thrid person controller from?

https://pastebin.com/NwUjyrCA

@AmmarTee
Copy link
Author

AmmarTee commented Apr 13, 2022

"TargetDied" is not recognized in this script

Assets\CBGames\EasyMultiplayer-Invector\Melee Combat\Scripts\Player\MP_vLockOn.cs(44,81): error CS0103: The name 'TargetDied' does not exist in the current context

@wesleywh
Copy link
Owner

All the above code has changed dramatically as of today anyway, just ignore it. I fixed your original above problem. I identified an edge case scenario during my final phase testing. I will fix that tomorrow as well. As long as I don't find anything else I can work on a release.

There was simply too many changes. I wrote new virtual methods, and additional overrides. This also included new ClientRpc and Command methods. It expands over 4 different files. I figured that's just too complicated to explain here. Just wait for the final fix.

@AmmarTee
Copy link
Author

Alright perfect I love your dedication.

Thank you wes ❤️

@wesleywh
Copy link
Owner

wesleywh commented Apr 15, 2022

Okay this one was really difficult to fully track down. I really went down the rabbit hole on this one. Here are all the issues I solved. Some of these were with invectors code(I just coded around them) and some were bugs in my code:

  • When already in strafe leaving strafe animation when targeting and never able to properly enter strafe animation's again unless you try and dry target
    • Now it will automatically reconcile and properly fix the strafe animation states
  • Targeting indicators visible to other clients
    • Now it is only visible to the owner and no one else
  • When late entering a match all target indicators were visible (fixed by above bullet point)
  • When dying you still targeted (creating permanent targeting), now you will un-target the object that was killed or if you were killed.

While I did cleanup the code a lot from yesterdays monstrosity it is still too complicated to manually implement properly. Just wait for the next release to fix this (v0.3.6?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants