Wiki

effect · remove_resistance_target

Definition

  • Supported scope:STATE
  • Supported target:any

Description

removes a previously added resistance target using its id. No tooltips are generated.:
remove_resistance_target = 42

Hands-On Notes

Hands-on notes are AI-generated and checked against the vanilla command vocabulary — treat them as a starting point, not authoritative reference. The definition above is the game's own documentation.

Hands-On Usage

remove_resistance_target is used to clean up resistance target markers previously added via add_resistance_target after a mission or decision completes, preventing stale resistance target entries from accumulating in game memory. A typical scenario is in occupation event chains, where when a special event-triggered enhanced resistance phase ends, the corresponding target is precisely removed by id.

# After a decision completes, remove the previously added special resistance target
123 = { # Execute in STATE scope
    remove_resistance_target = 42
}

Synergy

  • [add_resistance_target](/wiki/effect/add_resistance_target): Use as a paired operation. First register the target with add_resistance_target to obtain an id, then remove it by the same id with remove_resistance_target when the event concludes, forming a complete lifecycle management.
  • [resistance_target](/wiki/trigger/resistance_target): Before executing removal, use this trigger to verify whether the target id still exists, avoiding script exceptions from attempting to remove non-existent targets.
  • [cancel_resistance](/wiki/effect/cancel_resistance): Commonly used in combination within the same execution block. When completely ending a region's resistance state, both terminate the ongoing resistance logic and clean up the corresponding resistance target marker.
  • [has_active_resistance](/wiki/trigger/has_active_resistance): Serves as a prerequisite condition to confirm the STATE is currently in active resistance state before deciding whether to execute the removal operation, making the logic more robust.

Common Pitfalls

  1. Unclear id source: The id provided when removing must exactly match the actual id returned by add_resistance_target. Beginners often hardcode a guessed number (such as 42) instead of recording the real assigned id, resulting in removal failure with no error messages, leaving the resistance target permanently orphaned.
  2. Scope confusion: This effect only executes in STATE scope. If written in execution blocks with COUNTRY or CHARACTER scope, it will not function, and debugging becomes difficult—always ensure the outer scope has switched to the target state.