N-DReW25 1,336 Posted May 31, 2020 All my efforts to decompile vanilla scripts and even scripts from other people's mods for TSL have all been in-vein. They'd decompile using DeNCS but when I opened them in Kotor Tool text editor and tried to compile it for TSL, even when I didn't even touch the decompiled code, it would always have some form of error preventing me from doing such. The point of me decompiling the scripts was for me to attempt to view the code, see how it works and use it in my own mods but that's seemingly not an option at this time so I've decided to create this thread asking what I would need to do in order to create these scripts for TSL. 1) Dialogue Cutscenes This I imagine should be fairly basic, what I want to create is a cutscene where NPCs walk from where they are standing to a given set of coordinates. From what I can make out from the scripts I've decompiled, their seems to be two ways for this to work, its either a script which makes an NPC walk to the coordinates or a script which makes the NPC walk to a waypoint which would be placed at my coordinates in the git file. 2) Terminal dialogue to normal dialogue If you remember on Telos during your house arrest when you'd access a wall terminal, click the option "accept call" and it'd start a normal conversation separate from the wall terminal. From what I can see from the script which does this all I'd need to do is to put either the tag of the NPC speaking or the name of the dialogue into the correct places in the script to work. 3) Opening doors with a script Through dialogue, I want to create the effect that an NPC is using a security animation to unlock a locked door. Before the convo starts, the door shall be locked and cannot be opened except through this cutscene and shall remain open after the cutscenes end. The script I'd want is one which would turn a door from locked to unlocked and open during said conversation. If anyone would be able to share their scripts for any of these and/or dip their 2 cents into this topic it would be greatly appreciated Quote Share this post Link to post Share on other sites
Thor110 497 Posted May 31, 2020 (edited) 1) Here is an example script I use in one of the levels I am working on that should give you the basics, you will have to work your dialog so that it runs this script only for your NPC on whichever reply you want them to walk away on, you might also then want to use a camera so that the camera doesn't pan wherever it wants while the NPC walks away. Spoiler void main() { object oRodian2 = GetObjectByTag("rodian2", 0); object oRodian1 = GetObjectByTag("rodian1", 0); object oRodian3 = GetObjectByTag("rodian3", 0); object oRodian4 = GetObjectByTag("rodian4", 0); location location1 = Location(Vector((0.1), -14.1, 0.1), 0.0); location location2 = Location(Vector((0.1), -11.5, 0.1), 0.0); location location3 = Location(Vector((-12.6), -10.5, 0.1), 0.0); vector struct4 = Vector(0.1, -15.5, 0.1); location location5 = Location(struct4, 0.0); AssignCommand(oRodian1, ActionMoveToLocation(location1, 0)); AssignCommand(oRodian3, ActionMoveToLocation(location1, 0)); AssignCommand(oRodian4, ActionMoveToLocation(location1, 0)); AssignCommand(oRodian2, ActionMoveToLocation(location3, 0)); AssignCommand(oRodian2, ActionMoveToLocation(location2, 0)); ActionDoCommand(SetCommandable(1, oRodian2)); ActionDoCommand(SetCommandable(1, oRodian1)); ActionDoCommand(SetCommandable(1, oRodian3)); ActionDoCommand(SetCommandable(1, oRodian4)); AssignCommand(oRodian1, ActionMoveToLocation(location5, 0)); AssignCommand(oRodian3, ActionMoveToLocation(location5, 0)); AssignCommand(oRodian4, ActionMoveToLocation(location5, 0)); AssignCommand(oRodian2, ActionMoveToLocation(location5, 0)); //object oDoor = GetObjectByTag("sle99_exit01"); //ActionOpenDoor(oDoor); AssignCommand(oRodian4, ActionOpenDoor(GetObjectByTag("sle99_exit01"))); vector struct5 = Vector(0.1, -17.5, 0.1); location location6 = Location(struct5, 0.0); AssignCommand(oRodian1, ActionMoveToLocation(location6, 0)); AssignCommand(oRodian3, ActionMoveToLocation(location6, 0)); AssignCommand(oRodian4, ActionMoveToLocation(location6, 0)); AssignCommand(oRodian2, ActionMoveToLocation(location6, 0)); AssignCommand(oRodian1, ActionDoCommand(DestroyObject(oRodian1, 0.0, 0, 0.0))); AssignCommand(oRodian3, ActionDoCommand(DestroyObject(oRodian3, 0.0, 0, 0.0))); AssignCommand(oRodian4, ActionDoCommand(DestroyObject(oRodian4, 0.0, 0, 0.0))); AssignCommand(oRodian2, ActionDoCommand(DestroyObject(oRodian2, 0.0, 0, 0.0))); ActionDoCommand(SetCommandable(0, oRodian1)); ActionDoCommand(SetCommandable(0, oRodian3)); ActionDoCommand(SetCommandable(0, oRodian4)); ActionDoCommand(SetCommandable(0, oRodian2)); SetGlobalNumber("SLE_FIREBLOODS",1); } 2) For a computer you just need to set your dialog type to "computer" instead of "human" on the main entry. 3) The first script also opens a door when they get to a certain location. ( you would have to add the animation before opening the door as the NPC gets to the waypoint ) Hopefully that helps. Thor110 Edited May 31, 2020 by Thor110 Quote Share this post Link to post Share on other sites
DarthParametric 3,784 Posted May 31, 2020 41 minutes ago, N-DReW25 said: Kotor Tool [...] what I would need to do Stop using KTool for starters. I swear it creates far more problems than it solves. Use it as a can opener only and you'll have a better time. For script compiling, just call nwnnsscomp directly. Here is a batch script that may be of use: Batch compile NSS Note that each game needs its own version of nwscript.nss, so in practice you'll likely want to have two separate versions that each get called by separate game-specific batch files. 41 minutes ago, N-DReW25 said: Dialogue Cutscenes Yeah, you've summed it up pretty much. You'll note that vanilla scripts always use waypoints, and it seems like there are some subtle reasons for why this is the case. Functionally though there is no real difference, aside from the specific functions you use. One trap for young players though is that an NPC will never get closer than about 1m to a waypoint, even if you set the optional distance value lower. So you may need to offset your waypoints to account for this if you require a high degree of accuracy. This doesn't apply to locations. 41 minutes ago, N-DReW25 said: Terminal dialogue to normal dialogue A DLG has to be set to either human or computer in the root node. So when you need to switch from one to the other you'll have use a script to assign an ActionStartConversation to the appropriate NPC or object. You can specify a DLG directly in the function, so it doesn't need to be attached to the owning object's template. 41 minutes ago, N-DReW25 said: Opening doors with a script What you want to do with that is modify the door's template and set it to require a key. That way it will not get a security interaction popup and can only be opened via script. There is nothing special required on the script side. Just the usual AssignCommand(oDoor, ActionUnlockObject(oDoor)); and AssignCommand(oDoor, ActionOpenDoor(oDoor)); If you lock it again afterwards, there will be no way for the PC to open it. Typically you'll want to attach an OnFailToOpen script and have it fire a BarkString about the door being sealed or whatever. There are a number of vanilla examples. Quote Share this post Link to post Share on other sites