|
Post by Jader on Nov 12, 2018 10:49:08 GMT
Yes you should apply the script to your enemy Then in the collectable item field put your collectable there... Then on the events tap of the AI shooter controller in the On Dead ( GameObject) Assign your enemyprefab and the function tab select Drop() Hit play and it should work if you typed the script correctly... Only problem I ran into is that at the moment it does not drop on stealth kill... I haven't tested the stealth kill, but I think it not calling the main OnDead event. Maybe you need to create a function to call Drop() inside the stealth kill script...
|
|
|
Post by sjl on Nov 12, 2018 19:08:28 GMT
Yes you should apply the script to your enemy Then in the collectable item field put your collectable there... Then on the events tap of the AI shooter controller in the On Dead ( GameObject) Assign your enemyprefab and the function tab select Drop() Hit play and it should work if you typed the script correctly... Only problem I ran into is that at the moment it does not drop on stealth kill... I haven't tested the stealth kill, but I think it not calling the main OnDead event. Maybe you need to create a function to call Drop() inside the stealth kill script... Before I tried out the drop script the stealth kill for me is more a choke hold till the enemy passes out which is cool but the enemy never actually dies so once the animation is completed I have to melee attack his capsule collider then the enemy will stand up and then do the death animation again and then drop the item but if killed with out the stealth kill it drops perfectly... Have not quite figured out what's wrong on my stealth kill yet but pretty cool to choke out the enemy but now if I could think of a way to put a timer for him to wake up lol...
|
|
|
Post by Jader on Nov 13, 2018 17:02:10 GMT
Hummm ... You can create a condition for the transition to wakeup animation... Try this: using UnityEngine;
public class unconsciousTimer : MonoBehaviour{
public Animator animator; public float timeToWakeup;
void Start(){
if(animator == null) animator = GetComponent<Animator>();
}
public IEnumerator CountTime(){
animator.SetBool("CanWakeUp", false); yield return new WaitForSeconds(Random.Range(timeToWakeup * 1.25f, timeToWakeup * 0.75f)); animator.SetBool("CanWakeUp", true);
} } Make a bool in the animator controller called "CanWakeUp", then use her as condition to the transition to a wakeup animation. You need to call the "CountTime()" sometime before the enemy falls. I don't know if the stealth script has an event system, but you can also create a animation event... I made a small random variation in "timeToWakeup" to be more organic. If you don't want this, change this line: yield return new WaitForSeconds(Random.Range(timeToWakeup * 1.25f, timeToWakeup * 0.75f)); To this: yield return new WaitForSeconds(timeToWakeup); Test it and tell me if it worked
|
|
|
Post by sjl on Nov 14, 2018 7:56:35 GMT
Hummm ... You can create a condition for the transition to wakeup animation... Try this: using UnityEngine;
public class unconsciousTimer : MonoBehaviour{
public Animator animator; public float timeToWakeup;
void Start(){
if(animator == null) animator = GetComponent<Animator>();
}
public IEnumerator CountTime(){
animator.SetBool("CanWakeUp", false); yield return new WaitForSeconds(Random.Range(timeToWakeup * 1.25f, timeToWakeup * 0.75f)); animator.SetBool("CanWakeUp", true);
} } Make a bool in the animator controller called "CanWakeUp", then use her as condition to the transition to a wakeup animation. You need to call the "CountTime()" sometime before the enemy falls. I don't know if the stealth script has an event system, but you can also create a animation event... I made a small random variation in "timeToWakeup" to be more organic. If you don't want this, change this line: yield return new WaitForSeconds(Random.Range(timeToWakeup * 1.25f, timeToWakeup * 0.75f)); To this: yield return new WaitForSeconds(timeToWakeup); Test it and tell me if it worked OK thanks I'm going to try it now
|
|
|
Post by sjl on Nov 20, 2018 7:39:53 GMT
Hummm ... You can create a condition for the transition to wakeup animation... Try this: using UnityEngine;
public class unconsciousTimer : MonoBehaviour{
public Animator animator; public float timeToWakeup;
void Start(){
if(animator == null) animator = GetComponent<Animator>();
}
public IEnumerator CountTime(){
animator.SetBool("CanWakeUp", false); yield return new WaitForSeconds(Random.Range(timeToWakeup * 1.25f, timeToWakeup * 0.75f)); animator.SetBool("CanWakeUp", true);
} } Make a bool in the animator controller called "CanWakeUp", then use her as condition to the transition to a wakeup animation. You need to call the "CountTime()" sometime before the enemy falls. I don't know if the stealth script has an event system, but you can also create a animation event... I made a small random variation in "timeToWakeup" to be more organic. If you don't want this, change this line: yield return new WaitForSeconds(Random.Range(timeToWakeup * 1.25f, timeToWakeup * 0.75f)); To this: yield return new WaitForSeconds(timeToWakeup); Test it and tell me if it worked I was. Not able to get it to work but was able to find the issue of the stealth kill not working the problem was The AI controller under heath on dead the change AI health int would delete its self but now that's fixed now looking at your script I'm thinking of a way to make and option to give you the choice to choke AI till passes out or choke to death... Have not found a good way as of yet...
|
|
|
Post by Jader on Nov 20, 2018 17:56:51 GMT
It would be very good. If you just do the action, it just fall and wake in certain time. But if you hold the command for a while, he dies.
I think that a condition based on the Input.GetButton hold time, in which it determines the way between choked or dead...
But I don't know how to do this other than by trial and error, how I'm at work (for a change), I can'tt do it here
|
|
|
Post by sjl on Feb 9, 2019 7:37:27 GMT
It would be very good. If you just do the action, it just fall and wake in certain time. But if you hold the command for a while, he dies. I think that a condition based on the Input.GetButton hold time, in which it determines the way between choked or dead... But I don't know how to do this other than by trial and error, how I'm at work (for a change), I can'tt do it here Sorry I was not able to get that to work yet and would be away while in hold button your given option to kill or knock out the ai such as if using a controller player enters stealth kill trigger and press and hold the top left button that would trigger the grab and hold animation from there gives you two options either to kill or knock out the ai??
|
|