N-DReW25

How did SpaceAlex make his K1 Enhancement Pack NPC Overhaul?

Recommended Posts

As the K1 Enhancement Pack is a modders resource according to the readme I am trying to salvage the NPC Overhaul component of that mod and add it to a Demo of a certain mod I am making. The problem I am encountering is SpaceAlex the author clearly didn't want to use .mod files in his mod so it appears he's used scripts. I think I found the right script I am looking for "k_ptat17_enter.ncs" but when I drop that into the override of my mod it spawns most of the NPC's in groups of 50 dropping my 60 fps to about 11 fps. It appears that is the right one because there are groups of children and women something the Enchantment pack had and vanilla didn't.

 

I simply would like a resolution to how I can fix the group of 50 problem and what's causing it.

Share this post


Link to post
Share on other sites

My guess would be that the script is just set to spawn 50 NPCs, so the solution would be to reduce that number in the script.

 

Try decompiling it with DeNCS and compare it to the vanilla script to find what was added. There are probably 50 NPC spawns in there. Decrease that number and you'll probably be fine.

Share this post


Link to post
Share on other sites

My guess would be that the script is just set to spawn 50 NPCs, so the solution would be to reduce that number in the script.

 

Try decompiling it with DeNCS and compare it to the vanilla script to find what was added. There are probably 50 NPC spawns in there. Decrease that number and you'll probably be fine.

I decompiled the script and it appears to be working

 

void main() {
object oEntering = GetEnteringObject();
object oPC = GetFirstPC();
object oTat17_maanatrig = GetObjectByTag("tat17_maanatrig", 0);
object oTat17_news_01 = GetObjectByTag("tat17_news_01", 1);
object object9 = GetObjectByTag("tat17_news_01", 2);
object object11 = GetObjectByTag("tat17_news_01", 0);
object object13 = GetObjectByTag("tat17_news_01", 4);
object oTat17_12comm_01 = GetObjectByTag("tat17_12comm_01", 1);
object object17 = GetObjectByTag("tat17_12comm_01", 2);
object oTat17_12trade_01 = GetObjectByTag("tat17_12trade_01", 1);
object oTat17_12trade_03 = GetObjectByTag("tat17_12trade_03", 0);
if (GetIsPC(oEntering)) {
ExecuteScript("old_17_enter", GetArea(OBJECT_SELF), 0xFFFFFFFF);
ExecuteScript("cd2", GetArea(OBJECT_SELF), 0xFFFFFFFF);
}
if ((GetGlobalBoolean("TAT17AA_ENTER") == 0)) {
DelayCommand(0.1, DestroyObject(oTat17_news_01, 0.0, 0, 0.0));
DelayCommand(0.1, DestroyObject(object9, 0.0, 0, 0.0));
DelayCommand(0.1, DestroyObject(object11, 0.0, 0, 0.0));
DelayCommand(0.1, DestroyObject(object13, 0.0, 0, 0.0));
DelayCommand(0.1, DestroyObject(oTat17_12comm_01, 0.0, 0, 0.0));
DelayCommand(0.1, DestroyObject(object17, 0.0, 0, 0.0));
DelayCommand(0.1, DestroyObject(oTat17_12trade_01, 0.0, 0, 0.0));
DelayCommand(0.1, DestroyObject(oTat17_12trade_03, 0.0, 0, 0.0));
location location1 = Location(Vector(128.63, 94.0, 3.75), 0.0);
CreateObject(1, "tat17_news_02", location1, 0);
location location3 = Location(Vector(232.49, 116.83, 3.74), 0.0);
CreateObject(1, "tat17_news_03", location3, 0);
location location5 = Location(Vector(122.43, 111.34, 3.75), 0.0);
CreateObject(1, "tat17_news_04", location5, 0);
location location7 = Location(Vector(104.35, 120.17, 3.75), 0.0);
CreateObject(1, "tat17_news_05", location7, 0);
location location9 = Location(Vector(152.89, 60.38, 3.75), 0.0);
CreateObject(1, "tat17_12comm_02", location9, 0);
location location11 = Location(Vector(199.0, 90.16, 3.75), 0.0);
CreateObject(1, "tat17_12comm_03", location11, 0);
location location13 = Location(Vector(125.1, 112.75, 3.75), 0.0);
CreateObject(1, "tat17_12comm_04", location13, 0);
location location15 = Location(Vector(100.15, 115.7, 3.75), 0.0);
CreateObject(1, "tat17_12comm_05", location15, 0);
location location17 = Location(Vector(152.17, 80.79, 3.75), 0.0);
CreateObject(1, "tat17_12comm_06", location17, 0);
location location19 = Location(Vector(231.32, 98.28, 3.75), 90.0);
CreateObject(1, "tat17_12trade_03", location19, 0);
location location21 = Location(Vector(156.51, 84.25, 3.74), 0.0);
CreateObject(1, "tat17_child_01", location21, 0);
location location23 = Location(Vector(158.51, 86.25, 3.74), 0.0);
CreateObject(1, "tat17_child_02", location23, 0);
location location25 = Location(Vector(150.51, 78.25, 3.75), 0.0);
CreateObject(1, "tat17_droidprot", location25, 0);
SetGlobalBoolean("TAT17AA_ENTER", 1);
}
}

 
Unless I am wrong it appears to be doing what it "should" be doing. You wouldn't mind play testing the script out on your system to see if 50 NPC's spawn on your end would you? 

