Skip to content

[Gothic I] Fix Control Instance Guard - #1077

Draft
Abendlied wants to merge 6 commits into
Try:masterfrom
Abendlied:fix-g1-control-instance-guard
Draft

Abendlied wants to merge 6 commits into
Try:masterfrom
Abendlied:fix-g1-control-instance-guard

Conversation

@Abendlied

Copy link
Copy Markdown
Contributor

Work in progress, not ready for merge.
This aims to include the missing Gothic I Control spell from issue #1061 Further references, where I also gathered learnings and information relevant for the implementation:
From 2024 #661, item 12.
Original tracking entry: #622, item 18.9.

Implemented

  • Control cast moves control from player over to target NPC
  • Control ends on pressing Return key
  • Control ends when controlled NPC dies (incl. fatal fall, drowning, killed)
  • Damage to the player (original caster) now is handled by the Control implementation
  • VFX works (large ray orb on target NPC, funnel-bridge links caster and target NPC during casting)
  • Cancelled cast cleans up spell state
  • Gothic I spell handling is guarded against treating INTTOSTRING as a transform instance

Verification

Gothic I

Test Results

  • Partial Control cast: works as intended
  • Complete Control cast: works

Ending Control by:

  • Enter
  • Controlled NPC's death caused by another NPC
  • Controlled NPC's death caused by drowning
  • Controlled NPC's death caused by a Monster
  • Controlled NPC's death caused by fatal fall damage
  • Player takes damage from another NPC

Control is not interrupted by:

  • Controlled NPC being knocked out by another NPC
  • Controlled NPC taking non-fatal fall damage
  • Controlled NPC taking damage from another NPC

Regression Testing: Transformation

  • Tested the sequence: Transform to Orcdog → Control NPC → Transform to Orcdog → Control NPC, without any observed regression.
  • Attacking same-guild NPCs causes them not to fight back. Possibly too friendly because of my patch? I modified GameScript::personAttitude() to use guildAttitude() for interactions involving the controlled NPC, possible this needs to be addressed differently.

Known Gaps

  • Saving/loading while controlling an NPC is not handled (vanilla behaviour unclear).
  • The controlled NPC's inventory is accessible, although it should not be (needs fix).
  • Sleeping is prohibited while controlling an NPC (I THINK this is the original game design but cannot verify).
  • When attacking the player with a controlled NPC, the player draws a melee weapon but does not fight back. The current behaviour seems wrong. Unclear what the vanilla behaviour is. Might be related to the player not entering the concentration pose.

###Not Implemented Yet

  • The player does not play the concentration pose.
  • The 3500-unit distance limit warning and 4000 unit distance termination is not implemented.

Gothic II / Gothic II NotR
Not yet verified

A successful Control cast now hands the player over to the target NPC. Enter, the death of the target, or damage to the original caster hands control back. While casting, the target gets its ray ball and a ray funnel links it to the caster.

Known gaps: the caster does not play the concentration pose, there is no distance limit yet, the controlled NPC's inventory is not blocked, and saving during Control is not handled.
@Abendlied

Copy link
Copy Markdown
Contributor Author

Approach for the concentration pose:
reject non-interruptible ... existing=T_CONSHOOT_2_STAND ... finished=0 interrupt=0 force=0. The player at this tick is still in cast release transition and Npc_PlayAni tries but fails. It tries only once and it is 5 ticks too early.

Queued AI_PlayAnim could be used, it puts the action back to the front of the queue and retries next tick (npc.cpp, the AI_PlayAnim case).
But it seems it is not really used often, this would be defacto a Control-only path. Also I have no idea about mod compatibility.
AI_PlayAnimBs is probably not good as it is equipped with a body state which is not given in the script.

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