PDA

View Full Version : Compatability Between Mods?


5th_horseman
03-03-2007, 04:02 AM
I am trying to make RedHawke's Kamino Eugenics Chamber mod and Envida Complete Mods compatable, they both mods I like and I want to be able to use the both at the same time. Both install by copying files to the override, unfortunately both install a medlab in medbay. Please note this is my first attempt at modding Kotor .

I've determined which files are going to give me problems, and these are:-

003_ebo_enter.ncs (57 Kb), k_003ebo_enter.ncs (1 Kb) and ev_ebo_medbench.ncs in Envida Complete Mods.

k_003ebo_enter.ncs (57 Kb),and 003_onenter_hook.ncs (2 Kb) in RedHawke's Kamino Eugenics Chamber mod.

Question 1. What is the difference between 003_ebo_enter.ncs (EVC) and k_003ebo_enter.ncs (RH KEC) files ? I'm guessing not much, because of the files size, but the k_ means what?

I'm unable to check the source on 003_ebo_enter.ncs (EVC), but checking the source for k_003_ebo_enter.ncs (EVC) appears to excute the scripts that spawn items in the mod.

Checking the source for k_003ebo_enter.ncs (RH KEC) shows a lot about cutscenes and when they should be played and a line that excutes 003_onenter_hook.ncs in which part of the source shows the spawning of a medlab.

I know almost nothing of modding or scripting, so I'm guessing if I graft the code from the source of k_003_ebo_enter.ncs (EVC) minus the line that spawns a medlab into the source for 003_onenter_hook.ncs and compile it as such. This will give me a script that will all the items of both mods.


By not installing 003_ebo_enter.ncs (57 Kb), k_003ebo_enter.ncs (1 Kb) and ev_ebo_medbench.ncs in Envida Complete Mods and using k_003ebo_enter.ncs (RH KEC) and the modified 003_onenter_hook.ncs file should give me compatability? Am I on the right track?

stoffe
03-03-2007, 07:21 AM
I know almost nothing of modding or scripting, so I'm guessing if I graft the code from the source of k_003_ebo_enter.ncs (EVC) minus the line that spawns a medlab into the source for 003_onenter_hook.ncs and compile it as such. This will give me a script that will all the items of both mods.


By not installing 003_ebo_enter.ncs (57 Kb), k_003ebo_enter.ncs (1 Kb) and ev_ebo_medbench.ncs in Envida Complete Mods and using k_003ebo_enter.ncs (RH KEC) and the modified 003_onenter_hook.ncs file should give me compatability? Am I on the right track?

Pretty much, k_003_ebo_enter is the name of the script that is fired whenever the player enters the Ebon Hawk. It handles all the cutscenes with your party members on the Ebon Hawk, as well as the appearance of Visas etc. Envida's mod does not modify this script directly, it replaces it entirely with a custom script with the same name, which then fires a renamed copy of the original script.

So if you copy all the lines inside the main() function of Envida's k_003_ebo_enter variant, except the ExecuteScript() line that fires 003_ebo_enter (since the Redhawke variant of that script has already been run by then) into 003_onenter_hook it should work.

Then recompile the modified 003_onenter_hook and put the resulting NCS file along with k_003_ebo_enter from Redhawke's mod in your override folder. :)

5th_horseman
03-03-2007, 12:28 PM
Thanks! My coding skills are very basic, like as in did basic twenty years ago!

At least I can cut and paste, now all I have to is follow the instructions in "How to compile a script" tutorial and I'll be on my merry way.

I intended to add this block of code to to bottom 003_onenter_hook.nss, but I wonder is the section from "// check for global variable" required or will it be required to be altered. The final line "ExecuteScript("003_ebo_enter", OBJECT_SELF);" in Envida's mod "003ebo_enter.nss" contained all that is Red Hawk's "k_003ebo_enter.nss" which I will be using, or should I change the final line to "ExecuteScript("k_003_ebo_enter", OBJECT_SELF);"

//::Orginal FileName: k_003ebo_enter.nss
//:: Author: envida@gmail.com amended by 5th_horseman
//:: Created: 10 FEB 2005
//:: Updated: 28 FEB 2005 - added check for a global variable and loading different scripts
//:: Updated: 13 MAR 2005 - added a new script called ev_ebo_storage
//:: Amended to Red Hawk's 003_onenter_hook.nss 03 March 2007
//:: Purpose: Comparability between ev_combined_mods and Kamino Eugenics Chamber
//:: Description: allows for launching extra scripts when entering a area along with the original enter script

void main() {

// launch Ebon Hawk Smugglers Compartment Mod
ExecuteScript("ev_ebo_storage", OBJECT_SELF);
ExecuteScript("ev_ebo_container", OBJECT_SELF);
ExecuteScript("ev_ebo_smugcomp", OBJECT_SELF);

// check for global variable
if (GetGlobalNumber("301NAR_Red_Eclipse_At") == 1)
{
// launch original "k_003ebo_enter" script
ExecuteScript("004_ebo_enter", OBJECT_SELF);
}
else
{
// launch original "k_003ebo_enter" script
ExecuteScript("003_ebo_enter", OBJECT_SELF);
}
}

