0
Answered

How to kill a non-humanoid character

Bruv 4 months ago in Melee updated by Sam Leitch 4 months ago 16

I am still trying to kill my damned spider. So, is GC totally not suitable for non-humanoid characters? Or is there some alternative function/condition/trigger setup I could use to effectively kill my spider enemy when its health reaches zero? I don't need the model to ragdoll because I already have a die.anim. I just need an "isdead" type function or functions that will release the target from all control and just leave it......dead! This is very frustrating because spiders are an integral part of my game. Please help!

Unity version:
2020.1
Game Creator version:
1.8.1
GOOD, I'M SATISFIED

This is a really good community. In this situation I more or less figured it out myself in the end, but I couldn't have done it without the pointers and advice I received in the forum. Than you.

Satisfaction mark by Bruv 4 months ago

how is your spider controlled? is it using A.I (which system) or keyboard controlls? You could just deactivate scripts and components on death or when the spider has finished playing the death animation for example it is now on its back, then you could just swop out that model for another which has no scripts on it. There are many ways to achieve this, so explain how your system is working.

I'm using GC AI. I use a custom state with my spider walk, run, and idle animations added, and I use a "character do gesture" action in my Behaviour for the Death animation when the health drops to zero. I can get the spider to patrol, see the player and respond by targeting and following the player, and my player can attack, reduce the spider health to zero and the die gesture then happens. The problem is, the best I can get it to do after the death animation is to still follow the player by sliding along on its back. I might be able to destroy the spider game object but I think that just caused a lot of errors. Thank you for replying. I should just add, I'm no good at coding. I was hoping to do this with the "no coding required" options :)

I'm going to try to add a screenshot of my Behaviour screen if it helps.

I will have to try it myself, but how about disabling can use navigation mesh on the spider after death.

Wow! That sounds like a good idea. I'll try it as soon as I can. I'll get back to you. Thank you for the suggestion.

For the life of me I can't figure out a way, using actions or conditions, to disable the Spider's "can use navigation mesh"?

what if you check for the spiders life points are above zero, and then do all the AI stuff? It looks like you already do something with the health atribute...

I have used the health attribute to check if the health is zero and then called a variable to start the die actions. Again I will post a couple of screen shots. The first is the workings of the "Is it Dead" node seen above. Note - the second condition below is the invoker health check.

The next screenshot is the Death "ActionsDie" sequence.


Note: The 3rd Action above is the invoker do gesture action to play the die animation. I thought I'd done as much as I could to "stop' the spider model by Cancelling the Actions and Force stopping the character's Behaviour but it still doesn't work. I think what I need is a sort of "GenericIsDead" function to replace Ragdoll for the generic non-human modules. Or am I wasting my time? Doing it all wrong? Any help would be very much appreciated. (Sorry to ramble on).

Ok, that's the code to let the spider die. it seems ok to me, nothing that i would not do, maybe the spider does not need to "see" the player for to die, but that is not part of the problem, just a remark.

Now, how looks the code to make the spider folloe the player? Do jou check there for the spiders health, so it only follows if its health is above zero / alive?

Answered

You can use the Task on the left from Bruv and use the "Stop Follow" Action when the spider is dead, and use the "Follow Character" if the spider is not dead and can see the player. This should resolve this last problem.

I've just had success after many hours fiddling. I had to do two things. My "die.anim" clip was too short and I just could not stop it looping for some reason. Some time ago I bought Umotion Pro in a sale but I hadn't used it. I managed to use it to copy/paste the last bit of the animation until I had a six second clip. With this I made a Custom State and changed the actions in my ActionsDie object.



This now works really well and the dead spider lies on the battlefield for 30 seconds and then its gone. Now I just have to figure out how my spider can use melee actions against the Player so it becomes a real fight. Lots to do. Thank you all for your suggestions and pointers :).

This has been super helpful for me. Cheers people!

Wondering if you were going to instance loot or get experience from the spider.

I got my Boar working/dying but im struggling to be able to loot from it.

If you cannot stop your animation clip looping because it is all greyed out, then just duplicate that clip and now you can switch off looping and use this new copy instead.

Thanks. I'll remember that if it crops up again. I think I'll leave my "SpiderDie" state as it is for now - it's working thank goodness. Now I'm really struggling to get my spider to inflict damage on the Player. Ah well, I'll keep at it. Something will eventually work :).

The way I make my monsters damage my player is pretty simple.

Grab the free distance module, then when the spider is less than the set distance to the player you can reduce the players health at the same time as you play a gesture for the attack.

Doesn't always look great though.

Right, no reason that won't work! What distance module you use?

Example distance tool by Wes McDermott