PDA

View Full Version : [K1]Can containers have limits to how much inventory they have?


CA8802
03-03-2007, 02:05 AM
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?

m16965
03-03-2007, 03:16 AM
From my XboX. I don't think they do but even if it is different on the pc, you should be able to spawn the items. The script looks fine so keep using that.

glovemaster
03-03-2007, 03:44 AM
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. ;)

oldflash
03-03-2007, 04:00 AM
"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);

}

CA8802
03-03-2007, 04:57 AM
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?

oldflash
03-03-2007, 05:41 AM
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.

CA8802
03-03-2007, 06:06 AM
So you think it doesn't like else-if statements? I'll try switching it then. I'll post the results in the morning.

stoffe
03-03-2007, 07:41 AM
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. :)

CA8802
03-03-2007, 04:03 PM
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.

stoffe
03-03-2007, 05:17 PM
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.

CA8802
03-03-2007, 05:43 PM
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.