Finally when I have tested it and if it works, should I post what changes were required to produce compatibility for others to use if they wish or would this be infringing on the original authors works?

stoffe
03-03-2007, 12:53 PM
I intended to add this block of code to to bottom 003_onenter_hook.nss, but I wonder is the section from "// check for global variable" required or will it be required to be altered. The final line "ExecuteScript("003_ebo_enter", OBJECT_SELF);" in Envida's mod "003ebo_enter.nss" contained all that is Red Hawk's "k_003ebo_enter.nss" which I will be using, or should I change the final line to "ExecuteScript("k_003_ebo_enter", OBJECT_SELF);"


It should be enough to add this inside the main() function in the 003_onenter_hook script:


// launch Ebon Hawk Smugglers Compartment Mod
ExecuteScript("ev_ebo_storage", OBJECT_SELF);
ExecuteScript("ev_ebo_container", OBJECT_SELF);
ExecuteScript("ev_ebo_smugcomp", OBJECT_SELF);


The part wrapped in the global variable check is used to fire the renamed copy of the original script, which will not be needed if you use Redhawke's variant of k_003ebo_enter (since there is no renamed script used). The check is there to handle the scene with the Red Eclipse slavers.

(Explanation:
The invaded Ebon Hawk uses a separate area, but the scripts that are fired when those areas are entered are named the same thing (though the content is different). If k_003ebo_enter was put in the override folder without taking this into account the Red Eclipse area would be broken, since files in the override folder has higher priority than files with the same names inside area modules.

Envida solves this by renaming the script for the Red Eclipse Ebon Hawk, and checking if the player is entering that area. The script Redhawke's mod uses has merged those two scripts into one already that checks which area is active internally.)

5th_horseman
03-03-2007, 01:15 PM
This is the script I will use then you see any bugs?

Edited 06-03-07 found a bug and posting corrected version,

// ---------------------------------------------------------------
// 003_onenter_hook.nss
// Fired from k_003ebo_enter after the Hawk has been refreshed.
// ---------------------------------------------------------------
// Last changed: 03 Mar 2007
// ---------------------------------------------------------------

void SpawnMedlabBench();
void SpawnKEC();
void SpawnHKPartsBin();

// ---------------------------------------------------------------
// ST: Extra things to do when entering the Ebon Hawk...
// ---------------------------------------------------------------
void main() {
// ST: Spawn a lab workbench in the medbay...
SpawnMedlabBench();

// RH: Spawn a KEC in the cargo bay...
SpawnKEC();

// ST: Spawn HK repair parts after having left Telos Academy.
if ((GetGlobalNumber("262TEL_Escape_Telos") > 0) && !IsAvailableCreature(NPC_HK_47))
SpawnHKPartsBin();


//allows for launching envida's compleate mod scripts when entering a area.
ExecuteScript("ev_ebo_storage", OBJECT_SELF);
ExecuteScript("ev_ebo_container", OBJECT_SELF);
ExecuteScript("ev_ebo_smugcomp", OBJECT_SELF);

}


// ---------------------------------------------------------------
// ST: Spawn a medlab workbench in the Ebon Hawk Medical bay.
// ---------------------------------------------------------------
void SpawnMedlabBench() {
object oLab = GetObjectByTag("MedBen");
if (!GetIsObjectValid(oLab)) {
oLab = CreateObject( OBJECT_TYPE_PLACEABLE, "plc_workb_med", Location([42.46, 39.10, 1.8], 90.0) );
}
}

// ---------------------------------------------------------------
// RH: Spawn a KEC in the Ebon Hawk Cargo bay.
// ---------------------------------------------------------------
void SpawnKEC() {
object oKEC = GetObjectByTag("rh_kec01");
if (!GetIsObjectValid(oKEC)) {
oKEC = CreateObject( OBJECT_TYPE_PLACEABLE, "rh_kec01", Location([33.51, 37.89, 1.75], 220.0) );
}
}

// ---------------------------------------------------------------
// ST: Spawns a plasteel cylinder containing HK repair parts in
// the closet containing the deactivated HK47.
// ---------------------------------------------------------------
void SpawnHKPartsBin() {
location lLoc = Location([54.09, 53.50, 1.8], -3.0);
int nIdx = 0;
int bFound = FALSE;

object oBin = GetObjectByTag("MilHighPlstcCylin", nIdx);
while (GetIsObjectValid(oBin)) {
if (VectorMagnitude(GetPosition(oBin) - GetPositionFromLocation(lLoc)) < 1.0) {
bFound = TRUE;
break;
}
oBin = GetObjectByTag("MilHighPlstcCylin", ++nIdx);
}

if (!GetIsObjectValid(oBin) || !bFound) {
oBin = CreateObject( OBJECT_TYPE_PLACEABLE, "g_tresmilhig005", lLoc );

if (GetIsObjectValid(oBin)) {
RemoveHeartbeat(oBin);

CreateItemOnObject("hkpart01", oBin);
CreateItemOnObject("hkpart02", oBin);
CreateItemOnObject("hkpart03", oBin);
CreateItemOnObject("hkpart04", oBin);
CreateItemOnObject("hkpart05", oBin);
}
}
}


I'm currently playing using thing compiled into 003_onenter_hook.ncs and everything has spawned correctly so far.