Scripted lightning flash
#1
Posté 06 septembre 2011 - 12:06
I can't find it and wanted to see the outcome of it. I think it was Shaun the Crazy One who started it.
How might I go about this. I have SLS2 but I can't see how to flash a light rather than switch it off and on again becuase of the light tag issue.
At the moment I am toying with get nearest object to find the light then switch on, delay 0.5 then switch off but then i can't have any mor light soruces on the map than my lightning source.
Any thoughts would be welcome.
PJ
#2
Posté 06 septembre 2011 - 12:30
you can construct a "false array" with the stored local name "light1" light2" "light3"
int i = 1;
string light = "light" + IntToString(i);
SetLocalObject(GetModule(),light);
#3
Posté 06 septembre 2011 - 02:13
http://nwvault.ign.c...s.Detail&id=502
#4
Posté 06 septembre 2011 - 03:16
I'm going to have a play with this tonight.
PJ
#5
Posté 06 septembre 2011 - 06:40
I did not use a sound object, from what i understand those leak memory, and you HAVE to put that into your module up front, which was a non starter, as i wanted something ( control weather ) which just required certain blueprints to be available and a hak or in override, and did not require modding each area in a module up front ( hence non usuable in the OC ). I put sounds in VFX for thunder, light flashes and the like, then made placed effects as needed. Note that this is not just visuals, you can be hit by a ligtning bolt at random especially if are in full plate swinging a sword it will tend to hit you, but they are mostly for atmosphere.
You can look at _CSLCore_Environment.nss for how it's scripted, and use the vfx i set up. ( i have snow which makes any area blanketed in whiteness as the snow begins falling )
#6
Posté 06 septembre 2011 - 07:05
Modifié par rjshae, 06 septembre 2011 - 07:06 .
#7
Posté 06 septembre 2011 - 07:15
I am sorry I feel I should be familiar with CSL but I'm not. I did a search but I am not seeing anything. could you help me to get closer. I would like to implement a weather system but chances are I will keep it simpler for this mod and implement it on the campaign when I put that together next year.
Thanks for the assistance pain* it's much appreciated.
PJ
#8
Posté 06 septembre 2011 - 08:52
Community Script Library
Links are in the 3rd post, i do keep updating things, and right now i am getting feedback on a beta release i just put out.
Doxygen Reference Which you can use as you develop things, it includes a well commented base functions, and a library of helper functions which are much more solid than the default game.
Think of it as a very light library of all the basics you can use, instead of the 6,000 files that come with the game there are 32 core files, and a further 60 files aimed at a single aspect. Generally you just need to include one of the main files, or you can see how things are coded and just copy out the function as needed. Ideally you use the core CSL files, and as i release new versions to fix bugs you or your users can just update to the latest and recompile. Individual features are implemented as a _SCInclude_*.nss file in the main folder which is shared between projects, and a folder of implementation scripts which are needed for the game to even use it to begin with.
( instead of the game AI for example, which is a few hundred include files i challenge you to decipher, my version is CSLAIntelligence with 61 implementation scripts, and _SCInclude_AI.nss, _SCInclude_AI_Advanced.nss, _SCInclude_AI_c.nss, and _SCInclude_AI_IntellDev.nss -- this is still pretty much hard to figure out, but it's technically works the same as the original TonyK AI. Up to you whether you use this, it's just another option. Obviously they end up inter-relating, but i've kept each project separated for the most part so each can work by itself )
I am basically building with it, doing everything for my PW, and i've done VFX for sounds and visuals, but i am also doing extensive changes to the UI, spells, visuals for spells. This is all quite involved of course, but it's really up to each person how much or how little they wish to use. Any larger projects built using the CSL as a base will end up being easier to merge script wise together.
For what you are doing, i'd suggest looking at my placed effects i set up, the VFX which have multiple types of bolts, and how i implemented via script sporadic lightning hits ( use the doxygen link to understand it ). You may or may not want real bolts hitting players, but i got the game flashing lights, doing thunder, with distant rolling sounds and closer, as well as adding in fog settings, all done via script and a placeable heartbeat.
I'd not be too worried about memory leaks, they do exist but if you quit the game enough they become a non issue. It is more of an issue with PW's who are up for months at a time. A sound object cannot be created/placed via script, so to do it with such is more area specific modding. I have heard a lot of very negative feedback from other PW admins about them using up both memory and processing, but i personally have never tried using them. A placed effect with sound should be far lighter on the engine, but it also has much less abilities than an actual sound object.
Modifié par painofdungeoneternal, 06 septembre 2011 - 08:58 .
#9
Posté 06 septembre 2011 - 09:07
I will go into the libruary now and see what i can find.
Thanks again, I shall sleep easy on the sound objects.
PJ
#10
Posté 23 mai 2014 - 08:23
okkkk so where did this go in the end? ie> I am, looking for lightning flash now lol so Whats the score
#12
Posté 24 mai 2014 - 02:26
#13
Posté 25 mai 2014 - 11:07
I have lightning flashes in the module I'm currently working on. They get spawned at random intervals via an area heartbeat script when it detects rain above a certain strength (using the game's standard random rain system). The same area HB script also changes the ambient sound of the area to match the strength of the rain (and changes it back to a default ambient sound when rain stops).
I created several lightning flashes as temporary (six second) locational VFX, which contain both the randomly flashing light and the thunder sound. That way I don't have to make allowances for light objects losing their tags.
#14
Posté 02 juin 2014 - 07:05
This works nice, but the lightning doesnt seem to flash
I placed the light reasonably high up (not too far) but never flashes.. // despite the fact a storm is raging
any ideas?
#15
Posté 02 juin 2014 - 08:34
Is the radius of the flashing light large enough to cover the area? Is the shadowing turned off on the lightning light source? Could too many overlapping light-sources (with shadows) in the area prevent an additional light source from appearing? Perhaps the graphics card can't handle it?
#16
Posté 02 juin 2014 - 09:00
i dont have any light sources in the external areas, i actually removed them and found i got better effects.. so its the only light
-also from reading onwards, i believe i dont actually need to place the light source, it does it automatically
the areas are all quite small
as for gfx card, my PC is a beast ... it can handle Skyrim in full HD with ENB and every mod in existence, nwn2 should be a piece o cake
#17
Posté 02 juin 2014 - 09:08
Have you checked the known issue listed on the weather system page?
#18
Posté 02 juin 2014 - 09:10
KNOWN ISSUE: LIGHTNING: There is a known NWN2 "Light" issue where Light objects lose their tags between module loads. Therefore, builders should add checks to determine if the "Lightning" object is actually present if they are using the system with more than one module. (I have NOT yet added this fix to the current download, but make builders aware of the issue to sort themselves.) Storing the "Lightning object" as a local object on the PC's current area and recalling it as required does work! If anybody needs this in more detail, then I can update if need be.
ermm yeh shouldnt be an issue, its one module im working on
#19
Posté 03 juin 2014 - 04:08
Well I haven't looked at the scripts, but first I would probably want to confirm that the lighting flash routine is at least being called. A simple method would be to insert a print statement in the same section of the routine then compile and save it.
object oMyPC = GetFirstPC(); SendMessageToPC( oMyPC, "Called lighting flash routine...");
#20
Posté 04 juin 2014 - 03:36
This works nice, but the lightning doesnt seem to flash
I placed the light reasonably high up (not too far) but never flashes.. // despite the fact a storm is raging
any ideas?
Hi,
EDIT: OK, I see from an above post that you noticed you do not need to add your own light ... so, does this mean it is working for you now?
If everything installed correctly, you should have "alb_lightning" object in your "Lights" objects section in the LB_Weather list.As far as I recall (it's been a while since I read the manual), I designed it so you do NOT need to add any lights yourself, as the package does it all for you. ![]()
NOTE: You also get distant thunder setting, which thunders without lightning.
Check out the manual for implementation .... and leave the code to do the rest. ![]()
EDIT: Just tested my own, and it works fine. Just be aware of the following:-
1) The script adds the lightning object for you (and I do not believe is a problem if you only have one mod).
2) Lightning is only guaranteed during a storm ... sometimes during hard rain.
3) Have you set the tool up properly? Check the manual.
Cheers,
Lance.
#21
Posté 08 juin 2014 - 09:39
there was a few issues with this mod, i played around with it for a couple of days but found in the end i was better off without it.





Retour en haut







