Jump to content

Home

[K1]Can containers have limits to how much inventory they have?


CA8802

Recommended Posts

And if so, how would you remove those limits? I've been trying to make a mod that lets you have all three class' starting items in the footlocker in your room when you start a new game, but no matter what I do, aside from the inventory the container is supposed to have, only the first item that my script spawns(Blaster Pistol for Soldiers, Blaster Rifle for Scouts and Scoundrels) shows up.

 

If it helps, here's the code:

void main()
{
  string SOLDIER_WEAPON = "g_w_blstrrfl001";
  string SOLDIER_ITEM01 = "g_i_adrnaline003";
  string SOLDIER_ITEM02 = "g_i_adrnaline001";

  string SCOUT_SCOUNDREL_WEAPON = "g_w_blstrpstl001";
  string SCOUT_ITEM01 = "g_i_adrnaline002";
  string SCOUT_ITEM02 = "g_i_implant101";

  string SCOUNDREL_ITEM01 = "g_i_secspike01";
  string SCOUNDREL_ITEM02 = "g_i_progspike01";

  object oLocker = GetObjectByTag("end_locker01");
  int iClass = GetClassByPosition(1,GetFirstPC());
  if(iClass == CLASS_TYPE_SCOUNDREL)
  {
      CreateItemOnObject(SOLDIER_WEAPON,oLocker);
      CreateItemOnObject(SOLDIER_ITEM01,oLocker);
      CreateItemOnObject(SCOUT_ITEM01,oLocker);
      CreateItemOnObject(SCOUT_ITEM02,oLocker);
  }
  else if(iClass == CLASS_TYPE_SCOUT)
  {
      CreateItemOnObject(SOLDIER_WEAPON,oLocker);
      CreateItemOnObject(SOLDIER_ITEM01,oLocker);
      CreateItemOnObject(SCOUNDREL_ITEM01,oLocker);
      CreateItemOnObject(SCOUNDREL_ITEM02,oLocker);
  }
  else if(iClass == CLASS_TYPE_SOLDIER)
  {
      CreateItemOnObject(SCOUT_SCOUNDREL_WEAPON,oLocker);
      CreateItemOnObject(SCOUT_ITEM01,oLocker);
      CreateItemOnObject(SCOUT_ITEM02,oLocker);
      CreateItemOnObject(SCOUNDREL_ITEM01,oLocker);
      CreateItemOnObject(SCOUNDREL_ITEM02,oLocker);
  }
  CreateItemOnObject(SOLDIER_ITEM02,oLocker);

  if(!GetHasSkill(SKILL_STEALTH,GetFirstPC()))
  {
      CreateItemOnObject("g_i_belt010",oLocker);
  }
}

 

Any suggestions?

Link to comment
Share on other sites

I remember once i placed my entire inventory into one of the plasteel cylinders on the ebon hawk, so no i don't think that they have limits, and if they do its got to be triple digits. I think there might be a problem with your script but im not sure. Maybe Stoffe can look at it. ;)

Link to comment
Share on other sites

"if" with 2 "else"? Is that right?

However, if you want all class items in one locker you don't need those class check anymore. Just spawn all intems and that's it.

Something like this

void main()
{
 object oLocker = GetObjectByTag("end_locker01");
//soldier stuff
CreateItemOnObject("g_w_blstrrfl001",oLocker,1,1);
CreateItemOnObject("g_i_adrnaline003",oLocker,1,1);
CreateItemOnObject("g_i_adrnaline001",oLocker,1,1);
//scout stuff	
CreateItemOnObject("g_w_blstrpstl001",oLocker,1,1);
CreateItemOnObject("g_i_adrnaline002",oLocker,1,1);
CreateItemOnObject("g_i_implant101",oLocker,1,1);
//scoundrel stuff	
CreateItemOnObject("g_i_secspike01",oLocker,1,1);
CreateItemOnObject("g_i_progspike01",oLocker,1,1);
CreateItemOnObject("g_i_belt010",oLocker,1,1);

}

Link to comment
Share on other sites

The reason for the "if" statements is so that the items from the class the player actually chose aren't doubled.

 

The problem I've been having is that only the first item for a give class spawns for some reason. For example, if I choose Soldier, only a Blaster Pistol is added.

 

Would adding the last two integer fields(you have as 1, 1) to the CreateItemOnObject calls possibly fix it, or do they not matter?

Link to comment
Share on other sites

object CreateItemOnObject(string sItemTemplate, object oTarget=OBJECT_SELF, int nStackSize=1, int nHideMessage = 0);

I still not sure about that "if" but you could try:

