JDub96 54 Posted March 1, 2022 I actually pulled this from the module. I was just checking to see if there was a script about the weapon Shaardan attacks with. Thanks, @DarthParametric. Quote Share this post Link to post Share on other sites
DarthParametric 3,785 Posted March 1, 2022 That was the trigger OnEnter that starts his conversation. Per kor37_shaardan.dlg, the script that turns him hostile is k37_sha_hostile, which cleaned up is: #include "k_inc_generic" void main() { object oSpeaker = GetPCSpeaker(); ChangeToStandardFaction(OBJECT_SELF, STANDARD_FACTION_HOSTILE_1); object oSword = GetItemPossessedBy(OBJECT_SELF, "G_w_VbrDblswd01"); if (GetIsObjectValid(oSword)) { ClearAllActions(); ActionEquipItem(oSword, INVENTORY_SLOT_RIGHTWEAPON, FALSE); } DelayCommand(0.5, GN_DetermineCombatRound(oSpeaker)); SetGlobalNumber("KOR33_SHAARDAN", 4); } I usually just give him a fake sword, which is far more amusing, so I don't think I've ever actually had him turn hostile. But I can see straight away that this is probably going to lead to the very common attacking with fists issue. A change in the order of operations should help prevent that, something like this: #include "k_inc_generic" void main() { object oPC = GetFirstPC(); object oSword = GetItemPossessedBy(OBJECT_SELF, "G_w_VbrDblswd01"); SetPartyLeader(NPC_PLAYER); if (GetIsObjectValid(oSword)) { ClearAllActions(); ActionEquipItem(oSword, INVENTORY_SLOT_RIGHTWEAPON, FALSE); } DelayCommand(0.4, ChangeToStandardFaction(OBJECT_SELF, STANDARD_FACTION_HOSTILE_1)); DelayCommand(0.6, GN_DetermineCombatRound(oPC)); DelayCommand(0.6, AssignCommand(oPC, GN_DetermineCombatRound())); DelayCommand(0.6, AssignCommand(GetPartyMemberByIndex(1), GN_DetermineCombatRound())); DelayCommand(0.6, AssignCommand(GetPartyMemberByIndex(2), GN_DetermineCombatRound())); SetGlobalNumber("KOR33_SHAARDAN", 4); } This is probably something we need to investigate for K1CP. If you are planning on changing his gear, I'd suggest just switching the equip command to ActionEquipMostDamagingMelee() instead, like so: #include "k_inc_generic" void main() { object oPC = GetFirstPC(); SetPartyLeader(NPC_PLAYER); ClearAllActions(); ActionEquipMostDamagingMelee(); DelayCommand(0.4, ChangeToStandardFaction(OBJECT_SELF, STANDARD_FACTION_HOSTILE_1)); DelayCommand(0.6, GN_DetermineCombatRound(oPC)); DelayCommand(0.6, AssignCommand(oPC, GN_DetermineCombatRound())); DelayCommand(0.6, AssignCommand(GetPartyMemberByIndex(1), GN_DetermineCombatRound())); DelayCommand(0.6, AssignCommand(GetPartyMemberByIndex(2), GN_DetermineCombatRound())); SetGlobalNumber("KOR33_SHAARDAN", 4); } Quote Share this post Link to post Share on other sites
JDub96 54 Posted March 1, 2022 Alright. I was going to have him attack with the training saber from Kexikus' mod. Don't I need the decompiled script to make those adjustments? EDIT: Or do I just copy this to Notepad and run it through the compiler? Quote Share this post Link to post Share on other sites
DarthParametric 3,785 Posted March 1, 2022 Yes, that is the script. Save it as an NSS and compile. You'll also need the includes (k_inc_generic, k_inc_gensupport, k_inc_walkways, k_inc_drop) present as well. If you prefer, here's a pre-compiled one using ActionEquipMostDamagingMelee(), so you should be fine to edit his UTC however you like with no further changes. k37_sha_hostile.ncs Quote Share this post Link to post Share on other sites
JDub96 54 Posted March 1, 2022 Wow. Thanks, @DarthParametric. Quote Share this post Link to post Share on other sites
JDub96 54 Posted March 6, 2022 Could I get one more decompile? k_ptar_striparmo.ncs Quote Share this post Link to post Share on other sites
DarthParametric 3,785 Posted March 7, 2022 #include "k_inc_tar" void LockArmour() { object oArmour; oArmour = TAR_StripSithArmor(); if (GetIsObjectValid(oArmour)) { SetItemNonEquippable(oArmour, TRUE); } } void main() { object oEntering = GetEnteringObject(); if (GetIsPC(oEntering)) { DelayCommand(1.0, LockArmour()); } } Quote Share this post Link to post Share on other sites
JDub96 54 Posted March 7, 2022 Dang. I was hoping that was the script that controlled when Gadon takes the Sith armor. I'm trying to edit it so he takes every set in your inventory so I can mod a set in for Carth as well. Quote Share this post Link to post Share on other sites
DarthParametric 3,785 Posted March 7, 2022 That's k_ptar_takearmor: void main() { DestroyObject(GetItemPossessedBy(GetFirstPC(), "ptar_sitharmor")); CreateItemOnObject("ptar_sithpapers", GetFirstPC(), 1); } I already altered this script to handle multiple sets of disguises as part of a mod request - https://github.com/DarthParametric/K1_Taris_Sith_Uniform_Disguise_Extension/blob/master/Source/k_ptar_takearmor.nss Quote Share this post Link to post Share on other sites
JDub96 54 Posted March 7, 2022 Oh! Do I just copy what's on Github into Notepad and run it through compiler or does it have to go through a specific process? Quote Share this post Link to post Share on other sites
DarthParametric 3,785 Posted March 7, 2022 Yeah, or just download the whole mod from the releases page and extract the already compiled NCS. Quote Share this post Link to post Share on other sites
JDub96 54 Posted March 7, 2022 Yeah, I tried to. I couldn't find a way to download the .ncs files. EDIT: Never mind. I'm a dipshit. Hey, does anyone happen to have an uncompiled version of the script that dictates what equipment is placed in the footlocker on the Endar Spire? I wanna make some adjustments. Quote Share this post Link to post Share on other sites
Effix 532 Posted April 11, 2022 void main() { object oEntering = GetEnteringObject(); object oPC=GetFirstPC(); if (GetIsPC(oEntering)) { vector vecCont; vecCont.x = 118.80f; vecCont.y = 74.39f; vecCont.z = 0.0f; int nIdx = 1; location locCont = Location(vecCont, 0.0f); object oContainer = GetNearestObjectToLocation(OBJECT_TYPE_PLACEABLE, locCont, nIdx); while (GetIsObjectValid(oContainer)) { if (GetTag(oContainer) == "tar02_firstaid") { CreateItemOnObject("g_a_class4014", oContainer); break; } oContainer = GetNearestObjectToLocation(OBJECT_TYPE_PLACEABLE, locCont, ++nIdx); } ExecuteScript("org_tar_a02ae", OBJECT_SELF); } } I'm trying to add a custom item (g_a_class4014.uti) to the first aid container in the "Arena" room of the Upper City Cantina on Taris (K1). The script above replaces the onEnter script (k_ptar_a02ae_en) of the area and ends with running the original onEnter script. I got the coordinates from the whereami command and I'm using a save before entering the cantina for the first time. I pretty much combined things from here. Does anyone see why it's not working? Quote Share this post Link to post Share on other sites
TamerBill 135 Posted April 11, 2022 Well, for starters you've made things a lot more complicated than they need to be. You don't need the stuff about checking the entering object, that's for triggers. The only thing that can move to a new area is the player. You don't need to use the coordinates to find the container, because you already know the tag. There's only one container with that tag in the area, so just use that. So we can get it down to just this. void main() { object oContainer = GetObjectByTag("tar02_firstaid"); CreateItemOnObject("g_a_class4014", oContainer); ExecuteScript("org_tar_a02ae", OBJECT_SELF); } Now, you haven't got anything in your script that makes it only fire once, so it'll spawn a new copy of the item every time you enter the area. That'll be the next thing to work on. But assuming g_a_class4014.uti is in the Override that should make it spawn. Quote Share this post Link to post Share on other sites
Effix 532 Posted April 11, 2022 18 minutes ago, TamerBill said: Well, for starters you've made things a lot more complicated than they need to be. You don't need the stuff about checking the entering object, that's for triggers. The only thing that can move to a new area is the player. You don't need to use the coordinates to find the container, because you already know the tag. There's only one container with that tag in the area, so just use that. So we can get it down to just this. void main() { object oContainer = GetObjectByTag("tar02_firstaid"); CreateItemOnObject("g_a_class4014", oContainer); ExecuteScript("org_tar_a02ae", OBJECT_SELF); } Now, you haven't got anything in your script that makes it only fire once, so it'll spawn a new copy of the item every time you enter the area. That'll be the next thing to work on. But assuming g_a_class4014.uti is in the Override that should make it spawn. I'm not surprised that I had some unneeded things lol I've added the boolean trick from the same tutorial page and it doesn't keep adding it every time you enter. Awesome, many thanks! Quote Share this post Link to post Share on other sites
JDub96 54 Posted April 12, 2022 Could I get a decompile, please? k_pend_chest02.ncs Quote Share this post Link to post Share on other sites
DarthParametric 3,785 Posted April 12, 2022 #include "k_inc_end" void main() { object oTrask = sTraskTag(); if (GetXP(GetFirstPC()) == 0) { GivePlotXP("end_tutorial", 5); } if (GetTraskState() < 2) { SetTraskState(2); if (!GetTraskWillInitiate()) { SetTraskWillInitiate(TRUE); DelayCommand(20.0, SignalEvent(oTrask, EventUserDefined(100))); } } } I assume this is from end_m01aa (Endar Spire Command Module)? I didn't download your attachment, just referred to my local copy. Quote Share this post Link to post Share on other sites
JDub96 54 Posted April 12, 2022 It is. I'm looking for the script that dictates the weapons/implants/belts that spawn in the footlocker in the player's quarters. Quote Share this post Link to post Share on other sites
DarthParametric 3,785 Posted April 12, 2022 It's in the module OnEnter. This is the K1CP version, which is mildly tweaked to make sure the fade-in from the opening crawl/level load works correctly. #include "k_inc_end" void main() { if (GetIsPC(GetEnteringObject())) { if (HasNeverTriggered()) { SetGlobalFadeOut(); PlayMovie("01A"); SetReturnStrref(FALSE, 32228, 0); //String 32228 is "Return To Hideout". Should technically be 38550, "Transit Disabled", instead. SetGlobalNumber("K_CURRENT_PLANET", 5); SpawnStartingEquipment(); SetGlobalFadeOut(); NoClicksFor(1.0); DelayCommand(0.1, SetGlobalFadeIn(0.9, 1.5)); DelayCommand(0.1, AssignCommand(GetTrask(), ActionStartConversation(GetFirstPC(), "m01aa_c01", FALSE, CONVERSATION_TYPE_CINEMATIC, TRUE))); SetMinOneHP(GetFirstPC(), TRUE); } } } SpawnStartingEquipment is the Include function (k_inc_end.nss) that you are after: void SpawnStartingEquipment() { object oLocker = GetObjectByTag(LOCKER_TAG); int nClass = GetClassByPosition(1,GetFirstPC()); if(nClass == CLASS_TYPE_SCOUNDREL) { CreateItemOnObject(SCOUNDREL_WEAPON,oLocker); CreateItemOnObject(SCOUNDREL_ITEM01,oLocker); CreateItemOnObject(SCOUNDREL_ITEM02,oLocker); } else if(nClass == CLASS_TYPE_SCOUT) { CreateItemOnObject(SCOUT_WEAPON,oLocker); CreateItemOnObject(SCOUT_ITEM01,oLocker); CreateItemOnObject(SCOUT_ITEM02,oLocker); } else if(nClass == CLASS_TYPE_SOLDIER) { CreateItemOnObject(SOLDIER_WEAPON,oLocker); CreateItemOnObject(SOLDIER_ITEM01,oLocker); CreateItemOnObject(SOLDIER_ITEM02,oLocker); } if(GetHasSkill(SKILL_STEALTH,GetFirstPC())) { CreateItemOnObject(STEALTH_UNIT,oLocker); } } The specific UTI tags are defined in the include's constant list: string SOLDIER_WEAPON = "g_w_blstrrfl001"; string SOLDIER_ITEM01 = "g_i_adrnaline003"; string SOLDIER_ITEM02 = ""; string SCOUT_WEAPON = "g_w_blstrpstl001"; string SCOUT_ITEM01 = "g_i_adrnaline002"; string SCOUT_ITEM02 = "g_i_implant101"; string SCOUNDREL_WEAPON = "g_w_blstrpstl001"; string SCOUNDREL_ITEM01 = "g_i_secspike01"; string SCOUNDREL_ITEM02 = "g_i_progspike01"; string LOCKER_TAG = "end_locker01"; string STEALTH_UNIT = "g_i_belt010"; I'm pretty sure editing the starting items has been covered multiple times on the site (probably even in this thread), and there are several pre-existing mods that already do it. You should try searching for those for some further info. Quote Share this post Link to post Share on other sites
Guest Qui-Gon Glenn Posted April 13, 2022 RedHawke once said.... void main() { float x=81.90f; float y=78.29f; float z=0.00f; float r=90.0f; vector MyVec = Vector(x,y,z); //line 1 location MyLoc = Location(MyVec, r); //line 2 CreateObject(OBJECT_TYPE_PLACEABLE, "footlker069", MyLoc); //line3 CreateItemOnObject("g_w_lghtsbr05", GetObjectByTag("Footlocker69")); CreateItemOnObject("g_a_mstrrobe03", GetObjectByTag("Footlocker69")); CreateItemOnObject("g_w_sbrcrstl04", GetObjectByTag("Footlocker69")); CreateItemOnObject("g_w_sbrcrstl12", GetObjectByTag("Footlocker69")); CreateItemOnObject("g_i_credits014", GetObjectByTag("Footlocker69"), 2); CreateItemOnObject("g_w_sbrcrstl06", GetObjectByTag("Footlocker69"), 2); CreateItemOnObject("g_w_sbrcrstl13", GetObjectByTag("Footlocker69"), 2); CreateItemOnObject("sith_lghtsbr1", GetObjectByTag("Footlocker69")); CreateItemOnObject("sith_frarmbnds1", GetObjectByTag("Footlocker69")); CreateItemOnObject("g2_i_frarmbnds02", GetObjectByTag("Footlocker69")); CreateItemOnObject("sith_sbrcrstl1", GetObjectByTag("Footlocker69")); CreateItemOnObject("g_a_mstrrobe02", GetObjectByTag("Footlocker69")); CreateItemOnObject("sith_belt01", GetObjectByTag("Footlocker69")); CreateItemOnObject("sith_gauntlet01", GetObjectByTag("Footlocker69")); CreateItemOnObject("g2_i_mask14", GetObjectByTag("Footlocker69")); CreateItemOnObject("g_i_implant308", GetObjectByTag("Footlocker69")); } This creates footlocker069 next to the original container. This is ancient modding, so forgive any forming you don't like. This guy was inventing a wheel. To do this, it was inserted into the existing module, and he needed to use the TSLPatcher. If you wanted this to be directly from override, you would need to add some logic. From RedHawke Beginner's Items, https://deadlystream.com/files/file/1679-redhawkes-beginners-item-pack/ Otherwise, you could just modify the script provided by DP. The game only uses that once, so there is no danger in modifying it so long as you don't actually break it illegible code. Quote Share this post Link to post Share on other sites
Reztea 34 Posted October 28, 2022 Hi, I've been trying to make a puppet script for the longest now and when it's time to compile, I'm getting a syntax error at the location line. Not sure whats wrong with it. I even went as far as to get the source scripts for JediArchivist's "[K2] Droid Companion for Mira 1.0.0" mod and try a test compiling and I'm getting the same error. The current script is: // ------------------------------------------------------- // Support function: Assign a puppet to a party member // ------------------------------------------------------- void ST_GivePuppet(int nNPC, int nPUP, string sTemplate) { string sTag = ""; switch (nNPC) { case NPC_ATTON: sTag = "atton"; break; case NPC_BAO_DUR: sTag = "baodur"; break; case NPC_CANDEROUS: sTag = "mand"; break; case NPC_G0T0: sTag = "g0t0"; break; case NPC_HANDMAIDEN: sTag = "handmaiden"; break; case NPC_HK_47: sTag = "hk47"; break; case NPC_KREIA: sTag = "kreia"; break; case NPC_MIRA: sTag = "mira"; break; case NPC_T3_M4: sTag = "t3m4"; break; case NPC_VISAS: sTag = "visasmarr"; break; case NPC_HANHARR: sTag = "hanharr"; break; case NPC_DISCIPLE: sTag = "disciple"; break; } object oOwner = GetObjectByTag(sTag); if (GetIsObjectValid(oOwner) && IsObjectPartyMember(oOwner)) { location lLoc = Location(GetPosition(oOwner) + AngleToVector(GetFacing(oOwner)) * 2.0, GetFacing(oOwner)-180.0); AddAvailablePUPByTemplate(nPUP, sTemplate); AssignPUP(nPUP, nNPC); object oPUP = SpawnAvailablePUP(nPUP, lLoc); AddPartyPuppet(nPUP, oPUP); SetNPCAIStyle(oPUP, NPC_AISTYLE_PARTY_SUPPORT); } } // ------------------------------------------------------- // Main function: Example, call above function to assign // a puppet in st_puppet1.utc to Kreia. // ------------------------------------------------------- void main() { // Spawn the "st_puppet1" UTC as a puppet, assign it to Kreia ST_GivePuppet(NPC_MIRA, PUP_OTHER1, "mira_puppet"); } I'm SUPER rusty at modding at the moment so go easy on me LOL. But yeah for some reason "lLoc" is not allowing the script to compile. Quote Share this post Link to post Share on other sites
DarthParametric 3,785 Posted October 29, 2022 The include function itself is fine, although you don't need the main. Post the other script. Edit: I thought the first script was an include. My mistake. Quote Share this post Link to post Share on other sites
Reztea 34 Posted October 29, 2022 Here's both scripts Script 1: // ------------------------------------------------------- // Support function: Assign a puppet to a party member // ------------------------------------------------------- void ST_GivePuppet(int nNPC, int nPUP, string sTemplate) { string sTag = ""; switch (nNPC) { case NPC_ATTON: sTag = "atton"; break; case NPC_BAO_DUR: sTag = "baodur"; break; case NPC_CANDEROUS: sTag = "mand"; break; case NPC_G0T0: sTag = "g0t0"; break; case NPC_HANDMAIDEN: sTag = "handmaiden"; break; case NPC_HK_47: sTag = "hk47"; break; case NPC_KREIA: sTag = "kreia"; break; case NPC_MIRA: sTag = "mira"; break; case NPC_T3_M4: sTag = "t3m4"; break; case NPC_VISAS: sTag = "visasmarr"; break; case NPC_HANHARR: sTag = "hanharr"; break; case NPC_DISCIPLE: sTag = "disciple"; break; } object oOwner = GetObjectByTag(sTag); if (GetIsObjectValid(oOwner) && IsObjectPartyMember(oOwner)) { location lLoc = (GetPosition(oOwner) + AngleToVector(GetFacing(oOwner)) * 2.0, GetFacing(oOwner)-180.0); AddAvailablePUPByTemplate(nPUP, sTemplate); AssignPUP(nPUP, nNPC); object oPUP = SpawnAvailablePUP(nPUP, lLoc); AddPartyPuppet(nPUP, oPUP); SetNPCAIStyle(oPUP, NPC_AISTYLE_PARTY_SUPPORT); } } // ------------------------------------------------------- // Main function: Example, call above function to assign // a puppet in st_puppet1.utc to Kreia. // ------------------------------------------------------- void main() { // Spawn the "st_puppet1" UTC as a puppet, assign it to Kreia ST_GivePuppet(NPC_MIRA, PUP_OTHER1, "mira_puppet"); } Script 2 // ST: st_ai_puppethb.nss #include "k_inc_generic" void main() { object oEnemy = GetNearestCreature( CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN, OBJECT_SELF, 1, CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY, CREATURE_TYPE_IS_ALIVE, TRUE ); if (!GN_GetSpawnInCondition(SW_FLAG_AI_OFF)) { if (GetIsPuppet() && (GetIsObjectValid(GetPUPOwner()) && (GetCurrentAction(OBJECT_SELF) != ACTION_MOVETOPOINT) && (GetCurrentAction(OBJECT_SELF) != ACTION_FOLLOWOWNER) && !GetIsConversationActive() && !GN_GetSpawnInCondition(SW_FLAG_SPECTATOR_STATE) && GetCommandable() && (GetDistanceBetween2D(OBJECT_SELF, GetPUPOwner()) > 3.0) && (!GetIsObjectValid(oEnemy) || (GetDistanceBetween(oEnemy, OBJECT_SELF) > 20.0)))) { ClearAllActions(); ActionFollowOwner(2.0); } } if (GN_GetSpawnInCondition( SW_FLAG_EVENT_ON_HEARTBEAT )) SignalEvent(OBJECT_SELF, EventUserDefined(1001)); } Neither compiles though they're source scripts straight from the modder themselves. Quote Share this post Link to post Share on other sites
DarthParametric 3,785 Posted October 29, 2022 They compile fine directly on my end, as long as you use the version of the first script you posted originally. You left out the leading Location the second time you posted it - i.e. it should be location lLoc = Location(GetPosition(oOwner) + AngleToVector(GetFacing(oOwner)) * 2.0, GetFacing(oOwner)-180.0); not location lLoc = (GetPosition(oOwner) + AngleToVector(GetFacing(oOwner)) * 2.0, GetFacing(oOwner)-180.0); Quote Share this post Link to post Share on other sites
Reztea 34 Posted October 29, 2022 That's strange... I wonder why it won't compile on my end. Should I re-install KotOR2? I tried using both game modes and all with no luck. Quote Share this post Link to post Share on other sites