Forum

event_lightning

Discuss the construction of maps and the tools to create maps for 3D games.

Moderator: InsideQC Admins

event_lightning

Postby ajay » Thu May 06, 2010 8:00 pm

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?
User avatar
ajay
 
Posts: 559
Joined: Fri Oct 29, 2004 6:44 am
Location: Swindon, UK

Re: event_lightning

Postby Chip » Thu May 06, 2010 8:49 pm

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?


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*:

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
}
}


And here is the lightning function (again pseudocode*):

Code: Select all
void make_lightning() =
{
// use here EF_DIMLIGHT or even load a light type, the strobe one
}


You can continue this with a traceline function and generate a lightning visual effect with code similar to the lightning gun one. This could become an interesting effect.

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.
User avatar
Chip
 
Posts: 575
Joined: Wed Jan 21, 2009 9:12 am
Location: Dublin, Ireland

Postby frag.machine » Thu May 06, 2010 11:28 pm

Are you talking about the Chton lightning ? Have you checked E1M7 map source ? I remember using that once, but it was really tricky.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
User avatar
frag.machine
 
Posts: 2090
Joined: Sat Nov 25, 2006 1:49 pm

Postby Chip » Fri May 07, 2010 12:49 am

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.


Damn, you're right! Why didn't I think of that?

That code should be somewhere in the source.
QuakeWiki
getButterfly - WordPress Support Services
Roo Holidays

Fear not the dark, but what the dark hides.
User avatar
Chip
 
Posts: 575
Joined: Wed Jan 21, 2009 9:12 am
Location: Dublin, Ireland

Postby ajay » Fri May 07, 2010 6:46 am

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...
User avatar
ajay
 
Posts: 559
Joined: Fri Oct 29, 2004 6:44 am
Location: Swindon, UK

Postby frag.machine » Fri May 07, 2010 12:40 pm

I made a random lightning function eons ago, was not that hard really. When I 'm in home I'll check if I still have this code.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
User avatar
frag.machine
 
Posts: 2090
Joined: Sat Nov 25, 2006 1:49 pm

Postby Dr. Shadowborg » Fri May 07, 2010 3:53 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.)
User avatar
Dr. Shadowborg
InsideQC Staff
 
Posts: 1110
Joined: Sat Oct 16, 2004 3:34 pm

Postby ajay » Fri May 07, 2010 5:23 pm

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!
User avatar
ajay
 
Posts: 559
Joined: Fri Oct 29, 2004 6:44 am
Location: Swindon, UK

Postby frag.machine » Fri May 07, 2010 7:13 pm

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...


AS I said, it's awkward to use. From what I can say quickly reading the QC, this should do the trick:

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)
User avatar
frag.machine
 
Posts: 2090
Joined: Sat Nov 25, 2006 1:49 pm

Postby Dr. Shadowborg » Sat May 08, 2010 3:38 am

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!


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.

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.)
User avatar
Dr. Shadowborg
InsideQC Staff
 
Posts: 1110
Joined: Sat Oct 16, 2004 3:34 pm

Postby ajay » Sat May 08, 2010 11:02 am

Thanks. I'm getting a no spawn function for event_lightningbars error when loading the map?
User avatar
ajay
 
Posts: 559
Joined: Fri Oct 29, 2004 6:44 am
Location: Swindon, UK

Postby Dr. Shadowborg » Sat May 08, 2010 2:40 pm

ajay wrote:Thanks. I'm getting a no spawn function for event_lightningbars error when loading the map?


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.

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...:oops:)
User avatar
Dr. Shadowborg
InsideQC Staff
 
Posts: 1110
Joined: Sat Oct 16, 2004 3:34 pm

Postby ajay » Sat May 08, 2010 3:57 pm

Thanks again. Turned out it was where I had the .qc file in prog.src. Moved it up the list and alls well. I think it was not having it before world.qc, but I'm not sure...
User avatar
ajay
 
Posts: 559
Joined: Fri Oct 29, 2004 6:44 am
Location: Swindon, UK


Return to Mapping

Who is online

Users browsing this forum: No registered users and 1 guest