I forgot to mention the re-scaling part, incase your inventory slots are larger
then your equipment slots, like the way that the template is set up. This is
very easy to customize. In the function ui_inv_attach_icon, you will notice
that there are 60 mouse locations, just like I mentioned in the tutorial. Each
mouse location is nearly a replica of the next, wit ha few exceptions. If you
goto line 650, this is mouse location zero. It has three posible states. Filled
with the icon coming from a inventory slot. Filled with an icon coming from a
equipment slot. And not filled, in which case the icon is placed there.
If you notice, inventory states are all scaled 1 to 1.
While the equipment state, orequipment slot return loop, sets the icon scale smaller.
You will need to change each and every mouse location's scale for this,
if you are using a different scale. It may be a bit tedious, bit it is
easy, and no coding.


I also want to talk a bit more about the defines. HEad over to line 1660, and
you will see that this is in fact our first equipment slot. S it's a equipment
slot zero, and mouse location 36, member we discussed that in the tutorial as
well. The layout is a template for the rest of the equiment slots:

Code:
if (mouse_item_location == 36)
{
if ((ui_equip_slot_array[0]>0) && (ui_inv_slot_return == 0))
{
temp_panel.pos_x = ui_inv_panel.pos_x + ui_equip_posx_array[ui_equip_slot_return];temp_panel.pos_y = ui_inv_panel.pos_y + ui_equip_posy_array[ui_equip_slot_return];
temp_panel.scale_x = .7;
temp_panel.scale_y = .7;
ui_equip_icon_backing[ui_equip_slot_return] = pan_create ("bmap = equip_icon_backing.tga;flags = VISIBLE;",1);
ui_equip_icon_backing[ui_equip_slot_return].pos_x = ui_inv_panel.pos_x + ui_equip_posx_array[ui_equip_slot_return];ui_equip_icon_backing[ui_equip_slot_return].pos_y = ui_inv_panel.pos_y + ui_equip_posy_array[ui_equip_slot_return];
ui_equip_slot_array[ui_equip_slot_return] = handle (temp_panel);
}
if ((ui_equip_slot_array[0]>0) && (ui_inv_slot_return > 0))
{
temp_panel.pos_x = ui_inv_panel.pos_x + ui_inv_slot_replacex_array[ui_inv_slot_return];temp_panel.pos_y = ui_inv_panel.pos_y + ui_inv_slot_replacey_array[ui_inv_slot_return];
temp_panel.scale_x = 1;
temp_panel.scale_y = 1;
ui_inv_slot_array[ui_inv_slot_return] = handle (temp_panel);
}
if ((ui_equip_slot_array[0]==0) && (player.ITEM_TYPE != REAR))
{
if (ui_inv_slot_return == 0)
{
temp_panel.pos_x = ui_inv_panel.pos_x + ui_equip_posx_array[ui_equip_slot_return];temp_panel.pos_y = ui_inv_panel.pos_y + ui_equip_posy_array[ui_equip_slot_return];
temp_panel.scale_x = .7;
temp_panel.scale_y = .7;
ui_equip_icon_backing[ui_equip_slot_return] = pan_create ("bmap = equip_icon_backing.tga;flags = VISIBLE;",1);
ui_equip_icon_backing[ui_equip_slot_return].pos_x = ui_inv_panel.pos_x + ui_equip_posx_array[ui_equip_slot_return];ui_equip_icon_backing[ui_equip_slot_return].pos_y = ui_inv_panel.pos_y + ui_equip_posy_array[ui_equip_slot_return];
ui_equip_slot_array[ui_equip_slot_return] = handle (temp_panel);
}
if (ui_inv_slot_return > 0)
{
temp_panel.pos_x = ui_inv_panel.pos_x + ui_inv_slot_replacex_array[ui_inv_slot_return];temp_panel.pos_y = ui_inv_panel.pos_y + ui_inv_slot_replacey_array[ui_inv_slot_return];
temp_panel.scale_x = 1;
temp_panel.scale_y = 1;
ui_inv_slot_array[ui_inv_slot_return] = handle (temp_panel);
}
}
if ((ui_equip_slot_array[0]==0) && (player.ITEM_TYPE == REAR))
{
temp_panel.pos_x = ui_inv_panel.pos_x + ui_equip_posx_array[0];temp_panel.pos_y = ui_inv_panel.pos_y + ui_equip_posy_array[0];
temp_panel.scale_x = .7;
temp_panel.scale_y = .7;
ui_equip_icon_backing[0] = pan_create ("bmap = equip_icon_backing.tga;flags = VISIBLE;",1);
ui_equip_icon_backing[0].pos_x = ui_inv_panel.pos_x + ui_equip_posx_array[0];ui_equip_icon_backing[0].pos_y = ui_inv_panel.pos_y + ui_equip_posy_array[0];
ui_equip_slot_array[0] = handle (temp_panel);
}
ui_inv_slot_return = 0;
ui_equip_slot_return = 0;
}



