Maybe I am using your new code technique wrong, but when I incorporate it into my program, I am getting weird bugs that I did not have before, and my game is just not working right like it did before.

Going back to my previous code that works, this is the function that works in arming my player with a weapon, when I arm the player using the active weapon slot of the inventory bag:

Code:
function slot_was_clicked ( int occurrence, int bag_id, int slot_id, int placed_item_id, int removed_item_id ) 
{
   if ( ( occurrence == INV_ITEM_REMOVED ) || ( occurrence == INV_ITEM_SWAPPED ) )
   {
		if (bag_id == MAIN_BAG_ID)
		{
			if (slot_id == ACTIV_WPN_SLOT_ID)
			{
				ent_remove ( active_weapon );
			}
		}   
   }
	if ( ( occurrence == INV_ITEM_PLACED ) || ( occurrence == INV_ITEM_SWAPPED ) )
	{
		if (bag_id == MAIN_BAG_ID)
		{
			if (slot_id == ACTIV_WPN_SLOT_ID)
			{
				switch ( placed_item_id )
				{
					case SWORD:  active_weapon_mdl = "sword.mdl"; active_weapon = ent_create ( active_weapon_mdl, player.x, attach_weapon );  break;
					case MACE:   active_weapon_mdl = "mace.mdl"; active_weapon = ent_create ( active_weapon_mdl, player.x, attach_weapon );  break;
				}
			}
		}   
	}
}


I am now trying to figure out how to create a function that will drop the weapon or item from the inventory bag that the mouse cursor is currently floating, while the inventory bag is open, as the player clicks outside the bag.

Last edited by Ruben; 02/06/14 05:25.