|
Post by dakurlz on Nov 9, 2018 14:00:15 GMT
Sorry, if this thread will be created before, but i can find answer. I am using FPS shooter and AI from Invector, but i can find solution how apply damage to AI bot (shooter or melee) I find function col.gameobject.ApplyDamage(damage, ???) and i don't know that i must write here. Can someone give me a bit of code or script with this function (something like triger, and when NPC enter we are give him damage) Thanks!
|
|
|
Post by komposite on Nov 9, 2018 15:26:00 GMT
Did you tried to look at the demo scene ? You have a lot of information on how things works in it. Find one that match (or one close to) want you want to achieve, and look at the prefab as well, it's a great addition to the documentation. But usually, if you want to apply damage, your AI need to have a melee manager script.
|
|
|
Post by shadex on Nov 10, 2018 9:54:40 GMT
Sorry, if this thread will be created before, but i can find answer. I am using FPS shooter and AI from Invector, but i can find solution how apply damage to AI bot (shooter or melee) I find function col.gameobject.ApplyDamage(damage, ???) and i don't know that i must write here. Can someone give me a bit of code or script with this function (something like triger, and when NPC enter we are give him damage) Thanks! There is a standalone component vObjectDamage. Attach that to anything with a collider and it will do damage (you can choose by trigger or collision). There is also a standalone health component as well. Anyways, the code def is :
public static void ApplyDamage(this GameObject receiver, vDamage damage)
It takes a Gameobject (enemy or player) and it takes the damage numbers. But honestly, it's MUCH easier to just use vObjectDamage on the object that is causing the damage.
|
|