|
Post by digitalmedic on Oct 19, 2018 13:01:17 GMT
I have created a basic function in a StatManager class that is run on the AI OnDead event. It's very simple the OnDead event sends an ExpereincePoints Int value to that function and the experience points are added to the player. This all works fine.
My problem is that if the AI is killed by another AI or an environmental event, for example the Invector Red Flaming barrel in one of the example scenes explodes when it is knocked over, my AI walks into this barrel and knocks it over and it kills him. This then awards the player experience which I don't want.
How can i tell if it was the player who kills the AI?
|
|
|
Post by shadex on Oct 28, 2018 2:49:53 GMT
I have created a basic function in a StatManager class that is run on the AI OnDead event. It's very simple the OnDead event sends an ExpereincePoints Int value to that function and the experience points are added to the player. This all works fine.
My problem is that if the AI is killed by another AI or an environmental event, for example the Invector Red Flaming barrel in one of the example scenes explodes when it is knocked over, my AI walks into this barrel and knocks it over and it kills him. This then awards the player experience which I don't want.
How can i tell if it was the player who kills the AI?
Your going to need to find a way to figure out who hit last on death, and assign them the XP. Not sure if OnDead takes an opponents gameobject, but if it does, you can just search for the player or companion tag.
|
|
|
Post by sectuz on Oct 28, 2018 15:35:37 GMT
Use invectors vDamage class (edit or extrnd) by adding 1 more attribute containing type of damage. On damage, pass that parameter. On add experience function chceck if damage that coused death, is by done you.
If you use shooter you could use parameter on vptojectilecontroll, to set type of damage, you can use tjat parameter too
|
|