Skip to content

Reusable Projectiles

szapp edited this page Oct 30, 2017 · 10 revisions

The configuration of this feature is found in the file config/collectable.d.

List config functions

GFA_GetUsedProjectileInstance


GFA_GetUsedProjectileInstance

This feature offers only one config-function. Yet this function is all that is needed. It is called whenever a projectile (arrows and bolts) hits an NPC or stops in the world. There it can be decided whether to keep the projectile (in the world or in the inventory of the NPC), replace the it with a different instance (e.g. broken projectile that needs to be repaired) or to remove it.

Ideas: exchange projectile for a 'used' or 'broken' one, require the possession of retrieval talent or tool, ... There are a lot of examples given inside the function, they are all commented out and serve as inspiration of what is possible.

func int GFA_GetUsedProjectileInstance(int projectileInst, C_Npc shooter, C_Npc inventoryNpc)
projectileInst The instance of the projectile in question. Typically ItRw_Arrow or ItRw_Bolt (or ItAmArrow or ItAmBolt in Gothic 1).
shooter The NPC that shot the projectile.
inventoryNpc The NPC that was hit by the projectile (in whose inventory it will be put), or empty if it landed in the world.
returns New item instance. Return projectileInst to keep the projectile unchanged. When returning zero, the projectile is removed.