Brazil's biggest MU Online portal — since 2003
Tutorial Advanced Tutoriais

How to Configure Castle Siege in Detail on MU Server

Complete guide to configuring Castle Siege on your MU Online server: SQL queries, .ini files, scheduling, guild setup, and advanced troubleshooting.

VI ViciadosMU Team · Updated on 3 jul 2026 · ⏱ 12 min read

Castle Siege is one of the most complex and competitive events in MU Online. Configuring it correctly requires attention across multiple layers: SQL Server database, GameServer configuration files, and time synchronization. This guide covers every step with specific commands and values for Season 6 servers.

Prerequisites

Before starting, confirm your environment has:

  • SQL Server 2008 or higher with the MuOnline database restored
  • GameServer Season 6 Episode 3 (or compatible build)
  • Administrator access on Windows Server
  • DataServer running and connected to SQL Server
Nota: This guide uses Season 6 as the reference. Servers running S9+ may have slightly different table names and fields, but the underlying logic is identical.

Step 1 — Verify and prepare the SQL tables

Castle Siege depends on specific tables in the MuOnline database. Run the queries below in SQL Server Management Studio to confirm they exist:

USE MuOnline;
GO

-- Check for essential Castle Siege tables
SELECT TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME IN (
    'CastleSiegeSync',
    'CastleSiegeNPC',
    'CastleSiegeTax',
    'CastleGuild',
    'CastleSiegeRegist'
);

If any table is missing, locate the creation SQL script in the GameServer/SQL/ folder of your installation package and execute it.

Initialize the base Castle Siege state

USE MuOnline;
GO

-- Set initial state: 0 = Castle Siege inactive
UPDATE CastleSiegeSync
SET CS_State        = 0,
    GuildMark       = 0,
    GuildName       = '',
    OwnerGuild      = '',
    CS_RegStartDate = GETDATE(),
    CS_RegEndDate   = DATEADD(DAY, 7, GETDATE())
WHERE CastleIndex   = 0;
Atenção: Never run this UPDATE while a battle is active. Doing so corrupts the event state and can cause GameServer crashes.

Step 2 — Configure the CastleSiege.ini file

Navigate to GameServer/Data/CastleSiege/ and open CastleSiege.ini with a text editor (Notepad++ recommended, ANSI encoding).

[CastleSiege]
CastleSiegeStart    = 1          ; 1 = enabled, 0 = disabled
MaxGuildCount       = 8          ; maximum number of registered guilds
MinGuildMemberCount = 5          ; minimum members required to register
MaxGuildMemberCount = 50         ; maximum members allowed to participate
RegPeriodDay        = 7          ; registration period in days
SiegeTime           = 60         ; battle duration in minutes
CastleSiegeWeekDay  = 6          ; day of week (0=Sun, 6=Sat)
CastleSiegeHour     = 21         ; start hour (24-hour format)
CastleSiegeMinute   = 0          ; start minute
TaxMoney            = 30         ; money tax rate in % (0-100)
TaxChaos            = 20         ; Chaos Goblin tax in %
TaxStore            = 10         ; personal store tax in %
Dica: For low-population servers, reduce MinGuildMemberCount to 3 and MaxGuildCount to 4. This ensures the event fires even with fewer active guilds.

Step 3 — Configure Castle Siege NPCs

Castle NPCs (Guards, Archers, Gates) are defined in the CastleSiegeNPC table and in the file CastleSiegeNPC.txt located at GameServer/Data/CastleSiege/.

Check NPCs via SQL

USE MuOnline;
GO

-- List all Castle Siege NPCs and their current status
SELECT NpcIndex, NpcClass, NpcLevel, NpcHp, NpcMaxHp, Life
FROM CastleSiegeNPC
ORDER BY NpcIndex;

Restore NPCs to default state (post-event)

USE MuOnline;
GO

-- Restore full HP to all castle NPCs
UPDATE CastleSiegeNPC
SET NpcHp  = NpcMaxHp,
    Life   = 1
WHERE CastleIndex = 0;

Step 4 — Configure the tax system

The guild owning the castle collects taxes from the Chaos Goblin and personal stores. This is controlled through SQL and CastleSiege.ini.

USE MuOnline;
GO

-- Check current tax configuration
SELECT CastleIndex, TaxChaos, TaxStore, TaxMoney, GuildName
FROM CastleSiegeTax
WHERE CastleIndex = 0;

-- Manually adjust tax rates (if needed)
UPDATE CastleSiegeTax
SET TaxChaos = 20,
    TaxStore  = 10,
    TaxMoney  = 30
WHERE CastleIndex = 0;
Nota: Taxes are automatically deducted by the GameServer on each transaction. The accumulated amount is stored in the MoneyAmount column of CastleSiegeSync and can be withdrawn by the owning Guild Master via the Elf Soldier NPC.

Step 5 — Configure automatic scheduling

