Skip to content

Implement projectiles from Wld_PlayEffect - #1083

Open
pieterdeschepper wants to merge 1 commit into
Try:masterfrom
pieterdeschepper:wld-playeffect-projectile
Open

pieterdeschepper wants to merge 1 commit into
Try:masterfrom
pieterdeschepper:wld-playeffect-projectile

Conversation

@pieterdeschepper

@pieterdeschepper pieterdeschepper commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Wld_PlayEffect returned early (// TODO, "effect not implemented") whenever the script passed a damage, level or projectile argument. In Gothic 1 the only such call is the Sleeper's fireball in ZS_Sleeper_Loop:

Wld_PlayEffect("SPELLFX_SLEEPER_FIREBALL", self, hero, 2, 150, DAM_FIRE, TRUE);

As a result the Sleeper never attacked the player during the final fight.

Change

  • Wld_PlayEffect with isProjectile launches the effect with the new World::shootEffect. It reuses the spell trajectory code from shootSpell (moved into magicTrajectory), so the effect's emTrjOriginNode/emTrjTargetNode and emTrjTargetRange apply. The damage argument is applied to every damage type set in the mask, as for spells.
  • New Bullet(World&, const VisualFx&, pos) for a projectile without an item or spell. BulletBody::setMagic()/isMagic() give it spell physics: no gravity, and it stops at walls instead of bouncing.
  • On hit (Bullet::isEffect()):
    • The bullet's damage is applied minus protection, without the bow hit-chance and critical-hit rules.
    • The damage type comes from the bullet rather than the shooter's weapon.
    • No weapon hit sound is played. The effect's emFXCollDyn runs, as for spells.
  • Non-projectile calls with damage or a level still log "effect not implemented". Gothic 1 has none, and I didn't want to guess their semantics.
  • The level argument isn't used. For this effect it only selects the invest visuals.

Testing

Gothic 1 on macOS (Apple M3 Pro), loading a save in the Sleeper's chamber. Every 5 seconds the Sleeper shoots a fireball:

  • It is visible and explodes on the player or on walls, and it can be dodged by moving.
  • Each hit deals 90 damage: 150 fire damage minus the player's fire protection of 60.

I tested in a local build. Gothic 2 is not tested.

🤖 Generated with Claude Code

Wld_PlayEffect returned early when the script passed a damage, level
or projectile argument, so the Sleeper in Gothic 1 (ZS_Sleeper_Loop)
never shot his fireball at the player.

For isProjectile, the effect is now launched like a spell, from the
source npc toward the target, through a new Bullet built from a
VisualFx. It has no gravity and stops at walls, like a spell. On hit it
deals the given damage of the given damage types (minus protection),
without the bow hit-chance and critical-hit rules. Non-projectile calls
with damage or a level still log "effect not implemented".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant