Malkior 476 Posted December 17, 2018 Alright. 22050 Hz WAV should be quite doable with Audacity. I am a bit ignorant when it comes to scripts, could you point me in the right direction or show me some psuedocode on how you're thinking I should implement the thunder/ lightning effect? (I imagine it would be playing on a timer based on the heartbeat parameter?) Also, were you thinking I should model in a scene for the lightning (Probably by adding lights that play in the sky) in a 3d program, or could I make it in mdledit? Lastly, the info on the grass size working like a charm. Thanks for the tips, guys. (Yes I remade the jungle texture; well I at least blocked in the basic shapes ) 1 Quote Share this post Link to post Share on other sites
DarthParametric 3,785 Posted December 17, 2018 There are various sound-related script snippets in the thread of ebmar's that I linked to in the previous post. If you want visible lightning, I would think the best approach would be to add some planes to the skybox model (typically that is its own "room") and then animate their visibility and set it as a scriptloop animation for the room. Then it can be called via script as needed. // Room Animation Constants int ANIMATION_ROOM_SCRIPTLOOP01 = 1; //Up to 20 animations are possible // 738: PlayRoomAnimation // Plays a looping animation on a room void PlayRoomAnimation(string sRoom, int nAnimation); There are a few different ways you could approach this. You could have triggers around the level that fire when the player walks past. You could hijack existing scripts that fire during certain events. You could add scripts to dialogues, if that is appropriate. You might be able to have some sort of timer-based approach, probably triggered via the OnEnter, but that's more the realm of scripting gurus to address. The way you'd want to set it up would be to have a couple of room scriptloops you can switch between, a base one that does nothing and then one or more that controls the visibility of the lighting. Then the scripts would switch between them so the lighting only occurs when you want. 1 Quote Share this post Link to post Share on other sites
Malkior 476 Posted December 17, 2018 10 hours ago, DarthParametric said: There are various sound-related script snippets in the thread of ebmar's that I linked to in the previous post. If you want visible lightning, I would think the best approach would be to add some planes to the skybox model (typically that is its own "room") and then animate their visibility and set it as a scriptloop animation for the room. Then it can be called via script as needed. // Room Animation Constants int ANIMATION_ROOM_SCRIPTLOOP01 = 1; //Up to 20 animations are possible // 738: PlayRoomAnimation // Plays a looping animation on a room void PlayRoomAnimation(string sRoom, int nAnimation); There are a few different ways you could approach this. You could have triggers around the level that fire when the player walks past. You could hijack existing scripts that fire during certain events. You could add scripts to dialogues, if that is appropriate. You might be able to have some sort of timer-based approach, probably triggered via the OnEnter, but that's more the realm of scripting gurus to address. The way you'd want to set it up would be to have a couple of room scriptloops you can switch between, a base one that does nothing and then one or more that controls the visibility of the lighting. Then the scripts would switch between them so the lighting only occurs when you want. Alright, now for the 10,000 credit question: Supposing I don't know how to make scripts in the game, how would I get started? Do I crack open Nwscript and track down example scripts, and if so, which are some good candidates to use for a timer-based approach? For bonus points: Can I make do with Blender (Via KotorBlender) to create a new plane for the lightning effect and is there a tutorial on how to export my model to work with the Kotor assets? Lastly, will the thunder sound effect work on the same timer script as the lightning effect? (As the plan is to replace the ambient thunder altogether with a timed script) -This kind of thing is way outside my area of expertise, but I will happily muddle through it if I can- Quote Share this post Link to post Share on other sites
JCarter426 1,216 Posted December 18, 2018 Firstly, I would recommend my Odyssey ++ user-defined languages. They auto-suggest things and add markup, makes things easier. NWScript will list all the functions but your best bet for learning how they work would be to look through what source scripts are available in scripts.bif. The NWN Lexicon is another good resource, though much of what's there doesn't work in KOTOR. And any resource on any C-like language will help. This should help get you started too: void main() { // Delay for lightning flashes // First, generate a random number between 0.1 and 10.0 seconds: float fRandom = ( IntToFloat(Random(100)) + 1 ) * 0.1; // Extra time always added on top of the random roll: float fExtra = 5.0; // Final delay: float fDelay = fRandom + fExtra; // Lightning animation will be randomly determined // Animation numbers correspond to the ANIMATION_ROOM_SCRIPTLOOP constants string sRoom = "whatever"; int nAnim = Random(20) + 1; // Thunder sound will be randomly determined string sSound; int nSoundRoll = Random(2) + 1; switch(nSoundRoll) { case 1: sSound = "as_wt_thundercl1"; break; case 2: sSound = "as_wt_thundercl2"; break; default: sSound = ""; break; } // Do stuff DelayCommand(fDelay, PlayRoomAnimation(sRoom, nAnim)); DelayCommand(fDelay, PlaySound(sSound)); } It will randomly play an animation and thunder sound. This will utilize all 20 possible room animations if you want to use them all, but you can reduce it by changing the 20 to however many you want. You can also add more thunder sound possibilities by adding more cases before the default case. You can also change the values for the random delay; it's currently set to a delay of between 5 and 15 seconds. 1 1 Quote Share this post Link to post Share on other sites
Malkior 476 Posted December 21, 2018 Thank you for the in-depth information and code, but I'm having trouble getting it in my game. (As in I have no idea how) Should I decompile something like OnEnter and insert the new code to run in it, or is there a smarter/better way to do it? Should I even be using OnEnter? Lastly, I can't find a reliable decompiler. I tried DeNCS, but it can't read the files, and HH's Scripting Tool works but doesn't decompile (As far as I can tell) Quote Share this post Link to post Share on other sites
DarthParametric 3,785 Posted December 21, 2018 DeNCS is what you want. If it can't decompile it then it can't be decompiled. In that case the best you can do is to convert tit to PCode and try and decipher what it is doing, but that's really only something for advanced scripters to bother with. Quote Share this post Link to post Share on other sites
Malkior 476 Posted December 22, 2018 On 12/20/2018 at 9:41 PM, DarthParametric said: DeNCS is what you want. If it can't decompile it then it can't be decompiled. In that case the best you can do is to convert tit to PCode and try and decipher what it is doing, but that's really only something for advanced scripters to bother with. Alright. Since the OnEnter was the script in question, do you possibly have any tips/links to a tutorial I can use to get the code into the game? Quote Share this post Link to post Share on other sites
JCarter426 1,216 Posted December 25, 2018 You can rename the original script and then execute it like so: void main() { ExecuteScript("original_script_give_it_a_new_name", OBJECT_SELF, -1); // Then add all your stuff here whatever it is } Then save your script with the original name. 1 1 Quote Share this post Link to post Share on other sites
Malkior 476 Posted December 27, 2018 Awesome! That looks like it should do it. I shall test it when I can this week, or failing that, this weekend. Next up will be finding the sound files the ARE uses for the thunder sound effect (Or just replace the original with rain and rename the new sounds) and then reading up on Blender so that I can make the animated texture for the sky lightning room effect. I'm just about done with the fireball texture with the exception of a few other minor textures I may or may not work on (Like the Dantooine and Telos grass), so this project may more or less be complete soon. Quote Share this post Link to post Share on other sites
Malkior 476 Posted January 1, 2019 Update: I got the OnEnter open, but now I have a DeNCS related question, void main() { object oTo_402 = GetObjectByTag("To_402", 0); object object3; object object4; object oEntering = GetEnteringObject(); //Thunder Effect script variables start here: // Delay for lightning flashes // First, generate a random number between 0.1 and 10.0 seconds: float fRandom = ( IntToFloat(Random(100)) + 1 ) * 0.1; // Extra time always added on top of the random roll: float fExtra = 5.0; // Final delay: float fDelay = fRandom + fExtra; // Thunder sound will be randomly determined string sSound; int nSoundRoll = Random(2) + 1; // Lightning animation will be randomly determined // Animation numbers correspond to the ANIMATION_ROOM_SCRIPTLOOP constants string sRoom = "tcloud"; int nAnim = Random(20) + 1; if ((oEntering != GetFirstPC())) { return; } if (GetLoadFromSaveGame()) { return; } if ((!GetGlobalBoolean("401_FIRST_ENTER"))) { SetGlobalBoolean("401_FIRST_ENTER", 1); SetGlobalNumber("401DXN_Visited", 1); } if (((!GetIsObjectValid(GetObjectByTag("man_guide", 0))) && (GetGlobalNumber("403DXN_Camp_Visited") > 0))) { CreateObject(1, "f_man_guide", GetLocation(GetWaypointByTag("WP_MANSPAWN")), 0); SetGlobalNumber("401DXN_Man_Guide", 1); } if ((((GetJournalEntry("altroute") == 20) && (!GetLocalBoolean(oTo_402, 41))) && GetIsObjectValid(GetObjectByTag("atton", 0)))) { if ((!IsNPCPartyMember(0))) { DestroyObject(GetObjectByTag("atton", 0), 0.0, 0, 0.0, 0); } SetLocalBoolean(oTo_402, 41, 1); } if (((!GetLocalBoolean(OBJECT_SELF, 51)) && (GetGlobalNumber("506OND_End") > 0))) { AurPostString("Reunion Starts...", 5, 5, 5.0); SetNPCSelectability(GetGlobalNumber("403DXN_PARTY2_NPC1"), 1); SetNPCSelectability(GetGlobalNumber("403DXN_PARTY2_NPC2"), 1); SetNPCSelectability(GetGlobalNumber("403DXN_PARTY2_NPC3"), 1); SetLocalBoolean(OBJECT_SELF, 51, 1); SetGlobalFadeOut(0.0, 0.0, 0.0, 0.0, 0.0); SetFadeUntilScript(); SetGlobalFadeIn(1.0, 2.0, 0.0, 0.0, 0.0); DelayCommand(0.2, sub1()); DelayCommand(1.0, sub2()); } if ((GetObjectByTag("hk_random1", 0) == OBJECT_INVALID)) { sub3(); } //Thunder Script actions start here: switch(nSoundRoll) { case 1: sSound = "as_wt_thundercl1"; break; case 2: sSound = "as_wt_thundercl2"; break; default: sSound = ""; break; } // Do stuff DelayCommand(fDelay, PlayRoomAnimation(sRoom, nAnim)); DelayCommand(fDelay, PlaySound(sSound)); } Is this the appropriate way to do this, or am I way off?.. So, I'm a bit.. stuck.. I dropped the OnEnter .NCS file into the Override, and nothing has happened. Is it dependent on having never visited the area before, and if so, is there a better file to use for my code's inclusion? Quote Share this post Link to post Share on other sites