DarthVarkor

Trigger explosion at designated location

Recommended Posts

If I wanted to trigger, say, a thermal detonator explosion at a specific location (which I have the coordinates for). What is the line I'd need to write in the script?

The coordinates are: 4.51, 48.57, 14.57.

 

Thanks!

 

 

Share this post


Link to post
Share on other sites

You can either create a waypoint or use the co-ords directly, whichever takes your fancy. To do the latter:

location lBlastPoint = Location(Vector(4.51,48.57,14.57), 0.0);

Then you'd apply the effect with something like:

effect eExplode = EffectVisualEffect(VFX_FNF_GRENADE_THERMAL_DETONATOR);

ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eExplode, lBlastPoint);

You should look at the Calo Nord cutscene in Javyar's Cantina (TAR_M03AE). It's quite instructive for this sort of thing. In that scene they also have Calo doing a throw animation and spawn a grenade model on the ground.

  • Light Side Points 1

Share this post


Link to post
Share on other sites

Brilliant, thanks for that, DP. Works like a treat.

4 hours ago, DarthParametric said:

You should look at the Calo Nord cutscene in Javyar's Cantina (TAR_M03AE). It's quite instructive for this sort of thing. In that scene they also have Calo doing a throw animation and spawn a grenade model on the ground.

That's a good idea I didn't think of that. How do I de-compile the scripts to read them? In KOTOR Tool: RIMS - Tar_M03aE, the scripts are already compiled. 

 

Share this post


Link to post
Share on other sites

You'll want to use DeNCS (requires Java) - https://web.archive.org/web/20180820120330/http://www.starwarsknights.com/mtools/DeNCS.zip 

You'll need to supply it with a copy of nwscript.nss in the same folder in order for it to work. I would suggest making two folders with separate copies of DeNCS, and have the nwscript.nss for K1 in one, TSL in the other. I have come across the occasional script in K1 that won't decompile when using TSL's nwscript.nss.

If you want to follow along with that cutscene specifically, I'd recommend starting with tar03_calo031.dlg as there are multiple different scripts used for the various shots.

Btw, if you want different VFX you can browse through nwscript.nss to see what constant is required for the one you want.

  • Like 1

Share this post


Link to post
Share on other sites
3 hours ago, DarthParametric said:

You'll want to use DeNCS (requires Java) - https://web.archive.org/web/20180820120330/http://www.starwarsknights.com/mtools/DeNCS.zip 

You'll need to supply it with a copy of nwscript.nss in the same folder in order for it to work. I would suggest making two folders with separate copies of DeNCS, and have the nwscript.nss for K1 in one, TSL in the other. I have come across the occasional script in K1 that won't decompile when using TSL's nwscript.nss.

If you want to follow along with that cutscene specifically, I'd recommend starting with tar03_calo031.dlg as there are multiple different scripts used for the various shots.

Btw, if you want different VFX you can browse through nwscript.nss to see what constant is required for the one you want.

EDIT: My mistake.

So, when I open the ncs file in DeNCS, this is all that happens:

2019-03-11 13_17_58-Steam.png

Share this post


Link to post
Share on other sites
2 minutes ago, DarthParametric said:

Ah, I thought it included it. Grab it here and copy the exe to the same folder as DeNCS.jar (ignore the included nwscript.nss and use the game-specific versions I mentioned before) - https://web.archive.org/web/20180820120330/http://www.starwarsknights.com/mtools/nwnnsscomp_st.zip

 

Yeah turns out I already had the nwnnsscomp.exe on my PC. Think it came with Fair Stride's KOTOR Toolset. As I edited above, the issue I'm now facing is DeNCS doesn't seem to be de-compiling the ncs script.

2019-03-11 13_22_36-Window.png

Share this post


Link to post
Share on other sites

You need either K1 or TSLs nwscript.nss file within the DENCS folder. 

  • Like 1

Share this post


Link to post
Share on other sites

It has decompiled it, it is just warning you that its interpretation doesn't match 100% with the original. Generally you can ignore that. You can right click on it and have it show the decompiled code, or just close that tab and say yes when it asks if you want to save it as an NSS.

  • Like 1

Share this post


Link to post
Share on other sites
1 minute ago, DarthParametric said:

It has decompiled it, it is just warning you that its interpretation doesn't match 100% with the original. Generally you can ignore that. You can right click on it and have it show the decompiled code, or just close that tab and say yes when it asks if you want to save it as an NSS.

Ah, gotcha. Funnily enough I literally just opened another ncs script in it and it works perfectly. Thanks for your help!

Share this post


Link to post
Share on other sites

When it actually fails to decompile, the only thing you'll see is a message in the status window down the bottom.

  • Light Side Points 1

Share this post


Link to post
Share on other sites
4 minutes ago, DarthParametric said:

When it actually fails to decompile, the only thing you'll see is a message in the status window down the bottom.

Yeah, interestingly I opened another ncs just to play around and got the error, but I noticed right next to all the lines random numbers from the ncs was the actual script; "AssignCommand", etc. 

@DarthParametric Sorry, one last question. Going back to my original question on triggering an explosion, I assume you can add a delay to the explosion? I thought it would be: DelayCommand(3.0 ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eExplode, lBlastPoint);  -- but that gives me an error when compiling.

Share this post


Link to post
Share on other sites

That's the byte code - what the actual compiled script looks like to the engine. You can have nwnnsscomp output it I believe (or at least it's an option for scripts that can't be decompiled), and ncsdis from Xoreos Tools will also convert all scripts into byte code. For scripts that can't be decompiled, you can often figure out what it is doing from the byte code and, depending on the complexity, try and recreate it manually.

  • Like 1

Share this post


Link to post
Share on other sites
2 hours ago, DarthVarkor said:

Yeah, interestingly I opened another ncs just to play around and got the error, but I noticed right next to all the lines random numbers from the ncs was the actual script; "AssignCommand", etc. 

@DarthParametric Sorry, one last question. Going back to my original question on triggering an explosion, I assume you can add a delay to the explosion? I thought it would be: DelayCommand(3.0 ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eExplode, lBlastPoint);  -- but that gives me an error when compiling.

You're missing a comma and a parenthesis. It should be DelayCommand(3.0, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eExplode, lBlastPoint));

  • Thanks 1

Share this post


Link to post
Share on other sites
43 minutes ago, A Future Pilot said:

You're missing a comma and a parenthesis. It should be DelayCommand(3.0, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eExplode, lBlastPoint));

Yeah, just spoke to DP on Discord and he showed me where I went wrong - thanks!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.