event_lightning
event_lightning
I must confess I've only used this once, and it was rubbish and about 8 years ago. I can't even get it to work, I'm starting with a map trigger, though eventually it will be purely set off qc-wise, but as I can't get it work now, I'll forget about that for now.
So how do you set up lightning in a map and how to direct it?
So how do you set up lightning in a map and how to direct it?
Re: event_lightning
I'd go for creating a new entity. I'm not sure if there is a lightning QC code somewhere in some mod. Here is some pseudocode*:ajay wrote:I must confess I've only used this once, and it was rubbish and about 8 years ago. I can't even get it to work, I'm starting with a map trigger, though eventually it will be purely set off qc-wise, but as I can't get it work now, I'll forget about that for now.
So how do you set up lightning in a map and how to direct it?
Code: Select all
void lightning_entity() = // wrap this up as a func_lightning
{
set rand(1,10) // set up a random value between 1 and 10
if(rand==5) {
make_lightning(); // if rand is 5 call the lightning function
}
}
Code: Select all
void make_lightning() =
{
// use here EF_DIMLIGHT or even load a light type, the strobe one
}
Sorry for my lack of QuakeC knowledge, I suppose this could be a starting point for a more experienced coder. I also work a lot with pseudocode as starting point for my employees doing PHP, so I'm kinda comfy with it.
*This is not QuakeC!
QuakeWiki
getButterfly - WordPress Support Services
Roo Holidays
Fear not the dark, but what the dark hides.
getButterfly - WordPress Support Services
Roo Holidays
Fear not the dark, but what the dark hides.
-
- Posts: 2126
- Joined: Sat Nov 25, 2006 1:49 pm
Damn, you're right! Why didn't I think of that?frag.machine wrote:Are you talking about the Chton lightning ? Have you checked E1M7 map source ? I remember using that once, but it was really tricky.
That code should be somewhere in the source.
QuakeWiki
getButterfly - WordPress Support Services
Roo Holidays
Fear not the dark, but what the dark hides.
getButterfly - WordPress Support Services
Roo Holidays
Fear not the dark, but what the dark hides.
Yep the Chthon lightning. Checked the map source quickly; the lightning's triggers point to a func_door, but I couldn't find an event_lightning entity anyway, but as I said, I only had a quick look. I got it working in raptors years ago, but it was bloody annoying as I remember and I wasn't happy with it. I may quakec it and use the lightning gun as a base...
-
- Posts: 2126
- Joined: Sat Nov 25, 2006 1:49 pm
-
- InsideQC Staff
- Posts: 1120
- Joined: Sat Oct 16, 2004 3:34 pm
Here's something that might help:
http://tlb.quakedev.com/files/qsrbeta3a_src.zip
Look for lightningbars related stuff in the hip/hip_part.qc file. If nothing else, it should give you a framework to use. (Note that lightningbars is NOT hipnotic code, but rather my own because the particlefields not being visible past a certain distance coupled with the non-intuitive usage of hipnotic's particlefields pissed me off.)
http://tlb.quakedev.com/files/qsrbeta3a_src.zip
Look for lightningbars related stuff in the hip/hip_part.qc file. If nothing else, it should give you a framework to use. (Note that lightningbars is NOT hipnotic code, but rather my own because the particlefields not being visible past a certain distance coupled with the non-intuitive usage of hipnotic's particlefields pissed me off.)
-
- Posts: 2126
- Joined: Sat Nov 25, 2006 1:49 pm
AS I said, it's awkward to use. From what I can say quickly reading the QC, this should do the trick:ajay wrote:Yep the Chthon lightning. Checked the map source quickly; the lightning's triggers point to a func_door, but I couldn't find an event_lightning entity anyway, but as I said, I only had a quick look. I got it working in raptors years ago, but it was bloody annoying as I remember and I wasn't happy with it. I may quakec it and use the lightning gun as a base...
1) put an "event_lightining" in the map, setting it's targetname (ex: "zap");
2) put a button or trigger setting its tagret with the same value (in this case, "zap");
3) put the doors that will represent the extremities of the lightning beam (AFAIK it may not work with other kind of entities), set the "target" field in each one with the "lightning" value.
EDIT: Hey, doesn't Pox's Extras has some ready to use lightning effects ?
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC (LordHavoc)
-
- InsideQC Staff
- Posts: 1120
- Joined: Sat Oct 16, 2004 3:34 pm
Use an info_notnull or path_corner (info_notnull is probably better for this) give it a targetname and then set event_lightningbars target field to whatever you targetnamed said info_notnull.ajay wrote:Thanks a lot. One question; in the level editor I create an entity called event_lightningbars, what do I use (call) as the end point? Sorry if it's obvious, I'm having that kind of day!
To toggle it on / off, give the event_lightningbars itself a targetname and have a switch / trigger target it.
Set wait for duration in seconds between lightning zaps. (i.e. how frequently it shoots lighting to the endpoint.)
-
- InsideQC Staff
- Posts: 1120
- Joined: Sat Oct 16, 2004 3:34 pm
Sounds like you haven't put the event_lightningbars code into your QC, thus resulting in quake not knowing what the heck event_lightningbars is.ajay wrote:Thanks. I'm getting a no spawn function for event_lightningbars error when loading the map?
Another thing to check would be to make sure the quakec name and the entity name for the entity in your mapping program match up. (i.e. event_lightningbars NOT event_lightingbars or something. Don't laugh, but this actually happened to me when I was adding the entity entry into my worldcraft .fgd file. It took me a while to figure out what the hell was going wrong...)