This is how to treat a radiant point entity like an effects brush. This is also gonna be considered a STONER level/friendly tutorial. Of course I am not trying to imply JD in particular .
Make a new qc file, name it whatever you want and add it at the very bottom of your progs.src. Imma call mine spawns.qc. The reason why I am putting this microscopic amount of code in it's own QC, is because maybe I will teach you more stuff later of the "spawn" type and you can just keep adding to it.
spawns.qc
This is simple and it's also QC so we will be working from the bottom up. You will be calling spawn_effect from the map. If there is no effectname set it throws an error and exits the function, otherwise it thinks about seven after a brief pause.
seven_think just keeps running pointparticles over and over and over. In pointparticles is the effect name from your effectinfo.txt and some other values that you can learn about by opening dpextensions and reading the comments.
Arbitrary explanation: the "self" in spawn_effect is the same "self" as seven_think. I know it would seem like they are different but they are not. spawn_effect CALLED seven_think from within itself. So seven_think is like an expansion of "self" as opposed to a separation of. We already defined that think is seven_think and in seven_think it keeps saying to think again (nextthink). Seven_think runs forever once its called (multiplied by the amount of effects used) and we never programmed in a way to shut it off.
Finally, we make the possibility of an .effectname field possible.
NOTE: you don't have to have that new var (.effectname). You could erase it's declaration and then change everywhere it is used (entities.ent too) to self.model
I like things to make sense. I like to be able to look at something and immediately know what it is. .model does not accurately express that the name of an effect should be its value, so I make new vars.
Make sure you have dpextensions and this script included in your progs.src and recompile your qc.
------
Now let's build the radiant ent definition. Open up your entities.ent and add the following lines right before </classes> (the very bottom)
---
If you do not already have some effects, paste this in an empty document and save it as "effectinfo.txt" in your root game folder. (ie ID1 .. not /maps - that only works for mapname_effectinfo.txt)
Quake/id1/effectinfo.txt
You will also need a particle font and it will need to be placed in id1/particles. If the entire top row (0 thru 7) of your particle font does not look like smokey stuff, you will need to change {tex 0 7} to whatever numbers apply for your particle font.
---
Last but not least - open up radiant, make a room or choose a room (whatever applies) in your map and right click. Select spawn_effect from the drop down list. Open the entity inspector (with spawn_effect active). Next to effectname, write "simplesmoke" (or whatever effect name you desire and possess) . Save/Compile/Run and enjoy.
fun fact?: I typed all of this out. I didn't even copy/paste my own tutorial, that's a fact. I did it that way, cause I wanted to see if I was right. I checked my script against my original before posting. I missed a semi-colon after a function, that isn't even a warning (i think lol). Anyway, you can't ever stop typing if you want to be good, JD. I made this tut cause you mentioned it in sevens thread.
Make a new qc file, name it whatever you want and add it at the very bottom of your progs.src. Imma call mine spawns.qc. The reason why I am putting this microscopic amount of code in it's own QC, is because maybe I will teach you more stuff later of the "spawn" type and you can just keep adding to it.
spawns.qc
Code:
.string effectname; void() seven_think = { self.nextthink = time + 0.00065; pointparticles(particleeffectsnum(self.effectname), self.origin, '0 0 0', 1); }; void() spawn_effect = { if(!self.effectname) { objerror("spawn_effect: you didn't set the effectname field.\n"); return; } self.think = seven_think; self.nextthink = time + 0.1; };
seven_think just keeps running pointparticles over and over and over. In pointparticles is the effect name from your effectinfo.txt and some other values that you can learn about by opening dpextensions and reading the comments.
Arbitrary explanation: the "self" in spawn_effect is the same "self" as seven_think. I know it would seem like they are different but they are not. spawn_effect CALLED seven_think from within itself. So seven_think is like an expansion of "self" as opposed to a separation of. We already defined that think is seven_think and in seven_think it keeps saying to think again (nextthink). Seven_think runs forever once its called (multiplied by the amount of effects used) and we never programmed in a way to shut it off.
Finally, we make the possibility of an .effectname field possible.
NOTE: you don't have to have that new var (.effectname). You could erase it's declaration and then change everywhere it is used (entities.ent too) to self.model
I like things to make sense. I like to be able to look at something and immediately know what it is. .model does not accurately express that the name of an effect should be its value, so I make new vars.
Make sure you have dpextensions and this script included in your progs.src and recompile your qc.
------
Now let's build the radiant ent definition. Open up your entities.ent and add the following lines right before </classes> (the very bottom)
Code:
<point name="spawn_effect" color="0 .5 .8" box="-4 -4 -4 4 4 4"> <string key="effectname" name="effectname"> the name of your effect from effectinfo.txt</string> </point>
If you do not already have some effects, paste this in an empty document and save it as "effectinfo.txt" in your root game folder. (ie ID1 .. not /maps - that only works for mapname_effectinfo.txt)
Quake/id1/effectinfo.txt
Code:
effect simplesmoke countabsolute .1 type smoke color 0x222233 0xeeeeff tex 0 7 size 1 6 alpha 20 7 2 sizeincrease -5 originoffset 0 10 0 originjitter 128 128 0 velocityjitter 7 7 3 velocitymultiplier 0.1 gravity -0.0005 bounce 1
---
Last but not least - open up radiant, make a room or choose a room (whatever applies) in your map and right click. Select spawn_effect from the drop down list. Open the entity inspector (with spawn_effect active). Next to effectname, write "simplesmoke" (or whatever effect name you desire and possess) . Save/Compile/Run and enjoy.
fun fact?: I typed all of this out. I didn't even copy/paste my own tutorial, that's a fact. I did it that way, cause I wanted to see if I was right. I checked my script against my original before posting. I missed a semi-colon after a function, that isn't even a warning (i think lol). Anyway, you can't ever stop typing if you want to be good, JD. I made this tut cause you mentioned it in sevens thread.
Comment