Modding Help Detect if projectile killed Entity

Discussion in 'Starbound Modding' started by Dakrhunter30, May 26, 2018.

  1. Dakrhunter30

    Dakrhunter30 Scruffy Nerf-Herder

    A while back i created the Gravity Lance form Desteny 2 in Starbound and with the recent changes to the weapon i would like to rework mine as well.
    There was a new feature added, which is that,
    if the weapon kills an enemy, it should spawn projectiles from the dead entities body that track nearby enemies.

    Now for my questions,
    Is it possible to detect if the hit Entity died to the projectile,
    A: from the projectile script?
    B: from the player that shot it?
     
  2. Cyel

    Cyel Scruffy Nerf-Herder

    A: It seems projectile scripts have a hit(entityId) function that get called when they hit something. You can see it in /projectiles/throwable/capturepod/capturepod.lua and /projectiles/activeitems/chakram/chakramprojectile.lua for example

    B: I believe you can use status.damageTakenSince():
    Code:
    #### `List<DamageNotification>`, `unsigned` status.inflictedDamageSince([`unsigned` since = 0])
    
    Returns two values:
    * A list of damage notifications for damage inflicted by the entity.
    * The most recent heartbeat to be passed into the function again to get the list of damage notifications since the last call.
     
    Last edited: Jun 15, 2018

Share This Page