In some of my games, the particle acts as the bullet.
So instead of OnCollisionEnter, OnParticleCollision is the hit detection.

I want to give damage to DamageZone from Script or ORKEvent when it is hit by OnParticleCollision.
I don't know how to do it.
I found a node called [Use Damage Zone], but I don't understand what it means even after looking at the help text.
Do I run Calculate when I have a Success in [Use Damage Zone]?

I would like to know a simple way to do this, either using [Use Damage Zone] or a direct Script.
Please tell me how to damage the CustomScript in ↓.
???? I don't understand the part of ?

void OnParticleCollision(GameObject other)
{
//ToDo Damage to ORK
var damageZone = other.GetComponent<ORKFramework.Behaviours.DamageZone>();
if (damageZone != null)
{
damageZone.Damage(BaseAction???); // How to Define BaseAction
}
}

  • edited January 13
    The Collision Enter type is also used for particle collisions.

    So, if you have the damage dealer on the game object with your particle system it should get notified of particles hitting other game objects.
    Post edited by gamingislove on
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Can you tell me how to do a simple AddDamage Api from a script in OnParticleCollision?
    The reason is that some of the assets I bought have RayCast hit detection.
    In that case, I want to call AddDamage within if(raycast) and use it there as well.

    Also, the method of DamageDealer in Tutorial's Realtime Battle is not easy to use because you can't perform any other actions while waiting in the Wait node, and you need to manage the Wait end time, which is difficult to use.
  • You can do raycast damage in battle events as well - use a Raycast Object node to get a hit game object and a Use Damage Zone node to deal damage to a damage zone on it.

    You can't really cause damage to a damage zone without a damage dealer that was activated by an action. However, you can either change status values, effects, etc. directly on a combatant or use an ability to calculate those things.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • One of the particle effects we are using has a script to determine Collisiont as follows.
    (It is a series like this one
    (https://assetstore.unity.com/packages/vfx/particles/spells/realistic-effects-pack-4-85675?locale=ja-JP)
    Because the asset is updated, you cannot customize this script.
    (The original will be overwritten every time the asset is upgraded.)

    So you can't use the RayCastObject step.
    (The RayCast system has the script on this asset side)

    Using projectile collision detection:

    Just add follow script on prefab of effect.

    void Start () {
    var physicsMotion = GetComponentInChildren<RFX4_PhysicsMotion>(true);
    if (physicsMotion != null) physicsMotion.CollisionEnter += CollisionEnter;

    var raycastCollision = GetComponentInChildren<RFX4_RaycastCollision>(true);
    if(raycastCollision != null) raycastCollision.CollisionEnter += CollisionEnter;
    }

    private void CollisionEnter(object sender, RFX4_PhysicsMotion.RFX4_CollisionInfo e)
    {
    Debug.Log(e.HitPoint); //a collision coordinates in world space
    Debug.Log(e.HitGameObject.name); //a collided gameobject
    Debug.Log(e.HitCollider.name); //a collided collider :)
    }

    So, I need to tell DamageZone to CollisitonEnter from my script.
    What should I do in that case?


    private void CollisionEnter(object sender, RFX4_PhysicsMotion.RFX4_CollisionInfo e)
    {
    //ToDo Damage to ORK
    var damageZone = e.HitGameObject.GetComponent<ORKFramework.Behaviours.DamageZone>();
    if (damageZone != null)
    {
    damageZone.Damage(BaseAction???); // How to Define BaseAction
    }
    }
  • Additional question.
    There is a DamageDealerType called "Custom".
    But this has no Help text.

    How do I use this?
  • For Custom damage, call this function on the damage dealer:
    CustomDamage(GameObject gameObject, Vector3 position, Quaternion rotation)
    It takes the gameObject that should receive damage, the position and rotation that was hit (e.g. for particle effects spawning).

    Has the script on your particles any reference to what originally spawned them, e.g. where the damage dealer would be attached to?
    You can create a BaseAction for the damage calculation, but you'd already need to know which ability or item is used, and if you know that (e.g. stored somewhere on the script) you could already store access to the actual damage dealer.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited January 16
    I don't have a reference.
    It looks a little difficult. I will figure out another way.
    I decided to stop using RayCast and add my own box collider and damage zone to the particle laser weapon, different from the Asset, and use AutoDamageDealer to make the decision.

    Another serious problem question.
    In the Real-time Battle tutorial, there is a "Wait" step to wait for Ability A to make a detection to hit DamageDealer.

    During this WaitStep, Ability B cannot be performed.
    This makes the game less fun as an action RPG.
    For example, if you shoot a fireball, you can't shoot a blizzard ball until the fire disappears.


    What settings do I need to change to avoid this?
    I've checked all the control map settings, real-time battle settings, ability settings, Input settings, BattleEvent settings, Wait Step options, etc., but I can't find any settings that would allow me to avoid this.
    Post edited by joeee19 on
  • For things like fireball, you can just shoot the fireball, activate it's damage dealer and end the battle event, allowing to use the next ability. E.g. see this fireball tutorial.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.