Inventory Size of a placeable

Does Inventory Size property of a placeable work, or do I misunderstand it?
I expected that it would limit how many items can fit in the inventory of that placeable.
I put a placeable chest, set its Inventory Size to1, but in game it seems to ignore it, and allow the normal ~140 slots.

@THughes281,

I don’t know if there is an easier solution, but I recall having to do some messing around to limit container objects. It involved some XML editing as well as some scripting to ensure I limited the containers to the capacity I wanted.

So, unless someone else suggests a good workaround or there is something more obvious, then I would recommend checking my scripts and code in my module, The Scroll. That said, it is quite involved and so unless you really need it (like I did), then you may have to approach your requirements a different way.

1 Like

I didn’t test it, but even if the 128 slots are still available, maybe a script in the OnDisturbed slot of the chest (checking if there’s already something in it: if no, accept the item, if yes, reject it with a message saying the chest is already full) could do the trick?

1 Like

Thank you all. Original intention was a workbench where you could only put one weapon “on” the bench at a time.The player would interact through conversation and perform various actions on the item sitting on the forge.
I could use the actual weapon as the item activation target of another item, for example a Hammer. Player uses the hammer, must target a weapon, but I wanted to limit the player to doing these actions only at a specific workbench. In that respect, I’ve used distance checks, so that if player uses Hammer on a weapon, and is not 3m from a Workbench placeable, then exit, “You must be at a workbench”.

Sometimes I think that the fun of the toolset is not to produce modules, but to puzzle through problems :slight_smile:

1 Like

@THughes281

You could have the object turn “unuseable” when it contains a single item - and make “useable” again only via conversation (and give give object back).

Sorting issues like this, and many others too many to recall, kept me occupied during my first module for quite some time. I hope to finish module 2 in half the time now I have these sorts of things fixed.

And here is my own placeable limitation code in action … Note the 2 of 4. (Currently I have it show if an object is removed or added to an object. In my own case, I have not used this for “special” benches due to other reasons, but it can certainly be employed for any placeable otherwise.)

So this is a script you use here, Lance? Or is it both XML editing as well as scripting as you claimed in another post?

I did a similar thing with a conversation and “workbench” using scripts which I changed from Vordan’s Hero Creator because I remembered you can do that sort of thing with his mod.

Download it and look for the magic workbench scripts and conversations it does everything including checking how many things are on the workbench.

I used a workbench and changed it’s appearance into a tree stump to do it so it kept all the workbench properties.

The Vordan scripts use all types of enhancements possible so just remove what you don’t want. If I can fiddle with scripts and get it to work then it can’t be that hard !

Alright, I’ll check it out.

Ok, looked at it, and the thing I’m interested in is to get the inventory size down to 1, just as THughes281, but that module did none of that, as far as I could see.

andgalf… In Vordan’s mod is a script which I used as a condition on the conversation to check if the right thing or more than one item is on the “workbench” it wont continue if not and the conversation tells the player to do it properly. So rather than making sure the player can only put one item by fiddling with the workbench inventory, why not just tell them what to do and not let them continue if they don’t ?

This is the script… I forgot how you put it in a proper box as me posting scripts is very rare. I can’t find the button and it’s a mess ! I know I’ve been told how to do this and I tried looking at my posts but couldn’t find it… Sorry !

//:: VHC Magician's Workbench contains a valid item
//:: vhc_c_validbenchinv_aw
//:: Copyright (c) 2006 Vordan
//:://////////////////////////////////////////////
/*
	Checks the inventory of the workbench for valid 
	content	
	
	Valid:
	1 weapon or 1 armor
*/
//:://////////////////////////////////////////////
//:: Created By:    Vordan
//:: Created On:    2006/11/11
//:://////////////////////////////////////////////
#include "x2_inc_itemprop"

