Guard Still Dead

I see in the video if you save after the guard dies, you can load later and still have the guard dead when you play again.

But if you do the opposite, save before the guard dies, then kill a guard and load, the guard is still dead when it should be alive.

Not sure what my question is, other than I guess is this addressed later in the course?

I do believe we fix this later on but give me a shout if thats not the case and i can take another look and prompt the team to look at a potential hole in the system
Although i wonder how its saving that the guard is dead as i dont remember causing a sav on killing an enemy so it shouldnt have updated the file

Run a test for me as well making sure you delete the save file and try it to see if something was hanging over (Incidentally you may get annoyed at having to delete the save file so often so i recommend right near the state adding a delete method binded to the D key as well. Sam doe sit later but it help stop the crazies!)

Let me know on this :slight_smile:

1 Like

OK I added an else to RestoreState in the health script, it seems to work. Basically it checks for all situations when the saved health value is not 0, then it checks if the “isDead” bool is true. If true it resets the “death” and “cancelAtack” triggers in the animator and triggers a new trigger called “LoadLife”. This trigger makes a transition from Any State to Locomotion.

public void RestoreState(object state)
        {
            healthNum = (float)state;

            if (healthNum==0)
            {
                Die();
            }

            else
            {
                if (isDead==true)
                {
                    GetComponent<Animator>().ResetTrigger("death");
                    GetComponent<Animator>().ResetTrigger("cancelAttack");
                    GetComponent<Animator>().SetTrigger("loadLife");
                    
                    isDead = false;
                }
                
            }
        }
3 Likes

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms