Transform your tamed wolves into guard wolves that patrol and defend your territory
A Denizen script for Minecraft that enables tamed wolves to guard specific locations without following you, complete with smart AI and combat behavior.
- π‘οΈ Guard Mode Toggle - Right-click with a stick to enable/disable guard mode
- π― Smart AI - Wolves patrol within a 15-block radius and automatically return to their guard point
- βοΈ Combat System - Detects and attacks hostile mobs within range
- π Automatic Recovery - Teleports stuck wolves back to their guard point with invulnerability
- π Wolf Management - List all your wolves with status, health, location, and armor indicators
- β Attacks hostile mobs within 15 blocks
- β Never attacks players
- β Never attacks creepers (prevents explosions)
- β Never attacks passive animals
- Minecraft 1.20.5 or higher
- Denizen plugin installed on your server
- Download
guard_wolves.dsc - Place it in your server's
plugins/Denizen/scripts/folder - Restart your server or run
/denizen reload scripts - Verify installation with
/denizen scripts- you should seeguard_wolves_command,guard_wolf_startup,guard_wolf_toggle,guard_wolf_combat, andguard_wolf_wander
- Tame a wolf
- Position the wolf where you want it to guard
- Right-click the wolf with a stick
- The wolf will guard a 15-block radius around that location
- Right-click the guarding wolf with a stick
- The wolf becomes tamed again and will follow you
| Command | Aliases | Description |
|---|---|---|
/guard_wolves list |
/gw ls |
List all your wolves with status, health, location, and armor π‘οΈ |
/guard_wolves toggle_logs |
/gw tl |
Enable/disable debug logs for troubleshooting |
Example output:
========== Your Wolves (5) ==========
β’ Fang π‘οΈ (Pale) β€ 32/40 GUARDING at -487,78,-18,world
β’ Rex (Ashen) β€ 20/20 Following at 123,65,456,world
β’ Scout (Woods) β€ 8/8 Sitting at -200,70,300,world
When a wolf enters guard mode:
- Owner is removed (prevents following/teleporting)
- Max health set to 40 HP (tamed wolf stats)
- Current health is preserved
- Wolf becomes persistent (won't despawn)
- Movement speed remains natural
- Guard point saved at current location
The AI runs every 8 seconds for each guard wolf:
- Distance Check - Monitors distance from guard point
- Return Logic - Walks back slowly if >15 blocks away
- Stuck Detection - Teleports wolf home if stuck for 1+ minute
- Home Check - Every 2 minutes, teleports if >3 blocks away for 4+ minutes
- Combat Scan - Every 2 seconds, detects nearby hostile mobs
All teleports include:
- 3 seconds of invulnerability
- Protection from fall damage
- Protection from suffocation
- Protection from mob attacks
- Guard wolves cannot be healed with meat (shows warning message)
- Must disable guard mode to heal
When a guard wolf dies, you receive:
β Guard wolf died: Fang (Pale) at -487,78,-18,world - killed by Zombie
Edit the 15 value in these lines:
- define nearby_mobs <[wolf].location.find_entities[monster].within[15]>
- if <[distance]> > 15:Edit line 468:
- walk <[wolf]> <[safe_center]> speed:0.3Lower = slower (0.1-1.0 range)
Guard Mode Enable: Edit particle effects and glowing duration around line 241 Guard Mode Disable: Edit particle effects around line 194
Edit the max health (default 40):
- adjust <[wolf]> max_health:40# Combat scan frequency (line 294)
on delta time secondly every:2
# AI loop frequency (line 305)
on delta time secondly every:8
# Stuck timeout (line 442)
- if <[time_stuck]> > 60: # 60 seconds
# Home check timeout (line 410)
- if <[time_away]> > 120: # 120 seconds- Enable debug logs:
/gw tl - Check if wolf is in combat mode in logs
- Verify mob is hostile and not a creeper
- Ensure mob is within 15 blocks
- Check debug logs for stuck/home check messages
- Wolf may be in an area with poor pathfinding
- Consider placing guard point in more open area
- Check that server restarts cleanly (not crashed)
- Verify Denizen is saving flags properly
- Health saves every 8 seconds during AI cycles
- This is intentional! Disable guard mode first with a stick
- Then feed the wolf meat to heal
- Re-enable guard mode after healing
- The script doesn't modify base movement speed
- Combat and natural movement use vanilla speeds
- AI Frequency: Every 8 seconds
- Combat Scan Frequency: Every 2 seconds
- Guard Radius: 15 blocks
- Home Radius: 3 blocks (for stuck detection)
- Return Walk Speed: 0.3
- Stuck Timeout: 60 seconds
- Home Check Timeout: 240 seconds
- Invulnerability Duration: 3 seconds (after teleport)
Created by Robbe Verhelst
Built with Denizen Script
MIT License - see LICENSE file for details
Contributions welcome! See CONTRIBUTING.md for guidelines.
- Custom guard messages/alerts
- Wolf formations/groups
- Territory claiming integration
- Experience/leveling system
- Different guard behaviors (aggressive/passive/defensive)
- Integration with other protection plugins
Found a bug? Have a suggestion? Open an issue!