• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Patrol System v1.2.1

This bundle is marked as pending. It has not been reviewed by a staff member yet.

  • Periodically send patrols from Patrol base to camps
  • Camps send patrols to other camps or Patrol base when full
  • Encountered patrols attack Target base and send a Runner to Patrol base
  • New patrols attack Target base instead, when:
    • A Runner reaches Patrol base
    • Target player attacks Patrol player (excl. patrol units)

Test map commands:
  • -units: create units in Patrol player's base
  • -toggle: toggle the script (TogglePatrolScript(false))
  • -attackon: enable attack mode (TogglePatrolAttack(true))
  • -attackoff: disable attack mode (TogglePatrolAttack(false))
  • -destroy: destroy the script (DestroyPatrolScript(false))
//          - Configure the script and apply settings
//          -- Script must be disabled
//          -- If already configured, destroy configured objects
//          - Apply settings
//          -- Does not include players, regions, points, or targets
         TogglePatrolScript(boolean forceDisable)
//          - Enable or disable the script
//          -- Script must be configured to enable
//          -- Certain triggers remain enabled until no units are patrolling
//          --- unless forceDisable == true
         TogglePatrolAttack(boolean enable)
//          - Enable or disable Attack Mode
//          -- New patrols attack Target player base instead of patrolling
//          -- Disable or enable Patrol Base alerting and Runner pings
         DestroyPatrolScript(boolean forceDestroy)
//          - Permanently destroy the script and its objects and give all Dummy player units to Patrol player
//          -- There must be no units patrolling
//          --- unless forceDestroy == true
//          --- otherwise turn on script autodestruct and disable script

boolean udg_PatrolScriptAutoDestruct // Whether to automatically destroy the script when toggled off
boolean udg_PatrolChangeColor // Whether to change unit color when switching owner between Patrol and Dummy

// Players
player udg_PatrolPlayerTarget
player udg_PatrolPlayerPatrol
player udg_PatrolPlayerDummy // Patrolling units owner

integer udg_PatrolCampSizeMax // Maximum number of units in a camp
integer udg_PatrolBaseGuardSize // Minimum "guards" staying in base
integer udg_PatrolGroupGuardSize // Number of "guards" in a patrol group
integer udg_PatrolGroupSize // Total number of units in a patrol group
integer udg_PatrolGroupAttackGuardSize // Number of "guards" in an attack group
integer udg_PatrolGroupAttackSize // Total number of units in an attack group

real udg_PatrolBaseLeaveQTimeout // Timeout between queueing patrols
real udg_PatrolBaseLeaveTimeout // Timeout when patrol is queued
real udg_PatrolAttackQTimeout // Timeout between queueing attacks
real udg_PatrolAttackTimeout // Timeout when attack is queued

real udg_PatrolBaseOrderDelay // Delay (Sleep) between order to rally and to target
real udg_PatrolBaseCleanDelay // Delay (Sleep) between order to target and removing from temp group
real udg_PatrolCampOrderDelay // Delay (Sleep) between order to rally and to target
real udg_PatrolCampFacingDelay // Delay (Sleep) between order to random point in camp and turning

integer udg_PatrolGuardTypesCount // Number of "guard" types
integer udg_PatrolExcludeTypesCount // Number of excluded types
integer udg_PatrolExcludeClassesCount // Number of excluded classifications
integer array udg_PatrolGuardTypes // "Guard" types
integer array udg_PatrolExcludeTypes // Excluded types
unittype array pubExcludeClasses // Excluded classifications (not a UDG - must be set with Custom script)

// These are automatically assigned to the correct player based on start location
integer udg_PatrolBasesCount // Number of bases (start locs)
rect array udg_PatrolBaseRegions // Regions containing bases (start locs)
location array udg_PatrolBaseRallyPoints // Rally points for bases

integer udg_PatrolCampsCount // Number of camps
rect array udg_PatrolCampRegions // Regions for camps
location array udg_PatrolCampFacingPoints // Point units should face in camps
location array udg_PatrolCampRallyPoints // Rally points for camps

// Targets (camp index) are incremented each time a patrol is sent out
integer array udg_PatrolCampTargets // Next target for each camp - udg_PatrolCampsCount targets base
integer udg_PatrolBaseTarget // Next target for Patrol base

real udg_PatrolEncounterCheckTimeout // Timeout between checks for encounters
// Set either variables to 0 to use unit's current acquisition range
real udg_PatrolEncounterRange // Range at which Patrols can encounter Targets
real udg_PatrolEncounterGroupRange // Range at which to look for nearby patrols

real udg_PatrolRunnersSpeedMultiplier // Multiplier for movement speed of Runners
real udg_PatrolRunnersPingDuration // Duration of Runners ping
real udg_PatrolRunnersFirstPingDuration // Duration of first Runners ping
real udg_PatrolRunnersPingTimeout // Timeout between pings
string udg_PatrolRunnersEffect // Effect (model path) for Runners (overhead) - null (empty string) to disable

// Set to null ("No sound") to disable
sound udg_PatrolRunnersSound // Played when a patrol starts Running
sound udg_PatrolBaseAlertedSound // Played when an alerted patrol reaches base
sound udg_PatrolTargetAttacksSound // Played when Target player attacks Patrol player or enters its base

// This value can be used with the "Game - Value Of Real Variable" event to add additional triggers to the script
// -1: destroyed; 0: off; 1: on; +0.1: attack mode
// +0.01: Patrol running to base; +0.02: Patrol base alerted; +0.03: Patrol player attacked or base entered, by Target player
real udg_PatrolSystemState

- Script now turned off when Patrol player dies
- Attack Mode now turned off when Target player dies
- Use unit current acquisition range if rngEncounter <= 0 and/or rngEncounterGroup <= 0
- Base region assigning now based on player start location
- Camp Leaving now requeued if camp still full
- Added check for idle patrols in Patrol base (that lost their orders after getting stuck)
- Added several checks for units being alive
- Misc fixes/improvements
- Switched to generic map

- Separated ConfigPatrol() into ApplyPatrolSettings() and ConfigPatrolScript()
- When disabling script, Enter Base and Enter Camps triggers will now remain enabled until no units are patrolling (unless forced)
- When DestroyPatrolScript fails, AutoDestruct is now turned on and script disabled
- Improved/fixed AutoDestruct behaviour
- Fixed a bug when changing PatrolSystemState
- Replaced Enter Camps trigger array with a single trigger
- Replaced Camp arrays with a struct array
- Replaced TriggerGetCampIndex() with a hashtable
- Fixed some minor leaks
- General code optimization/refactoring

- Replaced Runners unit and effect arrays with a hashtable
- Some refactoring regarding ^, removed some redundancy
- Fixed trigger for dying patrols
- Misc small fixes/improvements
- PatrolAttackToggle() renamed to TogglePatrolAttack()
- PatrolScriptToggle() renamed to TogglePatrolScript()
- PatrolConfig() renamed to ConfigPatrol()
- PatrolScriptDestroy() renamed to DestroyPatrolScript()

v1.1.1 (fix)
- Fixed leaks (nulled agents)

- More flexible configuration
- Only units visible to patrols can alert
- Attack mode enabled when plrTarget attacks plrPatrol or enters its base
- Added sound for ^
- Check if base alerted sound is playing before playing
- Initial value set for sound UDGs ("No sound")
- udg_PatrolSystemState: second decimal now reflects alert state

- Uploaded

- Used in Exodus of the Horde (loktar's edit) (Mission 3)

- Thread

Patrol System v1.2.1 (Map)