Castle Siege should run weekly. Use SQL Server Agent or a scheduled stored procedure to update the event periods automatically.

Scheduling stored procedure

USE MuOnline;
GO

CREATE PROCEDURE dbo.sp_ScheduleCastleSiege
AS
BEGIN
    SET NOCOUNT ON;

    DECLARE @NextSiege   DATETIME;
    DECLARE @RegStart    DATETIME;
    DECLARE @RegEnd      DATETIME;

    -- Calculate next Saturday at 21:00
    SET @NextSiege = DATEADD(
        HOUR, 21,
        DATEADD(
            DAY,
            (7 - DATEPART(WEEKDAY, GETDATE()) + 7) % 7,
            CAST(CAST(GETDATE() AS DATE) AS DATETIME)
        )
    );

    SET @RegStart = DATEADD(DAY, -7, @NextSiege);
    SET @RegEnd   = DATEADD(HOUR, -1, @NextSiege);

    UPDATE CastleSiegeSync
    SET CS_State        = 1,
        CS_RegStartDate = @RegStart,
        CS_RegEndDate   = @RegEnd
    WHERE CastleIndex   = 0;

    PRINT 'Castle Siege scheduled for: ' + CAST(@NextSiege AS VARCHAR);
END;
GO

-- Execute the scheduling procedure
EXEC dbo.sp_ScheduleCastleSiege;

Step 6 — Configure ConnectServer and DataServer

Castle Siege requires DataServer to sync correctly with GameServer. Check DataServer/DataServer.ini:

[DataServer]
ServerCode    = 0
ConnectIP     = 127.0.0.1
ConnectPort   = 55557
DBServerIP    = 127.0.0.1
DBName        = MuOnline
DBUser        = sa
DBPassword    = your_password_here

In GameServer/GameServer.ini, confirm the events section:

[EventServer]
CastleSiege       = 1
CastleSiegeServer = 0      ; server code (must match DataServer.ini)

Step 7 — Test Castle Siege

To test without waiting for the scheduled time, force the registration period to start immediately via SQL:

USE MuOnline;
GO

-- Force registration period to start immediately
UPDATE CastleSiegeSync
SET CS_State        = 1,
    CS_RegStartDate = DATEADD(MINUTE, -1, GETDATE()),
    CS_RegEndDate   = DATEADD(HOUR, 1, GETDATE())
WHERE CastleIndex   = 0;

After applying, restart the GameServer and check GameServer/Log/GameServer_YYYYMMDD.log for lines such as:

[Castle Siege] State changed to: REGISTRATION
[Castle Siege] Registration period: START
Dica: Use a GM character (Account Level 3) and the in-game command /castlestate to check the current event state without querying the database directly.

Troubleshooting

Event does not start on schedule

  1. Verify Windows Server has the correct time zone: Control Panel → Date and Time
  2. Confirm SQL Server Agent is running: Services.msc → SQL Server Agent
  3. Run SELECT GETDATE() in SSMS and compare with the server clock

Guilds cannot register

-- Check whether the registration period is currently active
SELECT CS_State, CS_RegStartDate, CS_RegEndDate, GETDATE() AS Now
FROM CastleSiegeSync
WHERE CastleIndex = 0;
-- CS_State must be 1 and GETDATE() must fall between RegStartDate and RegEndDate

GameServer crashes during Castle Siege

Check GameServer/Log/Error_YYYYMMDD.log. Common errors:

  • NPC not found → Run the NPC restore UPDATE from Step 3
  • Guild data corrupted → Run DBCC CHECKDB('MuOnline') to verify database integrity
Atenção: Always back up the MuOnline database before modifying any Castle Siege tables. Use: BACKUP DATABASE MuOnline TO DISK = 'C:\Backup\MuOnline_pre_cs.bak'

Perguntas frequentes

Which SQL table controls the Castle Siege state?

The main table is CastleSiegeSync in the MuOnline database. Columns CS_State (0=inactive, 1=registration, 2=battle), CS_RegStartDate and CS_RegEndDate control the event periods.

Castle Siege does not start automatically — what should I check?

Verify that GameServer.exe runs with administrator privileges, that CastleSiege.ini has CastleSiegeStart=1, and that the server date/time matches the schedule stored in the CastleSiegeSync table.

How do I reset the castle owner via SQL?

Run UPDATE MuOnline..CastleSiegeSync SET GuildMark=0, GuildName='', OwnerGuild='' WHERE CastleIndex=0; to clear the current owner without affecting historical records.

How many guilds can register for Castle Siege?

The default cap is 8 guilds per Season 6 server. Adjust the MaxGuildCount field inside GameServer/Data/CastleSiege/CastleSiege.ini to change this limit.

VI

ViciadosMU Team

Equipe editorial do ViciadosMU — portal de MU Online no ar desde 2003.

Keep reading

Related articles