void main()
{
  string SOLDIER_WEAPON = "g_w_blstrrfl001";
  string SOLDIER_ITEM01 = "g_i_adrnaline003";
  string SOLDIER_ITEM02 = "g_i_adrnaline001";

  string SCOUT_SCOUNDREL_WEAPON = "g_w_blstrpstl001";
  string SCOUT_ITEM01 = "g_i_adrnaline002";
  string SCOUT_ITEM02 = "g_i_implant101";

  string SCOUNDREL_ITEM01 = "g_i_secspike01";
  string SCOUNDREL_ITEM02 = "g_i_progspike01";

  object oLocker = GetObjectByTag("end_locker01");
  int iClass = GetClassByPosition(1,GetFirstPC());
  if (iClass == CLASS_TYPE_SCOUNDREL)
  {
      CreateItemOnObject(SOLDIER_WEAPON,oLocker,1,1);
      CreateItemOnObject(SOLDIER_ITEM01,oLocker,1,1);
      CreateItemOnObject(SCOUT_ITEM01,oLocker,1,1);
      CreateItemOnObject(SCOUT_ITEM02,oLocker,1,1);
  }
  if (iClass == CLASS_TYPE_SCOUT)
  {
      CreateItemOnObject(SOLDIER_WEAPON,oLocker,1,1);
      CreateItemOnObject(SOLDIER_ITEM01,oLocker,1,1);
      CreateItemOnObject(SCOUNDREL_ITEM01,oLocker,1,1);
      CreateItemOnObject(SCOUNDREL_ITEM02,oLocker,1,1);
  }
  if (iClass == CLASS_TYPE_SOLDIER)
  {
      CreateItemOnObject(SCOUT_SCOUNDREL_WEAPON,oLocker,1,1)  ;
      CreateItemOnObject(SCOUT_ITEM01,oLocker,1,1);
      CreateItemOnObject(SCOUT_ITEM02,oLocker,1,1);
      CreateItemOnObject(SCOUNDREL_ITEM01,oLocker,1,1);
      CreateItemOnObject(SCOUNDREL_ITEM02,oLocker,1,1);
  }
  CreateItemOnObject(SOLDIER_ITEM02,oLocker);

  if (GetHasSkill(SKILL_STEALTH,GetFirstPC()))
  {
      CreateItemOnObject("g_i_belt010",oLocker,1,1);
  }
}

Also check items name because I can't remember right but I think is case sensitive.

Link to comment
Share on other sites

And if so, how would you remove those limits? I've been trying to make a mod that lets you have all three class' starting items in the footlocker in your room when you start a new game, but no matter what I do, aside from the inventory the container is supposed to have, only the first item that my script spawns(Blaster Pistol for Soldiers, Blaster Rifle for Scouts and Scoundrels) shows up.

 

Any suggestions?

 

The problem is that you only get the weapon and not the implant, stims and security/programming spikes, yes? Is the one you posted above a standard script you have modified, or is it a new one you've created? If so, from where is the script fired? If it's a modified standard script, have you checked that the name of the script you put in the override folder is exactly the same as the one it's supposed to replace, and that it's in NCS format and not NSS?

 

I can't see anything wrong with the script you have posted, so my theory is that your modified script isn't used, and that the weapons are spawned by something else.

 

I believe there is an upper limit of roughly 250 inventory items per container that's imposed by the game engine (at least there is in NWN), which you aren't anywhere near in this case. :)

Link to comment
Share on other sites

Yeah, I only get the weapon, not the stims, spikes, implant, or (in cases where I don't put points in stealth at start up) the Stealth Field Generator. It's a new scrip that steals a lot of code from k_inc_end.nss. I have it firing from Trask's initial dialog, when he tells you to hurry up so you can find Bastila. And it is in .ncs, used KotOR Tool's compiler if that makes any difference.

 

I'm also sure that it's my script adding the weapon, since when I try a new game without the script I only get the standard starting inventory.

 

I'm also confused about limits, since like glovemaster, I too have placed my entire inventory into a container on the Ebon Hawk. Maybe its a limit to how much you can put into that specific locker, or a limit a of how much can be added to one locker through scripts. Or maybe there's just some problem that nobody's noticed yet.

Link to comment
Share on other sites

Yeah, I only get the weapon, not the stims, spikes, implant, or (in cases where I don't put points in stealth at start up) the Stealth Field Generator. It's a new scrip that steals a lot of code from k_inc_end.nss. I have it firing from Trask's initial dialog, when he tells you to hurry up so you can find Bastila. And it is in .ncs, used KotOR Tool's compiler if that makes any difference.

 

I'm also sure that it's my script adding the weapon, since when I try a new game without the script I only get the standard starting inventory.

 

I compiled your script (without changing anything in it) and ran it on a test container in my game and everything was added to the box like it should, so I don't think there is anything wrong with the script itself.

 

Make sure your game does indeed run the latest version if your script. Add a debug printout to the Feedback log in the game by adding a line like...

SendMessageToPC(GetFirstPC(), "DEBUG: MY SCRIPT IS RUNNING!");

...as the first line inside your main() function. Then check the feedback log in the game after the script has been running to see if the debug text is present there.

Link to comment
Share on other sites

I added the debug printout like you said, and an additional one as the last line that reads "MY SCRIPT HAS FINISHED". Only the first one printed. Something must be making the script terminate prematurely.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...