Has anyone used the fireball firing ballista scripts?

Looking for a little help for the game I’m making for my granddaughter. I’ve come to the last scene and am looking to allow her to take over a ballista and sort out the troops outside the castle. For this purpose I was hoping to use this tutorial on how to get a ballista firing fireballs.

https://neverwintervault.org/project/nwn1/other/fireball-firing-ballistas-tutorial-word97

The author offers a full cutscene which is great, along with aiming etc. but it doesn’t do any damage to hostile NPCs. He offers another script which does do damage but only to the PC. I can get both these scripts working in game.

However, I was hoping the PC could take over the ballista, as in the cutscene but actually do damage. He does offer extensive noted in his cutscene script but it’s way above my pay grade, I’m afraid.

  1. Find nearest enemy of the user.
  2. Shoot a fireball at it from the ballista.
void main()
{
    object oTarget = GetNearestCreature(
        CREATURE_TYPE_IS_ALIVE, TRUE,
        GetLastUsedBy(), 1,
        CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY,
        CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN);

    ActionCastSpellAtObject(
        SPELL_FIREBALL, oTarget,
        METAMAGIC_NONE, TRUE, 0,
        PROJECTILE_PATH_TYPE_BALLISTIC, TRUE);
}

If you want this to be immersive, all you need to modify the code to fire only at targets within a cone in front of the placeable. Using both maximum and minimum search radii is also recommended.

2 Likes