DiePutinDie 4 Posted May 9, 2022 Is it possible to program gui events, for example when i switch character in inventory menu, can i attach some script to this action? Quote Share this post Link to post Share on other sites
DarthParametric 3,777 Posted May 9, 2022 As far as I know, the party selection screen is the only GUI to have something like that, but even then only when opened via script in the first place (the ShowPartySelectionGUI function allows you to define an exit script). Quote Share this post Link to post Share on other sites
DiePutinDie 4 Posted May 9, 2022 (edited) I have some exp with Dragon Age Origins modding, some things in Kotor not equal, but very similar. In DAO almost on every action (open inventory, cast spell, attacking) firing some event, you can hook that event and add some custom code to it, which exeute every time when this event fires. Something similar here? https://nwn.fandom.com/wiki/Module_event something similar in nwn if i understand it right, dont have exp with nwn. Cant find something like this in kotor scripts. Edited May 9, 2022 by DiePutinDie Quote Share this post Link to post Share on other sites
DarthParametric 3,777 Posted May 10, 2022 A module's IFO has provision for specifying OnXYZ event scripts for most of those, although I don't know how many of them actually function aside from the specific module events, since most are left blank in the vanilla modules. Odyssey has a lot of leftover Aurora (NWN) stuff. Quote Share this post Link to post Share on other sites
TamerBill 135 Posted May 10, 2022 Pretty sure they're all dummied NWN hooks, but it would be pretty funny if they worked all along and no-one had ever checked. Okay, so I went and tested them just to be sure, and they do actually work if you put a script in them. Minus the ones which obviously can't trigger in KotOR like the multiplayer ones, anyway. It'd be a bit of a pain to fill them up for every module to get consistent behaviour, but this is actually a pretty big deal in terms of what new feats can be added. The onPlayerLevelUp hook especially. But this doesn't really help the OP, because there's very little GUI stuff in there. 1 Quote Share this post Link to post Share on other sites
DiePutinDie 4 Posted May 10, 2022 (edited) Spoiler I found script which probably do what i want - k_hen_leadchng.ncs, im sucessfully decompiled it and add AdjustAlignment function just to test its working. Do you know more polished way to do such tests? Some logging maybe? PrintString in nwscript.nss? Is it possible to turn on logging? Spoiler Edited May 10, 2022 by DiePutinDie Quote Share this post Link to post Share on other sites
Masamune753 38 Posted May 11, 2022 5 hours ago, TamerBill said: Pretty sure they're all dummied NWN hooks, but it would be pretty funny if they worked all along and no-one had ever checked. Okay, so I went and tested them just to be sure, and they do actually work if you put a script in them. Minus the ones which obviously can't trigger in KotOR like the multiplayer ones, anyway. It'd be a bit of a pain to fill them up for every module to get consistent behaviour, but this is actually a pretty big deal in terms of what new feats can be added. The onPlayerLevelUp hook especially. But this doesn't really help the OP, because there's very little GUI stuff in there. Wait, so if you were willing to edit every relevant module (which might be all of them), you could add additional scripts to specific locations and events? That does feel huge. Off the top of my head you could... Add AOE damage on story relevant location (The Ravager, poison rooms, etc.) Send the PC to jail/or healing room on a death event Turn NPCs hostile if you are wielding certain items (Red lightsabers, Revan robes, Jedi Robes, etc.) in specific areas Quote Share this post Link to post Share on other sites
DarthParametric 3,777 Posted May 11, 2022 4 hours ago, DiePutinDie said: Some logging maybe? PrintString in nwscript.nss? Is it possible to turn on logging? No. The debug features require the debug build. We have the shipping build in which all the debug features were stripped out. However, there is the SendMessageToPC function, which pipes strings to the in-game message window. You can make use of this for script debugging functionality, although the message window buffer is very small, so during combat especially you will find your messages quickly disappear. Armbands that provide location info (like the WhereAmI armband) are a good example of the use of SendMessageToPC. You can also edit the various debug include functions and switch out their use of PrintString/AurPostString to use SendMessageToPC, then recompile the target script/s. 1 Quote Share this post Link to post Share on other sites
DiePutinDie 4 Posted May 12, 2022 Another question, i suppose its impossible, but asking anyway just for sure. Im using DestroyObject and CreateItemOnObject functions in script and every time when they firinfg there is shows popup window in game "item received" and "item lost", is there anyway not to show this window in certain case? Maybe there is another functions with similar functionallity, but without popup window? Quote Share this post Link to post Share on other sites
DarthParametric 3,777 Posted May 12, 2022 Not in K1. You can in TSL, since Obsidian added an extra variable for suppressing those messages. Quote Share this post Link to post Share on other sites
DiePutinDie 4 Posted May 12, 2022 10 hours ago, DarthParametric said: Not in K1. You can in TSL, since Obsidian added an extra variable for suppressing those messages. Create container, create item in container, give item to char, destroy container. Ugly, but working) Quote Share this post Link to post Share on other sites
DarthParametric 3,777 Posted May 13, 2022 You'll still see UI notifications and feedback messages for gained/lost items. If it is really important and it involves a party member, you can temporarily remove them from the active party to do whatever you need, then add them back. Although typically you want to do this under a fadeout/during a cutscene. Quote Share this post Link to post Share on other sites
JCarter426 1,214 Posted May 13, 2022 22 hours ago, DiePutinDie said: Another question, i suppose its impossible, but asking anyway just for sure. Im using DestroyObject and CreateItemOnObject functions in script and every time when they firinfg there is shows popup window in game "item received" and "item lost", is there anyway not to show this window in certain case? Maybe there is another functions with similar functionallity, but without popup window? 21 hours ago, DarthParametric said: Not in K1. You can in TSL, since Obsidian added an extra variable for suppressing those messages. The way to do it in K1 is to call SuppressStatusSummaryEntry before the creation or destruction. // 763. SuppressStatusSummaryEntry // This will prevent the next n entries that should have shown up in the status summary // from being added // This will not add on to any existing summary suppressions, but rather replace it. So // to clear the supression system pass 0 as the entry value void SuppressStatusSummaryEntry(int nNumEntries = 1); For example: SuppressStatusSummaryEntry(); CreateItemOnObject("g_w_lghtsbr01"); 4 1 Quote Share this post Link to post Share on other sites
DarthParametric 3,777 Posted May 13, 2022 Well I stand corrected then. I'll have to make use of it in the next K1CP update to change some of the existing hacky workarounds. Quote Share this post Link to post Share on other sites
DiePutinDie 4 Posted May 13, 2022 3 hours ago, DarthParametric said: You'll still see UI notifications and feedback messages for gained/lost items. If it is really important and it involves a party member, you can temporarily remove them from the active party to do whatever you need, then add them back. Although typically you want to do this under a fadeout/during a cutscene. Nope, with this code, no messages, no notifications. I ve tested it already. But JCarter's way is better i suppose. UPD Tested SuppressStatusSummaryEntry(); No notifications, but text about item aquired or item lost appears in log, with my ugly hack there is no entries in log, if that important for anyone.) Spoiler Quote Share this post Link to post Share on other sites
JCarter426 1,214 Posted May 13, 2022 Yes, GiveItem does not seem to prompt any feedback or status summary whatsoever. That is what I used for my Vision Enhancement to unequip and reequip the player's clothing and headgear. I found a few cases of this in game code as well. I thought I had learned of SuppressStatusSummaryEntry from reading game code, but I've looked and I haven't been able to find a single use of it in either game. Quote Share this post Link to post Share on other sites
DiePutinDie 4 Posted May 22, 2022 On 5/11/2022 at 12:12 AM, TamerBill said: Pretty sure they're all dummied NWN hooks, but it would be pretty funny if they worked all along and no-one had ever checked. Okay, so I went and tested them just to be sure, and they do actually work if you put a script in them. Minus the ones which obviously can't trigger in KotOR like the multiplayer ones, anyway. It'd be a bit of a pain to fill them up for every module to get consistent behaviour, but this is actually a pretty big deal in terms of what new feats can be added. The onPlayerLevelUp hook especially. But this doesn't really help the OP, because there's very little GUI stuff in there. I ve try to put script in module for testing, but no success. What am i doing wrong? I ve edited module.ifo file, is it right? Then i packed module.ifo back in rim file with ERFEdit. And put rim file in override folder with script. Spoiler Spoiler Quote Share this post Link to post Share on other sites
TamerBill 135 Posted May 22, 2022 3 hours ago, DiePutinDie said: And put rim file in override folder with script. Module rims have to go in the Modules folder I believe, not the Override. Oh yeah, and onPlayerLevelup will apparently only trigger on the PC's level-ups, not other party members. So, temper your expectations there, it's not as good as I thought. 1 Quote Share this post Link to post Share on other sites
JCarter426 1,214 Posted May 22, 2022 You also want to package it in a .mod file rather than overwriting the original .rim files. Quote Share this post Link to post Share on other sites
DiePutinDie 4 Posted May 22, 2022 50 minutes ago, TamerBill said: Module rims have to go in the Modules folder I believe, not the Override. Oh yeah, and onPlayerLevelup will apparently only trigger on the PC's level-ups, not other party members. So, temper your expectations there, it's not as good as I thought. Put it in modules folder, not working. Can you tell me how you test this step by step? Quote Share this post Link to post Share on other sites
TamerBill 135 Posted May 22, 2022 1 hour ago, DiePutinDie said: Put it in modules folder, not working. Can you tell me how you test this step by step? Don't think I did it fundamentally differently from you, but sure, here's what I did. - KotorTool, RIMS, Modules, tar_m02aa.rim, module.ifo -> Extract file. - K-GFF, open module.ifo, Mod_OnPlrLvlUp, change the Value to onLevelUp (I put unique values in all of the slots so I could check each one, just 'test' is fine too). - Save. K-GFF does not manually prompt you to save, so double-check that. - ERFEdit, open KOTOR /modules/tar_m02aa.rim - Drag module.ifo onto the window, say Yes to replacing it. - Save. This is not best practice, as JCarter said, but I have the module folder backed up so it doesn't hurt me. - KotorTool, Text Editor, write something I can easily check, save it as onLevelUp.nss and compile. I go with GiveGoldToCreature(getFirstPC(), 1) traditionally since you get the obvious popup. - Put the compiled onLevelUp.ncs in the Override. - Load the game, load my save in Taris South Apartments. - Level up the PC, receive 1 credit. - (Level up Carth, get no credits, get annoyed and scrap your nascent plans) 1 Quote Share this post Link to post Share on other sites
DiePutinDie 4 Posted May 29, 2022 Guys, what about *.gui files (inventory.gui etc). In DAO there be gfx files for ui and it is possible to decompile it and programming on ActionScript (yeah flash). Some alternative in Kotor maybe? Some tools? I found NWN explorer it tells that its tool can decompile gui files, but it needs nwn installation that i dont have. Quote Share this post Link to post Share on other sites