nick62
Junior vMember
Posts: 33
|
Post by nick62 on Jan 10, 2020 21:19:14 GMT
Hallo. I`am trying to setup radoll with invector AI. I have a proble with applying damage, because isActive is always false:
Do you have any idea, what is the problem? How can I apply a damage through ragdoll colliders?
|
|
nick62
Junior vMember
Posts: 33
|
Post by nick62 on Jan 11, 2020 22:36:19 GMT
I do not uderstand, why ragdoll can receive damage only when ragdoll isActive?
And else one question: Is it ok? In one method you use ragdoll.ApplyDamage and in another method - ragdoll.gameObject.ApplyDamage
|
|
|
Post by Invector on Jan 13, 2020 17:30:11 GMT
Make sure to uncheck the option "Disable Colliders" in the Ragdoll component to apply damage to each bodypart, as instructed in the tooltip
|
|
nick62
Junior vMember
Posts: 33
|
Post by nick62 on Jan 13, 2020 19:19:43 GMT
Ragdoll component Settings: My questions are about: 1. isActive check in ragdoll ApllyDamage (first post)
2. difference between ragdoll.ApplyDamage and ragdoll.gameObject.ApplyDamage in the second post.
Please read my posts and screenshots one more time. Thank you!
|
|
|
Post by Invector on Jan 13, 2020 22:50:20 GMT
You should always use the .gameObject.ApplyDamage, the other one we created a long time ago to apply damage via collision for impact, we no longer use that method and thanks for bringing that out, we will remove it on the next version so it's easier to understand
|
|
|
Post by Invector on Jan 13, 2020 22:51:15 GMT
I'm not sure what you're trying to do actually... is it to apply damage to the ragdoll via melee, shooter, generic?
|
|
nick62
Junior vMember
Posts: 33
|
Post by nick62 on Jan 14, 2020 20:04:23 GMT
I am using NPCs (Invector TPC + FSM AI) with third-party Player controller and try to setup ragdoll for NPCs. As I have understood from your last message there is a bug in: Assets\Invector-3rdPersonController\Basic Locomotion\Scripts\Ragdoll\vDamageReceiver.cs
method public void TakeDamage(vDamage damage), line 89
public void TakeDamage(vDamage damage) { if (!ragdoll) return; if (!ragdoll.iChar.isDead) { inAddDamage = true; float multiplier = (useRandomValues && !fixedValues) ? Random.Range(minDamageMultiplier, maxDamageMultiplier) : (useRandomValues && fixedValues) ? randomChange ? maxDamageMultiplier:minDamageMultiplier :damageMultiplier; if (overrideReactionID) { if (useRandomValues && !fixedValues) damage.reaction_id = Random.Range(minReactionID, maxReactionID); else if(useRandomValues && fixedValues) damage.reaction_id = randomChange ? maxReactionID:minReactionID; else damage.reaction_id = reactionID; }
var _damage = new vDamage(damage); var value = (float)_damage.damageValue; _damage.damageValue = (int)(value * multiplier); if (multiplier == maxDamageMultiplier) OnGetMaxValue.Invoke(); ragdoll.ApplyDamage(damage); // <=== BUG HERE ============================= onReceiveDamage.Invoke(_damage); Invoke("ResetAddDamage", 0.1f); } }
Am I right? When will you update this code in Unity AssetStore? Thank you!
|
|
|
Post by Invector on Jan 14, 2020 21:44:13 GMT
As I've mentioned before, you shouldn't use this... it was created to apply damage by impact back when we first developed the ragdoll, it's deprecated and it will be removed in the next update.
Use gameObject.ApplyDamage instead
|
|
nick62
Junior vMember
Posts: 33
|
Post by nick62 on Jan 15, 2020 19:52:53 GMT
Ok, I will wait for the next update and then check changes in vDamageReceiver.cs
|
|
nick62
Junior vMember
Posts: 33
|
Post by nick62 on Mar 21, 2020 22:53:25 GMT
As I've mentioned before, you shouldn't use this... it was created to apply damage by impact back when we first developed the ragdoll, it's deprecated and it will be removed in the next update. Use gameObject.ApplyDamage instead
Sorry, but this bug is still remaining in 2.5.0a
|
|
|
Post by Chronicman on Mar 22, 2020 2:33:43 GMT
change the “ragdoll” to “gameobject” and your good to go. Why are you still waiting ?????
|
|
|
Post by Invector on Mar 23, 2020 17:46:22 GMT
As I've mentioned before, you shouldn't use this... it was created to apply damage by impact back when we first developed the ragdoll, it's deprecated and it will be removed in the next update. Use gameObject.ApplyDamage instead
Sorry, but this bug is still remaining in 2.5.0a Ops sorry nick, the fix was done but it was not included on this hotfix since it was focused more on major issues. We have a big update coming soon and it will be there, but as I mentioned before you can simple use gameObject.ApplyDamage instead
|
|
nick62
Junior vMember
Posts: 33
|
Post by nick62 on Mar 23, 2020 22:20:16 GMT
change the “ragdoll” to “gameobject” and your good to go. Why are you still waiting ?????
I have changed it. More over I change ragdoll.ApplyDamage to ragdoll.gameobject.ApplyDamage, because of gameObject.ApplyDamage causes stack overflow!
But after every update I need to fix this issue. It will be greate, if it would out of the box.
Thank you for the great asset!
|
|
|
Post by Chronicman on Mar 23, 2020 22:33:12 GMT
doing ragdoll.gameobject.ApplyDamage() would case a stack overflow yes. gameObject.ApplyDamage(); is like gameObject.SendMessage("ApplyDamage"); have you tried gameObject.ApplyDamage(); ? that should fix your problem as mentioned above. As Invector said he will make sure its in the next one releasing in a week or so.
Tested and works update you code with this.
public void TakeDamage(vDamage damage)
{
if (!ragdoll) return;
if (!ragdoll.iChar.isDead)
{
inAddDamage = true;
float multiplier = (useRandomValues && !fixedValues) ? Random.Range(minDamageMultiplier, maxDamageMultiplier) :
(useRandomValues && fixedValues) ? randomChange ? maxDamageMultiplier:minDamageMultiplier :damageMultiplier;
if (overrideReactionID)
{
if (useRandomValues && !fixedValues) damage.reaction_id = Random.Range(minReactionID, maxReactionID);
else if(useRandomValues && fixedValues) damage.reaction_id = randomChange ? maxReactionID:minReactionID;
else
damage.reaction_id = reactionID;
}
var _damage = new vDamage(damage);
var value = (float)_damage.damageValue;
_damage.damageValue = (int)(value * multiplier);
if (multiplier == maxDamageMultiplier) OnGetMaxValue.Invoke();
gameObject.ApplyDamage(_damage);
//ragdoll.ApplyDamage(damage);
onReceiveDamage.Invoke(_damage);
Invoke("ResetAddDamage", 0.1f);
}
}
|
|
nick62
Junior vMember
Posts: 33
|
Post by nick62 on Mar 27, 2020 14:49:03 GMT
doing ragdoll.gameobject.ApplyDamage() would case a stack overflow yes. gameObject.ApplyDamage(); is like gameObject.SendMessage("ApplyDamage"); have you tried gameObject.ApplyDamage(); ? that should fix your problem as mentioned above. As Invector said he will make sure its in the next one releasing in a week or so.
Sorry, I do not use your code.
But I have this in Assets\Invector-3rdPersonController\Basic Locomotion\Scripts\Ragdoll\vDamageReceiver.cs:
ragdoll.ApplyDamage(damage) - current BUG.
gameObject.ApplyDamage - causes stack overflow.
ragdoll.gameobject.ApplyDamage - works great.
|
|