Inside3D!
     

event_lightning

 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> Mapping
View previous topic :: View next topic  
Author Message
ajay



Joined: 29 Oct 2004
Posts: 295
Location: Swindon, UK

PostPosted: Thu May 06, 2010 8:00 pm    Post subject: event_lightning Reply with quote

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?
_________________
my site
Back to top
View user's profile Send private message MSN Messenger
Chip



Joined: 21 Jan 2009
Posts: 314
Location: Romania

PostPosted: Thu May 06, 2010 8:49 pm    Post subject: Re: event_lightning Reply with quote

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:
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:
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!
_________________
My Projects: Quake 1 Mods | OpenQuartz 2 | ChipQuake
Back to top
View user's profile Send private message Visit poster's website
frag.machine



Joined: 25 Nov 2006
Posts: 728

PostPosted: Thu May 06, 2010 11:28 pm    Post subject: Reply with quote

Are you talking about the Chton lightning ? Have you checked E1M7 map source ? I remember using that once, but it was really tricky.
_________________
frag.machine - Q2K4 Project
http://fragmachine.quakedev.com/
Back to top
View user's profile Send private message Visit poster's website
Chip



Joined: 21 Jan 2009
Posts: 314
Location: Romania

PostPosted: Fri May 07, 2010 12:49 am    Post subject: Reply with quote

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.
_________________
My Projects: Quake 1 Mods | OpenQuartz 2 | ChipQuake
Back to top
View user's profile Send private message Visit poster's website
ajay



Joined: 29 Oct 2004
Posts: 295
Location: Swindon, UK

PostPosted: Fri May 07, 2010 6:46 am    Post subject: Reply with quote

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...
_________________
my site
Back to top
View user's profile Send private message MSN Messenger
frag.machine



Joined: 25 Nov 2006
Posts: 728

PostPosted: Fri May 07, 2010 12:40 pm    Post subject: Reply with quote

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.
_________________
frag.machine - Q2K4 Project
http://fragmachine.quakedev.com/
Back to top
View user's profile Send private message Visit poster's website
Dr. Shadowborg
Inside3D Staff


Joined: 16 Oct 2004
Posts: 726

PostPosted: Fri May 07, 2010 3:53 pm    Post subject: Reply with quote

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.)
_________________
"Roboto suggests Plasma Bazooka."
Back to top
View user's profile Send private message
ajay



Joined: 29 Oct 2004
Posts: 295
Location: Swindon, UK

PostPosted: Fri May 07, 2010 5:23 pm    Post subject: Reply with quote

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!
_________________
my site
Back to top
View user's profile Send private message MSN Messenger
frag.machine



Joined: 25 Nov 2006
Posts: 728

PostPosted: Fri May 07, 2010 7:13 pm    Post subject: Reply with quote

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 ?
_________________
frag.machine - Q2K4 Project
http://fragmachine.quakedev.com/
Back to top
View user's profile Send private message Visit poster's website
Dr. Shadowborg
Inside3D Staff


Joined: 16 Oct 2004
Posts: 726

PostPosted: Sat May 08, 2010 3:38 am    Post subject: Reply with quote

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.)
_________________
"Roboto suggests Plasma Bazooka."
Back to top
View user's profile Send private message
ajay



Joined: 29 Oct 2004
Posts: 295
Location: Swindon, UK

PostPosted: Sat May 08, 2010 11:02 am    Post subject: Reply with quote

Thanks. I'm getting a no spawn function for event_lightningbars error when loading the map?
_________________
my site
Back to top
View user's profile Send private message MSN Messenger
Dr. Shadowborg
Inside3D Staff


Joined: 16 Oct 2004
Posts: 726

PostPosted: Sat May 08, 2010 2:40 pm    Post subject: Reply with quote

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...Embarassed)
_________________
"Roboto suggests Plasma Bazooka."
Back to top
View user's profile Send private message
ajay



Joined: 29 Oct 2004
Posts: 295
Location: Swindon, UK

PostPosted: Sat May 08, 2010 3:57 pm    Post subject: Reply with quote

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...
_________________
my site
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> Mapping All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2004 phpBB Group