wesleywh / EasyMultiplayer-Invector

Where to submit issues for "Easy Multiplayer - Invector" suite of packages that is available via GumRoad or the Unity Asset Store. GUMROAD: https://cyberbulletgames.gumroad.com/ ASSET STORE: https://assetstore.unity.com/publishers/34070
0 stars 0 forks source link

Player stays locked on after getting killed #9

Closed AmmarTee closed 2 years ago

AmmarTee commented 2 years ago

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

wesleywh commented 2 years ago

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 commented 2 years ago

Got it thanks I'll check and inform

AmmarTee commented 2 years ago

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 commented 2 years ago

"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 commented 2 years ago

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 commented 2 years ago

Alright perfect I love your dedication.

Thank you wes ❤️

wesleywh commented 2 years ago

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:

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?)