Setting mobs - Monster Level to 1

Newbie Spellweaver
Joined
Oct 25, 2024
Messages
8
Reaction score
2
Was working on Mob.enc. I would like to set the Level of all 447 monsters to Level 1 using a script this way I don't need to update it manually. Can someone help me creating a script for this? and also just wanna ask. Do I need to sync this on my server? Thanks!

Btw, please see attached*

2024-12-20_12-06-19 - Setting mobs - Monster Level to 1 - RaGEZONE Forums
 
Solution
Fixed this. Closing this thread.

see code below.

Code:
// Configuration
const int monster_count = 447;           // Total number of monsters
const int monster_struct_size = 0xA6;   // Size of each monster structure in bytes
const int level_offset = 0x9E;          // Offset of the 'Level' field within the monster structure

// Initialize variables
int monster_index = 0;
int level_position; // Declare level_position outside the loop

// Loop through all monsters
while (monster_index < monster_count) {
    // Calculate the starting offset of the 'Level' field for this monster
    level_position = monster_index * monster_struct_size + level_offset;

    // Debug: Print the current position
    Printf("Updating monster %d at offset 0x%X\n"...
Fixed this. Closing this thread.

see code below.

Code:
// Configuration
const int monster_count = 447;           // Total number of monsters
const int monster_struct_size = 0xA6;   // Size of each monster structure in bytes
const int level_offset = 0x9E;          // Offset of the 'Level' field within the monster structure

// Initialize variables
int monster_index = 0;
int level_position; // Declare level_position outside the loop

// Loop through all monsters
while (monster_index < monster_count) {
    // Calculate the starting offset of the 'Level' field for this monster
    level_position = monster_index * monster_struct_size + level_offset;

    // Debug: Print the current position
    Printf("Updating monster %d at offset 0x%X\n", monster_index, level_position);

    // Seek to the 'Level' field
    FSeek(level_position);

    // Write level = 1 (short integer, 2 bytes, little-endian)
    WriteShort(1, 1); // 1 indicates little-endian

    // Increment the monster index
    monster_index++;
}

// Print completion message
Printf("All monster levels have been set to 1.\n");
 
Upvote 0
Solution
Back