int StartingConditional(string sWorkbenchTag)
{
	object oWorkbench = GetObjectByTag(sWorkbenchTag);
	
	object oItem = GetFirstItemInInventory(oWorkbench);
	
	if(oItem != OBJECT_INVALID)
	{
		if((IPGetIsMeleeWeapon(oItem) == TRUE 
		)
			&& GetNextItemInInventory(oWorkbench) == OBJECT_INVALID)
			return TRUE;		
	}	
	
	return FALSE;
}

So to deal with the original problem…

Get a workbench turn the appearance into an anvil, get the Iron Fist hammer placeable, stick it near the anvil, put the gp_talk object script on the hammer, make it usable and give it a conversation.

I the conversation put this script as a condition and there’ll be no hammering or improving until the player’s done what they should do If they want to be stupid and put four weapons on the anvil or some potions then it’s not your problem and this script will stop anything working.

For some reason some of the script’s in a box and I have no idea why ! Also I just noticed I must’ve chopped out the armour bit of the script because mine’s just for weapons.

*** DISREGARD ALL MY GOING ON ABOUT THE POST BEING IN A MESS I’VE FIXED IT, THANKS ANGALF ****

2 Likes

To put the script in a box I always type ``` and then C and after the whole code I type the three “what it’s called” again. (I can’t type it all out since then it just hides that as in a script).

What I was really interested in (but in my module this is not really that important, I only thought to try it since it was brought up in this thread) is that the workbench really shows that you can only put one or two things there, that the inventory is actually that large, like in Lance’s picture, but it seems that you really need to tinker with XML stuff for that to work.

1 Like

@andgalf,

Sorry, I missed your posts. Late here now, but just to say you need to edit both scripts and the XML, as you say.

It’s not the easiest thing to work around, but now I have it working, it is rather neat. :slightly_smiling_face:

As I say, the only real alternative approach I can see is to use conversations.

Tomorrow, if I can do it, I’ll look at providing some scripts to demonstrate the approach.

@andgalf EDIT: Now posted below.

Hi All,

For those interested, here is the xml code I use. Bear in mind that I have made some other changes, but provide it as a guide only. An example of a script (from a function I wrote to complement it) is provided below this, as a guide again only. NB: This xml is affected from multiple scripts, e.g. OnClicked, Inventory disturbed, and the builder would need to consider other scripts that may call this GUI as required.

I would consider this reasonably advanced (at least for me), and so you need to have a reasonable grasp of what is going on to put this to good use. i.e. I can answer normal questions, but lack of time will likely mean I am unable to write it out completely for anyone.

This XML is complete and will work, but may have some other alterations you will not need.

<?xml version="1.0" encoding="utf-8">

<UIScene name="SCREEN_CONTAINER_DEFAULT" OnAdd0=UIScene_Misc_RequestContainerUpdates("true") idleexpiretime="0.1"
	x=0 y=150 width=354 height=460 fadeout="0.2" fadein="0.2" draggable=true backoutkey=true scriptloadable=true
OnAdd=UIObject_Misc_ExecuteServerScript("gui_pcinfo","OpenContainer") 
OnUpdate0=UIScene_OnUpdate_UpdateClosureFlag() 
OnRemove0=UIScene_Misc_RequestContainerUpdates("false") OnRemove1=UIObject_Misc_ExecuteServerScript("gui_pcinfo","CloseContainer")
priority="SCENE_INGAME" OnBackout=UIScene_OnBackout_CloseContainer() />

<UIPane name="VISCONTROL" hideoverride="true" capturemouseevents=false capturemouseclicks=false>

	<!-- Close Button -->
	<UIButton name="CloseButton" x=316 y=6 style="STYLE_CLOSE_BUTTON" OnLeftClick0=UIButton_Input_CloseContainer()>
	</UIButton>

	<UIIcon name="CONTAINER_ICON" img="container_icon.tga" x=0 y=0 width=78 height=71 />

<!UIText name="ContainerCapacity" x="96" y="36" width="156" height="31" align="right" valign="middle" fontfamily="Title_Font" style="1"
  update="true" OnUpdate=UIObject_OnUpdate_FormatContainerCapacity()/>

<UIText name="ContainerCapacity" text = " " x="185" y="40" width="156" height="31" align="right" valign="middle" fontfamily="Title_Font" style="1" />


<!-- Container Listbox  
		To add tooltips back in, add the following callback to the prototype pane.  I took it off because it did
		not show any *NEW* information.

			OnToolTip=UIObject_Tooltip_DisplayObject(OBJECT_X,OBJECT_Y,SCREEN_TOOLTIP_2,ALIGN_NONE,ALIGN_NONE,0,0,ALIGN_LEFT) -->

	<UIListbox name="CONTAINER_LISTBOX" x=20 y=70 width=320 height=350 yPadding=0 xPadding=0
		showpartialchild=false scrollbaronright=true unequalcontrols=false scrollsegmentsize=1
		update=true OnUpdate0=UIListbox_OnUpdate_UpdateContainer() 	
		OnUpdate1=UIObject_MISC_ExecuteServerScript("gui_inventory_info",local:0,"REJECT")	
		OnMouseDropReceived0=UIButton_OnDropReceived_SetContainerSlot()
		OnMouseDropReceived1=UIObject_Misc_ExecuteServerScript("gui_pcinfo","UpdateContainer")>

		<UIPane name="ITEM_PROTOTYPE" width=237 height=40 tupple=true prototype=true draggable=false
			OnToolTip='UIObject_Tooltip_DisplayTooltipString("Right Click For Item Info In Inventory","OBJECT_X","OBJECT_Y","SCREEN_TOOLTIP_2")'
			OnMouseDropFailed=UIButton_OnDropFailed_DropContainerItem()
			OnRadialRequest=UIObject_OnRadial_DisplayInventoryRadial()
			OnLeftDoubleClick0=UIButton_Input_PickupItem()	
			OnLeftDoubleClick1=UIObject_Misc_ExecuteServerScript("gui_pcinfo","UpdateContainer")

			OnRightClick0=UIObject_Misc_ExtractData("self:","objectid",0,local:0)
			OnRightClick1=UIObject_MISC_ExecuteServerScript("gui_inventory_info",local:0,"GIVEINFO","CONTAINER")						
			>			

			<UIButton name="ITEM_ICON_PROTOTYPE" x=0 y=0 style="STYLE_LOOT_ICON" prototype=true draggable=true
				OnToolTip='UIObject_Tooltip_DisplayTooltipString("Right Click To Transfer","OBJECT_X","OBJECT_Y","SCREEN_TOOLTIP_2")'
				OnMouseDropReceived=UIButton_OnDropReceived_SetContainerSlot()
				OnUpdate=UIButton_OnUpdate_UpdateLootSlot()
				OnLeftDoubleClick=UIButton_Input_PickupItem() 				
				
				OnRightClick0=UIObject_Misc_ExtractData("self:","objectid",0,local:0)
				OnRightClick1=UIObject_MISC_ExecuteServerScript("gui_unpause","GIVETOAPC",local:0)
			>

				<UIText align=right valign=bottom fontfamily="Special_Font" style="1"/>
			</UIButton>

			<UIButton name="ITEM_TEXT_PROTOTYPE" x=40 y=0 width=256 style="STYLE_LOOT_TEXT" prototype=true draggable=false
				OnMouseDropReceived=UIButton_OnDropReceived_SetContainerSlot()				
				>
			</UIButton>
		</UIPane>

		<UIScrollBar name="SB" style="STYLE_SB_THIN"></UIScrollBar>	
	</UIListbox>

	<UIPane name="BUTTON_CONTATINER" x=36 y="422" width="124" height="28" >
		<UIButton name="LEAVE" text="Leave" x=0 y=ALIGN_CENTER 
			OnLeftClick0=UIButton_Input_CloseContainer() OnLeftClick1=UIObject_Misc_ExecuteServerScript("gui_pcinfo","CloseContainer")
			style="STYLE_SMALL_BUTTON" >
		</UIButton>
	</UIPane>

	<UIPane name="BUTTON_CONTATINER" x=190 y="422" width="124" height="28" >
		<UIButton name="LOOT_ALL" strref="182901" x=0 y=ALIGN_CENTER 
			OnLeftClick0=UIButton_Input_LootAll() OnLeftClick1=UIObject_Misc_ExecuteServerScript("gui_pcinfo","CloseContainer")
			style="STYLE_SMALL_BUTTON" >
		</UIButton>
	</UIPane>

	<!-- Container Name -->	
	<UIText name="ContainerName" x=70 y=4 width=275 height=36 align=left valign=middle fontfamily="Title_Font" style="1" update=true OnUpdate=UIObject_OnUpdate_GetContainerName()/>
	<UIText name="ContainerInfo" text = "Right Click Text For Inventory Info or Icon For PC Transfer" x=70 y=30 width=275 height=36 align=left valign=middle fontfamily="Title_Font" style="1" color="B6FF00"/>

	<UIIcon name="DETAIL_TOP" img="title_medium03.tga" x=10 y=8 width=335 height=36 ignoreevents="true" />

	<!-- BACKGROUND -->
	<UIFrame width=PARENT_WIDTH height=PARENT_HEIGHT topleft="frame1_tl.tga" topright="frame1_tr.tga" bottomleft="frame1_bl.tga"
		bottomright="frame1_BR.tga" top="frame1_t.tga" bottom="frame1_b.tga"
		left="frame1_l.tga" right="frame1_r.tga" border=32 />	
	<UIFrame x=7 y=8 width=336 height=443 fillstyle="stretch" fill="frame_main_bg.tga"/>		

</UIPane>

An example of some script called by the GUI callback …

NB: This will NOT compile. This is just some example code where I calculate what I want to finally show in sCapacity, which is the string that shows the quantities filled of those available. Some of the code may make no sense at all, but hopefully the gist of what you may need to do is contained there.

// ONLY SOME OBJECTS NEED CAPACITY FIGURES
	if(iLIMITREQUIRED == 1)
	{		
		// SET THE CONTAINER LIMIT
		int iMAXCAPACITY = GetLocalInt(oPlaceable, "MAXCAPACITY");
		
		if(iMAXCAPACITY == 0)
		{			
			iMAXCAPACITY = GetWillSavingThrow(oPlaceable);
			
			// ENSURE THERE IS A REASONABLE MINIMUM
			int iUPDATE = d2(3);
			
			if(iMAXCAPACITY < iCOUNT || iMAXCAPACITY == 0)
			{
				if(iUPDATE > iCOUNT){iMAXCAPACITY = iUPDATE;}
				else{iMAXCAPACITY = iCOUNT;}
				
				SetWillSavingThrow(oPlaceable, iMAXCAPACITY);
			}		
			
			// CORRECT FOR STACKED ITEM CHECKER
			if(iMAXCAPACITY > 100){iMAXCAPACITY = iMAXCAPACITY - 100;}
					
			SetLocalInt(oPlaceable, "MAXCAPACITY", iMAXCAPACITY);	
		}
		
		// PREPARE A QUANTITY FEEDBACK
		sCapacity = IntToString(iCOUNT-iSUBTRACT) + "/" + IntToString(iMAXCAPACITY);
		
		SetLocalString(oPlaceable, "CONTAINERINFO", sCapacity);
	}		
	
	SetGUIObjectText(oPC, "SCREEN_CONTAINER_DEFAULT", "ContainerCapacity", -1, sCapacity);
2 Likes

Thanks for taking the time to post this, @Lance_Botelle!

Since in my case, this is no big deal, I think I will pass on implementing this. Seems to be too much work for such a minor and unimportant thing in my module. If there will come up some other case where I really need this though, and it’s important, I will come back to this thread and copy, paste and see if I can make it work.

1 Like

@andgalf,

If it comes to it, copying the xml should be fine … although be prepared to write your own supporting scripts. (The other script is just an example - and only partial.)

Ok, so you mean that just using the xml cound actually work? What would you name this xml file for it to show up on say a workbench? How would you link said xml to a workbench in the first place? Is it the Container UI Screen in the properties of the workbench perhaps? Do you put this xml in the override folder or just in the campaign folder perhaps?

Edit: Is it possible to give this xml a unique name so that you could use this for only this workbench perhaps?

Edit 2: I’m getting curious to actually try this out now. I would however like to look at the original screen container default xml and compare yours with that, to see what has been changed. Is it easy to find? I’ll just look for it, I guess.

More questions about this: I found an xml file called container.xml which I compare your xml file to. So, the code you posted here… Does this go in a script called gui_pc_info or perhaps gui_inventory_info perhaps?

Ok, so I’ve fiddled around for a bit now, but this is quite clearly beyond my understanding. I changed the xml a tiny bit to this:

<?xml version="1.0" encoding="utf-8">

<UIScene name="SCREEN_CONTAINER_ANDGALF" OnAdd0=UIScene_Misc_RequestContainerUpdates("true") idleexpiretime="0.1"
	x=0 y=150 width=354 height=460 fadeout="0.2" fadein="0.2" draggable=true backoutkey=true scriptloadable=true
OnAdd=UIObject_Misc_ExecuteServerScript("gui_pcinfo","OpenContainer") 
OnUpdate0=UIScene_OnUpdate_UpdateClosureFlag() 
OnRemove0=UIScene_Misc_RequestContainerUpdates("false") OnRemove1=UIObject_Misc_ExecuteServerScript("gui_pcinfo","CloseContainer")
priority="SCENE_INGAME" OnBackout=UIScene_OnBackout_CloseContainer() />

<UIPane name="VISCONTROL" hideoverride="true" capturemouseevents=false capturemouseclicks=false>

	<!-- Close Button -->
	<UIButton name="CloseButton" x=316 y=6 style="STYLE_CLOSE_BUTTON" OnLeftClick0=UIButton_Input_CloseContainer()>
	</UIButton>

	<UIIcon name="CONTAINER_ICON" img="container_icon.tga" x=0 y=0 width=78 height=71 />

<!UIText name="ContainerCapacity" x="96" y="36" width="156" height="31" align="right" valign="middle" fontfamily="Title_Font" style="1"
  update="true" OnUpdate=UIObject_OnUpdate_FormatContainerCapacity()/>

<UIText name="ContainerCapacity" text = " " x="185" y="40" width="156" height="31" align="right" valign="middle" fontfamily="Title_Font" style="1" />


<!-- Container Listbox  
		To add tooltips back in, add the following callback to the prototype pane.  I took it off because it did
		not show any *NEW* information.

			OnToolTip=UIObject_Tooltip_DisplayObject(OBJECT_X,OBJECT_Y,SCREEN_TOOLTIP_2,ALIGN_NONE,ALIGN_NONE,0,0,ALIGN_LEFT) -->

	<UIListbox name="CONTAINER_LISTBOX" x=20 y=70 width=320 height=350 yPadding=0 xPadding=0
		showpartialchild=false scrollbaronright=true unequalcontrols=false scrollsegmentsize=1
		update=true OnUpdate0=UIListbox_OnUpdate_UpdateContainer() 	
		OnUpdate1=UIObject_MISC_ExecuteServerScript("gui_inventory_info",local:0,"REJECT")	
		OnMouseDropReceived0=UIButton_OnDropReceived_SetContainerSlot()
		OnMouseDropReceived1=UIObject_Misc_ExecuteServerScript("gui_pcinfo","UpdateContainer")>

		<UIPane name="ITEM_PROTOTYPE" width=237 height=40 tupple=true prototype=true draggable=false
			OnMouseDropFailed=UIButton_OnDropFailed_DropContainerItem()
			OnRadialRequest=UIObject_OnRadial_DisplayInventoryRadial()
			OnLeftDoubleClick0=UIButton_Input_PickupItem()	
			OnLeftDoubleClick1=UIObject_Misc_ExecuteServerScript("gui_pcinfo","UpdateContainer")

			OnRightClick0=UIObject_Misc_ExtractData("self:","objectid",0,local:0)
			OnRightClick1=UIObject_MISC_ExecuteServerScript("gui_inventory_info",local:0,"GIVEINFO","CONTAINER")						
			>			

			<UIButton name="ITEM_ICON_PROTOTYPE" x=0 y=0 style="STYLE_LOOT_ICON" prototype=true draggable=true
				OnMouseDropReceived=UIButton_OnDropReceived_SetContainerSlot()
				OnUpdate=UIButton_OnUpdate_UpdateLootSlot()
				OnLeftDoubleClick=UIButton_Input_PickupItem() 				
				
				OnRightClick0=UIObject_Misc_ExtractData("self:","objectid",0,local:0)
				OnRightClick1=UIObject_MISC_ExecuteServerScript("gui_unpause","GIVETOAPC",local:0)
			>

				<UIText align=right valign=bottom fontfamily="Special_Font" style="1"/>
			</UIButton>

			<UIButton name="ITEM_TEXT_PROTOTYPE" x=40 y=0 width=256 style="STYLE_LOOT_TEXT" prototype=true draggable=false
				OnMouseDropReceived=UIButton_OnDropReceived_SetContainerSlot()				
				>
			</UIButton>
		</UIPane>

		<UIScrollBar name="SB" style="STYLE_SB_THIN"></UIScrollBar>	
	</UIListbox>

	<UIPane name="BUTTON_CONTATINER" x=36 y="422" width="124" height="28" >
		<UIButton name="LEAVE" text="Leave" x=0 y=ALIGN_CENTER 
			OnLeftClick0=UIButton_Input_CloseContainer() OnLeftClick1=UIObject_Misc_ExecuteServerScript("gui_pcinfo","CloseContainer")
			style="STYLE_SMALL_BUTTON" >
		</UIButton>
	</UIPane>

	<UIPane name="BUTTON_CONTATINER" x=190 y="422" width="124" height="28" >
		<UIButton name="LOOT_ALL" strref="182901" x=0 y=ALIGN_CENTER 
			OnLeftClick0=UIButton_Input_LootAll() OnLeftClick1=UIObject_Misc_ExecuteServerScript("gui_pcinfo","CloseContainer")
			style="STYLE_SMALL_BUTTON" >
		</UIButton>
	</UIPane>

	<!-- Container Name -->	
	<UIText name="ContainerName" x=70 y=4 width=275 height=36 align=left valign=middle fontfamily="Title_Font" style="1" update=true OnUpdate=UIObject_OnUpdate_GetContainerName()/>
	<UIIcon name="DETAIL_TOP" img="title_medium03.tga" x=10 y=8 width=335 height=36 ignoreevents="true" />

	<!-- BACKGROUND -->
	<UIFrame width=PARENT_WIDTH height=PARENT_HEIGHT topleft="frame1_tl.tga" topright="frame1_tr.tga" bottomleft="frame1_bl.tga"
		bottomright="frame1_BR.tga" top="frame1_t.tga" bottom="frame1_b.tga"
		left="frame1_l.tga" right="frame1_r.tga" border=32 />	
	<UIFrame x=7 y=8 width=336 height=443 fillstyle="stretch" fill="frame_main_bg.tga"/>		

</UIPane>

I then found the screen_container_ui.2da file which I copied and added the line SCREEN_CONTAINER_ANDGALF. I placed the copy in the override folder. Then I took the edited xml file and named it container_andgalf.xml and placed it in the campaign folder.
I then made a script I called gui_pc_info where I took your code and added some stuff…This is how it looks:

void main()
{

	object oPC = GetFirstPC(FALSE);
	object oPlaceable = GetObjectByTag("l_workbench");
	
	int iCOUNT = 1;
	int iSUBTRACT = 0; 
// ONLY SOME OBJECTS NEED CAPACITY FIGURES
	//if(iLIMITREQUIRED == 1)
	//{		
		// SET THE CONTAINER LIMIT
		int iMAXCAPACITY = GetLocalInt(oPlaceable, "MAXCAPACITY");
		
		if(iMAXCAPACITY == 0)
		{			
			iMAXCAPACITY = GetWillSavingThrow(oPlaceable);
			
			// ENSURE THERE IS A REASONABLE MINIMUM
			int iUPDATE = d2(3);
			
			if(iMAXCAPACITY < iCOUNT || iMAXCAPACITY == 0)
			{
				if(iUPDATE > iCOUNT){iMAXCAPACITY = iUPDATE;}
				else{iMAXCAPACITY = iCOUNT;}
				
				SetWillSavingThrow(oPlaceable, iMAXCAPACITY);
			}		
			
			// CORRECT FOR STACKED ITEM CHECKER
			if(iMAXCAPACITY > 100){iMAXCAPACITY = iMAXCAPACITY - 100;}
					
			SetLocalInt(oPlaceable, "MAXCAPACITY", iMAXCAPACITY);	
		}
		
		// PREPARE A QUANTITY FEEDBACK
		string sCapacity = IntToString(iCOUNT-iSUBTRACT) + "/" + IntToString(iMAXCAPACITY);
		
		SetLocalString(oPlaceable, "CONTAINERINFO", sCapacity);
	//}		
	
	SetGUIObjectText(oPC, "SCREEN_CONTAINER_ANDGALF", "ContainerCapacity", -1, sCapacity);
	
}

I placed this gui_pc_info on thi OnClick and OnUsed to see if anything would happen. Nothing happens InGame and I’m not surprised since I clearly have no idea what the heck I’m doing. It’s all just guesswork for me. It was fun experimenting though, but I will have to pass on this unless someone has time to explain how all this works in a little more detail. I wasn’t even going to fiddle with this in the first place. I think I’ll go back and work on my module for real now instead.

@andgalf,

Again, I only just caught up with your posts. I will give you some answers tomorrow as you have put in so much effort. It’s late here again.

Basically, yes, it is the container.xml. It is used instead of the original. I place it in the campaign folder, but override may work too.

The XML is called when the placeable container opens. And when opened, the XML fires the GUI script.

I’ll explain more tomorrow.

Well done for getting as far as you have. :+1:

Edit: No 2da edits are required.

@andgalf,

Here is the rundown …

Basically …

  1. When you open a container, it fires the container.xml to show the open container GUI.
  2. The container.xml code displays the GUI & fires gui_xxx related scripts dependant upon the GUI action.
  3. Search through the xml script and note the gui_xxx scripts and see what triggers them.
  4. Make use of these gui_xxx scripts accordingly, simply by writing the gui_xxx scripts as you need.

E.g. OnAdd=UIObject_Misc_ExecuteServerScript(“gui_pcinfo”,“OpenContainer”)

The gui_pcinfo script fires when the GUI is added to the players screen (opened the container).

Therefore, if you want to run a script that puts the inventory info to the GUI screen as a text, having the script gui_pcinfo is a good place to have it calculate the limitations you intend to use, convert to a string and send the string back to the GUI as a text using the appropriate script command to do so.

Also note:

  1. You need only one container.xml to do this, as this is the xml called when opening a default container.
  2. You alter how the GUI looks from this xml file.
  3. You determine what scripts are fired from this xml file.
  4. You need to write all supporting GUI files (gui_xxx) for your xml script. (Mine is a template example.)

Also note …

You may need to do some variable juggling, gathering, storing via normal script access, for the gui scripts to use when they get called. e.g. I store the placeable clicked so the xml knows what object we are dealing with via the PC that clicks on the placeable, via OnClicked (and other scripts).

2 Likes