GML Queues

so this is my first time using Queues in game maker, and for some reason the first two of the list aren't loading, and idk why? Could someone check this out for me?
This is my battle Start object
Code:
Create Event:

execute code:

/// Varabiles
randomize();

field_type = 0;

execute code:

/// Field Create

speedQueues = ds_priority_create();

// Field Create
sc_list_of_enemys();
var allyNumber = 2;
var enemyNumber = irandom_range(1, 4);
var enemyType = field_type;

for (i = 0; i < (enemyNumber + allyNumber); i++)
{
    var battleNumber = i;
    switch (i)
    {
        case 0:
            battleField[i] = instance_create(96, 160, ob_player);
            break;
      
        case 1:
            battleField[i] = instance_create(96, 224, ob_ally);
            break;
      
        default:
            battleField[i] = instance_create(384, -32+(64*i), enemyId[enemyType, irandom_range(0, array_length_2d(enemyId, enemyType)-1)]);
            break;
    }
  
    ds_priority_add(speedQueues, battleField[i], battleField[i].attackSpeed);
}

execute code:

/// Decide order of Battle
battleFieldLength = array_length_1d(battleField)-1;

// Getting the speed Array
ds_priority_delete_max(speedQueues);

for (i = 0; i < array_length_1d(battleField)-1; i++)
{
    battleOrder[i] = ds_priority_delete_max(speedQueues);
}

ds_priority_destroy(speedQueues);

battleOrder[0].state = sc_your_turn;


Step Event:

execute code:

/// Reset (Remove When done)
if (keyboard_check_pressed(vk_tab)) room_restart();

Draw Event:

execute code:

/// Debug
draw_text(32, 32, battleFieldLength);

for (i = 0; i < array_length_1d(battleOrder)-1; i++)
{
    draw_text(32, 64+(16*i), battleOrder[i]);
}
Here is the Enemy Parent
Code:
Create Event:

execute code:

/// Varabiles

// Health
hp = 5;
maxHp = hp;

// Magic
mp = 0;
maxMp = mp;

// Attack
attackSpeed = 1;
attackStrength = 1;

// Armor
physicalArmor = 0;
magicalArmor = 0;

state = sc_static_state;

Step Event:

execute code:

/// State
if (state = sc_your_turn)
{
    if (x != 320)
    {
        x -= 8;
    }
}

Draw Event:

execute code:

/// Draw text
draw_self();
draw_text(x, y-32, hp);
draw_text(x+12, y-32, mp);
draw_text(x+24, y-32, attackSpeed);
draw_text(x+36, y-32, attackStrength);
draw_text(x+48, y-32, physicalArmor);
draw_text(x+60, y-32, physicalArmor);
Here is the player code
Code:
Create Event:

execute code:

/// Varabiles
hspd = 0;
vspd = 0;
spd = 6;
fric = 1;

// Health
hp = 10;
maxHp = hp;

// Magic
mp = 5;
maxMp = mp;

// Attack
attackSpeed = 3;
attackStrength = 10;

// Armor
physicalArmor = 10;
magicalArmor = 5;

state = sc_movement_state;

Step Event:

execute code:

/// State
script_execute(state);

if (state == sc_your_turn)
{
    if (x != 160)
    {
        x += 8;
    }
}

execute code:

/// Take to battle (Testing only)
if (keyboard_check_pressed(vk_tab))
{
    room_goto(rm_test_battle);
}
Here is ally Code
Code:
Create Event:

execute code:

/// Varabiles

// Health
hp = 5;
maxHp = hp;

// Magic
mp = 15;
maxMp = mp;

// Attack
attackSpeed = 2;
attackStrength = 5;

// Armor
physicalArmor = 5;
magicalArmor = 10;

state = sc_static_state;
That is what I think all the code needed. Please look though it and tell me if i messed anything up
 
Last edited:
Nevermind....I think

edit: Nope something is wrong! For someone reason it skips the last two charaters of the list order, or I think so
 
Last edited:
Top