|
Posted by metlslime on 2005/08/30 18:28:13 |
You know about the info_notnull explosion hack. You know about making monsters drop weapons or alternate ammo using the .weapon and .ammo_whatever hacks. You know about making items float in the air by spawning them on a temporary platform. Let's have a thread where we talk about new ways to use existing behavior and get novel gameplay. If you're a "retired" mapper, this is a great time to do some armchair level design and suggest ideas you'll never have a chance to use yourself. |
|
|
Part 2
#565 posted by therektafire on 2018/07/18 04:15:46
.....origin = whatever the position is that you placed the notnull at
.....model = *1 (or whatever the model number of your model is)
.....modelindex = 2.0 (same as above)
targetname = whatever you want the targetname to be I guess
yaw_speed = the speed that you want the turret to rotate at
enemy = 1 (or whatever the player number is that you want it to target)
use = ai_face
th_pain = whatever shoot function you want the turret to have, only *MONSTER* shoot functions can reliably be used as far as I can tell since I haven't been able to find a function that will reliably set the values required for you to be able to use player weapons effectively, you can still technically use them, you just can't constantly re-aim them so they will either always shoot in one direction or shoot wherever the player is pointing at the time, depending on how you have it set up. Who knows, maybe that's what you want and you can find a use for that, but this "tutorial" of sorts is about hostile turrets that attack the player, not shoot in the direction they are facing ;) Oh yeah, and the monster whose shoot function you want to use needs to be precached in the map first.
Now as you can probably imagine, we need to set up some triggers so that the turret will do it's thing. So make 2 identically sized trigger volumes that take up the exact same area that will correspond to the line of sight of the turret, of course they can be multiple brushes if you want a concave shape, it just matters that they are targeting the things they should be. One of the triggers should target the turret itself, which when the player steps on it will cause the turret to rotate since its use function causes it to do that. The other trigger will target a new notnull that we need to add in the exact same position as the turret one which is supposed to trigger the turret's pain state, causing it to shoot. It will do that by being inside the body of the turret and constantly shooting it with it's own projectiles. Of course for the turret to be in pain it needs to have health, so you should add a health field to it and set it to whatever you want. You also need to set "armorvalue" and "armortype" as well, so that the turret won't kill itself by being shot by its pain trigger. If you want it to be destroyable you should set the armortype to soak up exactly as much damage as the triggering projectile will give (a tutorial on how to do that is given by Preach here https://tomeofpreach.wordpress.com/2013/05/11/trigger_damagethreshold-simulator/) and make sure that the player will have a weapon at that point that does more damage than that. Finally, you need to add 3 more fields, "solid", "takedamage", and "movetype", and set them to 4, 2, and 7 respectively. The solid and takedamage are set so that it will, you know, be able to be shot and take damage, and movetype 7 (PUSH) is required by solid 4 or else the map will crash.
So now that the turret is all set up to get shot and in doing so shoot at the player, now we need to add the notnull that will be firing those trigger shots. This is suuuuuper easy. just add an info_notnull in the exact same position as the turret and give it a targetname, in my case "turrettrigger", a use of hknight_shot, and an enemy of whatever the edict number of the turret's notnull is, in my case 7. Now when it is triggered, it will shoot at the turret, which will cause it to go into "pain", which will cause it to shoot at the player since that's what it's pain function is set to do! And it will rotate as well assuming you have another trigger covering the same area targeting the main turret itself.
And thats about it! Now you should have a turret that, when triggered, shoots at the player and rotates to track them! The final setup looks something like this:
notnull 1 (turret)
.....origin = whatever the position is that you placed the notnull at
.....modelindex = modelindex of turret model you want to use
.....model = same as above
.....targetname = whatever you want the targetname to be I guess
.....yaw_speed = the speed that you want the turret to rotate at
.....enemy = 1 (or whatever the player number is that you want it to target)
.....use = ai_face
.....th_pain = whatever shoot function you want the turret to have, taking into account the restrictions outlined before
.....health = whatever
.....armortype = minimum value required to negate damage from triggering projectile but not from more powerful player weapons
.....armorvalue = a number high enough to where it wont go down when it gets shot, i believe 999999999 is a good amount, Preach has an article on this topic)
.....solid = 4
.....takedamage = 2
.....movetype = 7
notnull 2 (turret shoot trigger)
.....origin = same as the turret itself
.....targetname = whatever
.....use = hknight_shot
.....enemy = entity number of turret
Demo Map And Map Source
#566 posted by Therektafire on 2018/07/18 04:17:18
Here is a link to a zip containing a small crap box demo map showing the turret in action and the map source https://drive.google.com/file/d/1_2U4tXHpkpqdhfZi-3J1PyZVtOoFXp_r/view?usp=drivesdk I would have taken the time to make a somewhat better demo map but this took a little longer than I expected to write since I suck at trying to explain things lol, so I just decided to throw out the map I used for testing instead of making a somewhat more realistic use case environment. As usual if you have corrections or tips for improvements feel free to point them out :)
Poorchop
Haven't read this yet but GG. Grabbing my reading glasses.
@dumptruck
#568 posted by therektafire on 2018/07/18 08:43:38
Well parts of it might be a little overexplained which accounts for some of the length lol. I wanted to be really informative though and make sure people get it so maybe it's ok.
@rekta
#569 posted by Spud on 2018/07/18 11:19:52
Holy shit, you got it working and working well to boot. Hell of a write up and a tricksy workaround with the th_pain bit, almost surprised you didn't find some evil way to make it rotate vertically as well as the usual horizontal rotation.
Cool Turret
#570 posted by Preach on 2018/07/21 21:02:15
Another impressive hack, well done. It's also inspired me to finish off an article I've been working on for a while. It's an ode to the oft mentioned function while hacking: SUB_CalcMoveDone
https://tomeofpreach.wordpress.com/2018/07/21/in-praise-of-sub_calcmovedone/
If you want to know the best way to make a gib fountain, or what the "Duke of York" hack is all about, come have a read...
@Preach
I am just getting started "cutting and pasting" QuakeC. I followed your recently revised tutorial on monster spawning here:
https://tomeofpreach.wordpress.com/2017/10/08/teleporting-monsters-flag/
I'd like to add a small random delay automatically to each teleporting monster as you can do in Quoth. Reason is I am using custents multiple triggers to trigger these delays spawns. As in Quoth it would be nice to have a little variation on the timing if the monsters all share a targetname.
Would this be as simple as modifying this:
self.think1();
//override the random delay some go functions apply
self.nextthink = time + 0.1;
spawn_tfog (self.origin);
spawn_tdeath(self.origin, self);
}
to this:
self.think1();
//override the random delay some go functions apply
self.nextthink = self.nextthink + random()*0.5;
spawn_tfog (self.origin);
spawn_tdeath(self.origin, self);
}
Update
I was finally able to try this last night. Does do it. Any hints would be appreciated.
Typo Above
Doesn't do it.
No Expert Here But...
#574 posted by Esrael on 2018/07/31 17:25:05
Should it be
self.nextthink = time + random()*0.5
@Esrael
I tried that as well. It's going to be a bit more complex I think.
Don't Have The Source Files On This Computer
#576 posted by Esrael on 2018/07/31 20:12:27
What values does the random function give? Anything between 0 and 1? Does the function require parameters? Like random(5) giving values between and 0 and 5?
Nevermind
#577 posted by Esrael on 2018/07/31 20:23:01
Just googled the answer myself.
QuakeC Questions
#578 posted by metlslime on 2018/07/31 20:24:35
would be better discussed in the Coding Help thread.
@metlslime
Apologies. I associate this thread with Preach and forgot it was more of a hacks thread.
#580 posted by Qmaster on 2018/07/31 21:58:35
See my suggestion in Coding Help
Very Interesting Stuff All This Is, But I Have A Question.
#581 posted by Aberrant on 2018/11/24 19:58:56
First off I mostly play a form of teamfortress, regtf, custom, and megatf. I've noticed a lot of maps use trigger_hurts to simulate mine fields and things of similar sort. I wanted real exploasion, real particles, and I used the infomation here in this to do just that. It's targetable or touchable however you need it, but it only fires once. Nothing I have done will make it work again. Is there a way to reset an info_notnull?
#582 posted by negke on 2018/11/24 20:07:59
You probably tried the barrel_explode hack which indeed only works once. The only way I could imagine for this to work without custom code is using a W_FireRocket hack that shoots a rocket right into the ground. It can the used multiple times because you can set its ammo count to a very high value. Of course there'll be the rocket launch sound, but that's probably acceptable. Read above to see how it's done.
I See, So It's Relying On The Ammo In Needs.
#583 posted by Aberrant on 2018/11/24 20:41:12
{
"classname" "info_notnull"
"use" "GrenadeExplode"
"enemy" "1"
"group_no" "1001"
"health" "1"
"targetname" "proxi1"
"nextthink" "0"
"origin" "-264 -90 -352"
}
I'll try adding this to it and see if that helps.
"no_grenades_1" "200"
thanks btw.
Well My Way Doesn't Quite Work.
#584 posted by Aberrant on 2018/11/24 20:50:34
I could perhaps use the rocket like you said, however, I was hoping more to use effects from something not a trap already. Like triggering detpacks, or airstrikes. So far the only thing that keeps firing are monster attacks. Now consider these mods are stripped down, there are no monsters so none of their effects can be used. I'm starting to think I've gone about this wrong, and theres a better hack, but I only noticed this a week ago. I am at a huge loss right now, I'm quite ignorant.
@aberrant
#585 posted by madfox on 2018/11/25 04:28:26
You should take a look at MechTech's progref.
There are several examples of what can be done within the commen progs.dat.
It's just a way of placing map entities with the right statements.
The first example is a trigger_multiple for lavaballs. I think it is easy to change it to GrenadeExplosion.
Thanks Madfox
#586 posted by Aberrant on 2018/11/25 05:37:29
I will surely look right now.
Reading, Reading And More Reading, But
#587 posted by Aberrant on 2018/11/25 21:20:06
The more I try things the better it gets, so far I have managed to find a repeating explosion. However, it always targets 0 0 0. Is there anyway I can simulate a players perspective to get a fixed point other than 0 0 0. That's what the code is calling for, someone to paint a target.
#588 posted by Qmaster on 2018/11/26 04:23:19
Which funtion name are you using? W_FireGrenade?
Not Quite
#589 posted by Aberrant on 2018/11/26 14:36:40
I know you all recommend using standard quake progs, I am using the tf mod. It's not going to be updated. I used airstrike_target. I cannot use monster skills, well there are some but limited to zombie, grunt, dog, and fish. The rest of the code was stripped down to make room for the tf classes and abilities. I'm having to go through the qc and find function names. Trial and error for me at this point.
|
|
You must be logged in to post in this thread.
|
Website copyright © 2002-2024 John Fitzgibbons. All posts are copyright their respective authors.
|
|