As wit hthe inventory positions, if the slot os filled and it came from an
inventoy slot, it is returned, or if it came from another equipment it is returned there.
If it is the wrong item type, (this is the REAR you were talking about) it is
also returned becaue it doesnt belong there. In this case it's a REAR slot
or "right ear", but this is almos tthe exact same code as the
rest of the equip slot locations. Only the positions in the array is increased
by one, for ever slot after this one. And the item type check is changed. You
will not have to edit anything besides these two things, as long as you are
using the same type of design. This means that you have a item, a equipment
slot, and a inventory slot. So lets say that you wanted to attach a laser turret to your brandnew space cruiser, in a space shooter game. And you wanted
it to be a position 1, or equipment slot one. Well this is how you would edit that part of the code:

Code:
if (mouse_item_location == 37)
{
if ((ui_equip_slot_array[1]>0) && (ui_inv_slot_return == 0))
{
temp_panel.pos_x = ui_inv_panel.pos_x + ui_equip_posx_array[ui_equip_slot_return];temp_panel.pos_y = ui_inv_panel.pos_y + ui_equip_posy_array[ui_equip_slot_return];
temp_panel.scale_x = .7;
temp_panel.scale_y = .7;
ui_equip_icon_backing[ui_equip_slot_return] = pan_create ("bmap = equip_icon_backing.tga;flags = VISIBLE;",1);
ui_equip_icon_backing[ui_equip_slot_return].pos_x = ui_inv_panel.pos_x + ui_equip_posx_array[ui_equip_slot_return];ui_equip_icon_backing[ui_equip_slot_return].pos_y = ui_inv_panel.pos_y + ui_equip_posy_array[ui_equip_slot_return];
ui_equip_slot_array[ui_equip_slot_return] = handle (temp_panel);
}
if ((ui_equip_slot_array[1]>0) && (ui_inv_slot_return > 0))
{
temp_panel.pos_x = ui_inv_panel.pos_x + ui_inv_slot_replacex_array[ui_inv_slot_return];temp_panel.pos_y = ui_inv_panel.pos_y + ui_inv_slot_replacey_array[ui_inv_slot_return];
temp_panel.scale_x = 1;
temp_panel.scale_y = 1;
ui_inv_slot_array[ui_inv_slot_return] = handle (temp_panel);
}
if ((ui_equip_slot_array[1]==0) && (player.ITEM_TYPE != LASER_TURRET))
{
if (ui_inv_slot_return == 0)
{
temp_panel.pos_x = ui_inv_panel.pos_x + ui_equip_posx_array[ui_equip_slot_return];temp_panel.pos_y = ui_inv_panel.pos_y + ui_equip_posy_array[ui_equip_slot_return];
temp_panel.scale_x = .7;
temp_panel.scale_y = .7;
ui_equip_icon_backing[ui_equip_slot_return] = pan_create ("bmap = equip_icon_backing.tga;flags = VISIBLE;",1);
ui_equip_icon_backing[ui_equip_slot_return].pos_x = ui_inv_panel.pos_x + ui_equip_posx_array[ui_equip_slot_return];ui_equip_icon_backing[ui_equip_slot_return].pos_y = ui_inv_panel.pos_y + ui_equip_posy_array[ui_equip_slot_return];
ui_equip_slot_array[ui_equip_slot_return] = handle (temp_panel);
}
if (ui_inv_slot_return > 0)
{
temp_panel.pos_x = ui_inv_panel.pos_x + ui_inv_slot_replacex_array[ui_inv_slot_return];temp_panel.pos_y = ui_inv_panel.pos_y + ui_inv_slot_replacey_array[ui_inv_slot_return];
temp_panel.scale_x = 1;
temp_panel.scale_y = 1;
ui_inv_slot_array[ui_inv_slot_return] = handle (temp_panel);
}
}
if ((ui_equip_slot_array[1]==0) && (player.ITEM_TYPE == LASER_TURRET))
{
temp_panel.pos_x = ui_inv_panel.pos_x + ui_equip_posx_array[1];temp_panel.pos_y = ui_inv_panel.pos_y + ui_equip_posy_array[1];
temp_panel.scale_x = .7;
temp_panel.scale_y = .7;
ui_equip_icon_backing[1] = pan_create ("bmap = equip_icon_backing.tga;flags = VISIBLE;",1);
ui_equip_icon_backing[1].pos_x = ui_inv_panel.pos_x + ui_equip_posx_array[1];ui_equip_icon_backing[1].pos_y = ui_inv_panel.pos_y + ui_equip_posy_array[1];
ui_equip_slot_array[1] = handle (temp_panel);
var l;
for (l = 0000;l<999;l++)
{
if(temp_panel == item_icon[l])
{
temp_ent[1] = ptr_for_handle(item_model_array[l]);
temp_droom_ent[1] = ptr_for_handle(droom_item_model_array[l]);
item_temp[1] = ent_create(temp_ent[1], player.x, attach_item);
droom_item_temp[1] = ent_create(temp_droom_ent[1], dressing_room_model.x, attach_dressingroom_item);
equip_slot_backing_toggle[1]=1;
}
}
}
ui_inv_slot_return = 0;
ui_equip_slot_return = 0;
}





where dressing_room_model.x is really just the name of your dummy ship model in the view window. Simple as pie.

Last edited by oldschoolj; 09/28/07 11:41.