Script.zip

Share this post


Link to post
Share on other sites

I can't really test it with only the script. I'll also need the .uti files and the two scripts that are executed by this script.

It might be worth checking the "cd2" script too as that could be a mod-added script as well.

Share this post


Link to post
Share on other sites

I can't really test it with only the script. 

 

I'll also need the .uti files and the two scripts that are executed by this script.

It might be worth checking the "cd2" script too as that could be a mod-added script as well.

Well I think I found my problem. I've only dropped that one script into my override.

 

post-23972-0-34260200-1504865129_thumb.gif

 

Alright, I got "old_17_enter" but I cannot find "cd2" and I do not know what uti files you are referring to.

Script 2.zip

Share this post


Link to post
Share on other sites

The missing "cd2" is weird but it's a mod script so it should only result in too few NPCs spawning and not too many if it's not there.

Not having "old_17_enter" in your Override would have caused problems for sure as that's the vanilla OnEnter script that's required for a lot of things but that doesn't cause the spawn of too many NPCs.

 

Whoops, I meant .utc files... The script spawns NPCs using a tag from a template. That template is a .utc file and I assume that those are not vanilla, so they must be somewhere in the mod archive, right? And without those the NPCs won't spawn on my end.

Share this post


Link to post
Share on other sites

Whoops, I meant .utc files... The script spawns NPCs using a tag from a template. That template is a .utc file and I assume that those are not vanilla, so they must be somewhere in the mod archive, right? And without those the NPCs won't spawn on my end.

Alright, I have found the utc files. Just a warning I have placed the "old_17_enter", "k_ptat17_enter" and the utc files into my override and it still spawns 50 NPC's.

Script 3.zip

Share this post


Link to post
Share on other sites

If I had, I would have told you ;)

 

But now that I did: I also have the same problem: Tons on NPCs spawning in large groups of clones.

 

You need to add TAT17AA_ENTER as a Boolean to your globalcat.2da. Then it'll work.

 

Makes sense that you have to do that but I don't quite get why this is the result of not adding it.

I would have thought that GetGlobalBoolean returns either FALSE or an error when checking for a non existing boolean. Then the condition would either always be true, resulting in new spawns every time you enter instead of only the first one or it'd always be FALSE, resulting in no spawns. But apparently checking for a non existing boolean creates other problems...

Share this post


Link to post
Share on other sites

Makes sense that you have to do that but I don't quite get why this is the result of not adding it.

I would have thought that GetGlobalBoolean returns either FALSE or an error when checking for a non existing boolean. Then the condition would either always be true, resulting in new spawns every time you enter instead of only the first one or it'd always be FALSE, resulting in no spawns. But apparently checking for a non existing boolean creates other problems...

 

Apparently, it returns 0 if the global doesn't exist (I also tested in TSL, same thing).

 

The reason why you get so many is because the onEnter script runs that many times. The onEnter script runs for several objects; for this reason, most onEnter area scripts have something like this somewhere in the beginning:

if(GetEnteringObject() != GetFirstPC()) return;

This'll ensure that anything that comes after this will only run once. The script in question enclosed a portion of the script into if(GetIsPC(oEntering)){ ... } for that reason, but not the part that spawns the creatures – that part was relying on a global to make sure it only runs once. But if the global doesn't exist it can't be set to true, so the check came out as true every time the script fired.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.