Taunger Posted April 20, 2012 Share Posted April 20, 2012 Hi! I've recently picked up scripting for the first time, since I've been wanting to do a little modding that way. Specifically, I'm trying to alter the scene that introduces Davik Kang. Keep in mind that my goal is to do a video capture of the scene, so it doesn't have to necessarily have to work perfectly in-game, as long as the characters do what I'm trying to get them to. And again, I am a total n00b at scripting, but here goes nothin': I took the DLG file ("tar08_davik081"), then added three entries above the entry where it normally starts. The first entry simply runs the script that normally runs in the first entry ("k_ptar_davfadein"). The second entry's script should place Davik and Calo out of view, behind a door. The third entry's script should open that door, and then have Davik walk through the door and, after a slight pause, have Calo walk through it too. While both walk to the location where they normally are in the scene, the door should close. When they reach their locations, the scene should continue as normal. ("So, Canderous - I see you have brought someone with you!") The two scripts I've made for these entries are as follows (these are my first scripts ever, so please don't laugh ): void main() { object oDavik = GetObjectByTag("tar08_davik081"); vector vStartDavik = Vector(70.0, 125.0, 0.0); location lStartDavik = Location(vStartDavik, 0.0); object oCalo = GetObjectByTag("tar08_calo081"); vector vStartCalo = Vector(72.0, 127.0, 0.0); location lStartCalo = Location(vStartCalo, 0.0); AssignCommand(oDavik, JumpToLocation(lStartDavik)); AssignCommand(oCalo, JumpToLocation(lStartCalo)); } void main() { object oDavik = GetObjectByTag("tar08_davik081"); vector vDestinationDavik = Vector(55.1257476806641, 104.52611541748, 0.0); location lDestinationDavik = Location(vDestinationDavik, 0.0); object oCalo = GetObjectByTag("tar08_calo081"); vector vDestinationCalo = Vector(62.3564224243164, 104.714508056641, 0.0); location lDestinationCalo = Location(vDestinationCalo, 0.0); int bRun=FALSE; AssignCommand(oDavik, ActionMoveToLocation(lDestinationDavik, bRun=FALSE)); DelayCommand(1.0, AssignCommand(oCalo, ActionMoveToLocation(lDestinationCalo, bRun=FALSE))); } Both scripts compiled fine, but they didn't do anything in game. The scene did continue as normal. Note that I gave both scripts the names of two existing scripts from the same module (specifically "k_ptar_opencage" & "k_ptar_openhang", I didn't think it would conflict with the specific dialog I'm trying to modify) and put them in the Override folder, along with the modified "tar08_davik081.dlg". Also, commands to open and close the door are obviously missing here, but the scripts didn't do anything either when I set all locations within same room, e.g. "vector vStartCalo = Vector(70.0, 119.0, 0.0);" and "vector vDestinationCalo = Vector(60.0, 119.0, 0.0);". I couldn't find unique tags of doors in the GIT file, so I'm not even sure how to target a specific door. I did look through nwscript.nss and found these: void DoDoorAction(object oTargetDoor, int nDoorAction); int DOOR_ACTION_OPEN = 0; int ACTION_OPENDOOR = 5; int ACTION_CLOSEDOOR = 6; …but I don't know how to implement them, if those even are what I'm looking for. Heh, I'm not even sure what I'm trying to do is possible. Is it? Link to comment Share on other sites More sharing options...
Fastmaniac Posted April 21, 2012 Share Posted April 21, 2012 Well, I haven't tried the scripts ingame. But I would have paused the actual conversation inside the scripts, so that it doesn't rush through the 'Continue' Nodes. You can do that by adding ActionPauseConversation; (Script Content) ActionResumeConversation; It's worth a try. Now to the doors: That function seems to be right. You just need to know the object's 'Tag' and you can implement it in your script: object oDoor = GetObjectByTag('TAG_OF_DOOR'); void DoDooraction(oDoor, 5); // open void DoDooraction(oDoor, 6); // close That should do the trick... Greetz Fastmaniac Link to comment Share on other sites More sharing options...
Hassat Hunter Posted April 21, 2012 Share Posted April 21, 2012 Delays in .dlg work too. Example script from KOTOR2 (so no guarantee it's the same in 1) object oDoor5 = GetObjectByTag("Dantooine Door 5", 0); AssignCommand(oDoor5, ActionCloseDoor(oDoor5)); and object oDoor5 = GetObjectByTag("Dantooine Door 5", 0); DelayCommand(0.5, AssignCommand(oDoor5, ActionOpenDoor(oDoor5))); Link to comment Share on other sites More sharing options...
Taunger Posted April 21, 2012 Author Share Posted April 21, 2012 Thanks for the replies! Sadly, the scripts still don't seem to do anything. I modified them as such: void main() { ActionPauseConversation(); object oDavik = GetObjectByTag("tar08_davik081"); vector vStartDavik = Vector(70.0, 125.0, 0.0); location lStartDavik = Location(vStartDavik, 0.0); object oCalo = GetObjectByTag("tar08_calo081"); vector vStartCalo = Vector(72.0, 127.0, 0.0); location lStartCalo = Location(vStartCalo, 0.0); AssignCommand(oDavik, JumpToLocation(lStartDavik)); AssignCommand(oCalo, JumpToLocation(lStartCalo)); ActionResumeConversation(); } void main() { ActionPauseConversation(); object oDavik = GetObjectByTag("tar08_davik081"); vector vDestinationDavik = Vector(55.1257476806641, 104.52611541748, 0.0); location lDestinationDavik = Location(vDestinationDavik, 0.0); object oCalo = GetObjectByTag("tar08_calo081"); vector vDestinationCalo = Vector(62.3564224243164, 104.714508056641, 0.0); location lDestinationCalo = Location(vDestinationCalo, 0.0); int bRun=FALSE; object oDoor = GetObjectByTag("ptar_davdoor"); DelayCommand(1.0, DoDoorAction(oDoor, 5)); DelayCommand(3.0, AssignCommand(oDavik, ActionMoveToLocation(lDestinationDavik, bRun=FALSE))); DelayCommand(4.0, AssignCommand(oCalo, ActionMoveToLocation(lDestinationCalo, bRun=FALSE))); ActionResumeConversation(); } Link to comment Share on other sites More sharing options...
Hassat Hunter Posted April 21, 2012 Share Posted April 21, 2012 Well, the fault could also be in your .dlg file. Care to upload it for me to check? Link to comment Share on other sites More sharing options...
Taunger Posted April 21, 2012 Author Share Posted April 21, 2012 This link should work: https://docs.google.com/open?id=0B4GdoCqrYAmZekN0Z09aVURKNkU EDIT: In case anyone wants to actually try to run the dialog/scripts, these are the animated cameras I made to go along with it: for the MDL file: https://docs.google.com/open?id=0B4GdoCqrYAmZci03TkdPQlRHOXM, for the MDX file: https://docs.google.com/open?id=0B4GdoCqrYAmZOC1FeTY5LVdCWHc. You can just put them in Override along with the DLG and script files. P.S. Yes, I know the first one isn't a very good camera move , but at least it shows whether Davik and Calo are moved. Link to comment Share on other sites More sharing options...
Hassat Hunter Posted April 22, 2012 Share Posted April 22, 2012 Why do you have waitflags set? Also seems like your first node could use a delay... otherwise the fade-in doesn't really work well... or so it would seem to me. Link to comment Share on other sites More sharing options...
Taunger Posted April 22, 2012 Author Share Posted April 22, 2012 The WaitFlags are so it waits until the camera moves are finished. The fade-in works fine, it continues into the second entry's camera move. Anyway, I still have no clue what could be hampering the scripts. Link to comment Share on other sites More sharing options...
Hassat Hunter Posted April 23, 2012 Share Posted April 23, 2012 While I do not mod KOTOR1 and have never worked with Waitflags, looking them up here has Tupac stating they delay the node until the animated camera is done with "1". Which may be your problem here, the script triggering after the animated scene is done, and so no opening door can be seen. As said, try delays instead (so waitflag 0). Does it work now? Link to comment Share on other sites More sharing options...
Taunger Posted April 23, 2012 Author Share Posted April 23, 2012 Sadly, the scripts still don't seem to run. Here's the modified file: https://docs.google.com/open?id=0B4GdoCqrYAmZNzRzWlhhbFVDanM Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.