@Preach
Alright. I was afraid of that, but luckily it's for academic purposes not a real project. Great news about the noise keys in Quoth 2.2 That does open up some possibilities. Thanks for the response.
I hope you get a chance to play my 100b4 entry. Lot's of sound work went into it.
Cool Beans
#541 posted by Preach on 2018/06/15 00:29:29
The pack is next on my list, so I'll watch out for it!
Func_breakable In Id1
#542 posted by Therektafire on 2018/07/10 03:34:20
Hey everyone :) So earlier someone on the TB discord asked if it was possible to make a brush that acts like a HL style func_breakable so I did some fooling around and figured out how to do it! Now this is pretty easy stuff that probably isn't really worthy of going here but I'll post about it anyway lol. So here is how you do it, you make a func_wall as you would normally do, then after you've made it you add a few keyvalues to it. First add a takedamage key and set it to 2, that allows it to take damage, obviously. Then you add a health field and set it to however much health you want the breakable to have. Then when it's health reaches 0 it will try to call the function in the th_die field, if there isn't one the map will crash as I found out :D So add th_die and set it to SUB_Remove or any other function that calls SUB_Remove at some point, depending on what your needs are. Optionally you can add an armortype and armorvalue to give the breakable damage resistance so it can be broken with some weapons but not others. I haven't exactly figured out how to customize the sound it makes when you hit it or break it yet but I will keep trying and see if you can do it without needing a mod
Previous Post Continued
#543 posted by Therektafire on 2018/07/10 04:53:21
So after a little more discussion I've figured out how to add sound playback to the breakable, so the full setup looks like this:
Func_wall
takedamage = 2
health (whatever you want it to be)
armortype/armorvalue (whatever you want it to be
noise (whatever sound you want the brush to make when you hit it but don't break it)
th_pain = train_wait (plays sound in noise field whenever you hit it)
th_die = SUB_UseTargets (targets 2 separate info_notnull's that play the sound you want to play when the object is broken and removes it, respectively)
target = the name of the 2 notnulls
Notnull 1
targetname = whatever you put in the target field of the breakable
noise = the sound you want to play when the breakable breaks
use = train_wait (play the sound when triggered by the breakable dying)
Notnull 2
targetname = same as the first one
killtarget = name of the breakable
use = SUB_UseTargets (remove the breakable when this gets triggered by it dying)
Please feel free to correct me if something I put is incorrect, I'm still pretty new to q1 mapping and map hacks especially. But map hacks are really fun and I've almost become more interested in them than actual mapping at this point (but not completely though) :P I'm also trying to think of how to add rotation to a turret hack I made last week but I haven't really checked any of the quake c sources related to rotating functions to see which ones I might be able to use
Hi Therektafire
#544 posted by Preach on 2018/07/10 23:56:31
That's a really well constructed and described hack. Welcome to the thread!
In terms of rotation, a warning and two pointers. First warning is that standard Quake just doesn't do collision on rotation. The amount of highly specialised code that mods apply to get even crude approximation of rotating solids, I wouldn't expect a hack to be able to get anything like collision working.
If you just want visible rotation things are better. There are already suggestions in this thread about how to use avelocity for simple looping animations. If you're looking for something more triggered, you might want to look at SUB_CalcAngleMove. Although any entity which used the function got cut from the final release of Quake, it's still available for hacks to use.
Alternatively, you might want to look into the AI functions if you'd like rotations that follow the player. You need to set quite a few keys on an entity to trick the game into running some of the built-in AI stuff for turning to face an enemy, but it should be possible. More advanced stuff, but something to get your teeth into...
Also
#545 posted by Qmaster on 2018/07/11 06:22:01
Having your breakable also create some info_notnulls using external .bsp models for rubble and have a movetype 6 would be cool too. Can't remember a good way to give them starting velocity at the moment though and still be triggered on break.
@preach
#546 posted by therektafire on 2018/07/12 05:56:10
Thanks :) I got the idea for the armor from one of your articles https://tomeofpreach.wordpress.com/2013/05/11/trigger_damagethreshold-simulator/#more-974 I may add it to the turrets too if possible. Speaking of, I will definitely look into the AI turning/rotating functions to see what I can do with them
#547 posted by negke on 2018/07/12 14:30:52
How can I make worldspawn shootable and killable?
Perfect accuracy gameplay challenge...
A Trigger Curiosity
#548 posted by Kinn on 2018/07/15 10:13:30
So, I was idly tugging my way through some of the vanilla QC files, and noticed functionality I was hitherto unaware of!
In the blurb for the trigger_once entity, it says this:
if "angle" is set, the trigger will only fire when someone is facing the direction of the angle. Use "360" for an angle of 0.
The code to do this seems to be in there, but I cannot recall a single time in the id1 levels where I noticed this behaviour.
Is this used anywhere in id1, and if so where?
Yours curiously...
#549 posted by Spike on 2018/07/15 10:24:14
one place is on start.bsp
those 'this hall selects foo skill' centerprinting triggers only display their messages when you're facing towards the teleports. walk backwards into the teleporters and you won't see the messages at all.
Two Custom Map Examples
768_negke.bsp
sm179_otp.bsp
Rehashing Old Work
I didn't bother to dig into the whole backlog of messages here, but I made a (fairly simple) hack that allows for killable "static" entities. I've tested this with flames, but not with other things, I suspect that light globes may work.
step one, make a trigger under the player spawn and make it target an info_notnull called "flame". Make sure this info_notnull is some distance from the player, as touching it too early will crash your engine.
Place a "light_flame_large_yellow" somewhere in the map to precache the model.
give the info_notnull the following keys:
targetname flame
model progs/flame2.mdl
frame 1
use func_wall
think PlaceItem
nextthink 2
mdl progs/flame2.mdl
This should now allow you to killtarget the flame entity. Note that static ents don't occupy the edict list, however this hack will. I guess it will also allow for a touch function to be run on it after this point too.
One final thing to consider when using this hack, touching this entity before its had its "nextthink" even by a monster will crash the game. Even shooting the flame will crash it. I suggest spawning them well away from players and monsters.
The nextthink function forces the notnull entity back to a non-solid non-bsp state whilst retaining the flame model. In the example above this happens 2 seconds after it spawns.
(oh, the trigger should be a trigger once)
#553 posted by Kinn on 2018/07/15 18:58:12
those 'this hall selects foo skill' centerprinting triggers
Blimey, I didn't have to go far then to find one.
@551
#554 posted by Spud on 2018/07/16 03:28:11
That's a fair amount of work for a killable flame. Rather than messing with thinks and nextthinks and all that, you can just set the modelindex of an info_notnull to that of the spinning flame model (flame2.mdl, check in the console first to see which slot it takes of course) and have a simple displayed model that you can killtarget like normal, no extra futchery with crashing when touched or anything. The flame will automatically do its snazzy little spinning and burning animation, similar to a backpack, and the frame field changes the size with 0 being the smaller flame model (light_flame_small_yellow) and 1 being the larger version. Old example webm here.
the flame models are static and don't appear in the edict list though?
#556 posted by Spud on 2018/07/16 09:24:10
They're still given a modelindex, no different from the player or enemy models or worldspawn/brush models. Not sure how to find which model has what number in Fitzquake-derived engines but Darkplaces (ugh) has a handy modellist command that will print out every model currently loaded by the game in order. Worldspawn comes first, then count the list by one. Worst case scenario, experiment a bit until you find the right modelindex and remember to place things in the right order that enemies/health changing by difficulty won't break the hack.
Worst Case Scenario
#557 posted by Esrael on 2018/07/16 09:47:04
You might have to make separate entities for different skill levels, with each having the correct model indices for the corresponding skill levels. :/
Move On Up
#558 posted by Preach on 2018/07/16 23:09:56
Moving the static torch you're using to precache the model as near to the top of the entity list as possible will help to stabilise the modelindex across all the skill levels in your map. Also worth remembering that each time you add a brush entity, that adds one to all the precache modelindex values. So you want the map to be basically finished in that respect before you finish off the hack.
Rotating Turret Hack Finished (mostly)!
#559 posted by therektafire on 2018/07/17 04:13:34
Hey guys, back for another update. My rotating turret hack is almost 100% done :D I just need to take a few minutes tomorrow to iron out some little kinks related to the offsetting of the body model in relation to the shots and it will be good to go and I can make a demo map and full write up on it. In the meantime here is a weirdly rotated screenshot from QuakeDroid showing it in action in a crappy little box room :)
https://imgur.com/a/IeLhHFe
The Absolute Fucking Madman
#560 posted by Spud on 2018/07/17 04:36:06
Eagerly looking forward to seeing it in action.
#561 posted by Baker on 2018/07/17 07:54:36
Nice that a "newer guy" can make cool stuff!
#562 posted by Spud on 2018/07/17 09:00:16
If what he's posted in #tf and related channels in such short time is any indication, rekta is a new maphax savant.
Thanks
#563 posted by therektafire on 2018/07/17 09:51:36
I mean it's not that impressive, you can do it easily if you have basic programming knowledge and take the time to read the sources to know what fields and functions you can and cant use where... Or in my case, try and figure out why entire segments of code were replaced and moved elsewhere but still in the original files commented out, then get confused when what you want to do isn't working the way it should :D it's not like I'm making Quake Rally 2 or something like that... Though I do like racing games so maybe I'll give that a shot some day ;)
Rotating Turret Writeup/demo Map (part 1
#564 posted by therektafire on 2018/07/18 04:14:06
Ok, so, here is the write up on the rotating turret hack. Now my setup probably isn't the best but it works fine, at least in SP, so I'll probably keep using it in maps going forward anyway. It's not too difficult to set up but there are several steps involved. Also apparently this is too long to put in one post since the character limit is 5k and I have more than that :O So i will need to divide it into multiple parts.
So, here is how you do it. First at the map origin you need to set up the model of the turret itself. Of course I suppose you could use a custom mdl but these are vanilla maphax we are talking about here :) Now after you make it you might need to move it up a little depending on the type of projectile you want to use so it doesnt look like complete crap when it shoots, I used hknight_shot so I had to move the model up a few units to get it to look right. After you made the model you need to turn it into a brush entity so it will have a model and modelindex value, I used func_wall. And of course you should encase it in a box to prevent leaks and add appropriate lighting. Then add a info_notnull in the spot where you want the turret to be and give it a target name like "turretmain" or something, it will be the main turret body. Now you will want to copy the main model to the notnull, you do that by setting the modelindex and model fields to the same model and modelindex values of the turret model you want to use, if you want to have multiple different styles in your map you need to create multiple models. You can find these values using the "edicts" command in the console, if you want to be able to find the edict numbers of the turret models easier just cut and paste them to the top of your .map file just under worldspawn, that should make things a little easier since now they should be closer to the top of the edict list. In my case the model was *1 and modelindex was 2.0, so I used those. So so far you should have something that looks like this
info_notnull
.....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.
Now if all things went well when you go into your map you should see your turret in the spot where you placed it. Good. But, it doesn't shoot obviously, or rotate either :( SO we need to fix that. Unfortunately I couldn't figure out a way to get any "smart" player detecting functions working so it can only really reliably track 1 player meaning this hack is technically SP only for now. But that's ok, you can just make multiple copies that track specific players, no big deal. First add an "enemy" field and set it to 1, this will cause it to track the first player since they are always the first entity loaded in a map. Now let's get the rotation part out of the way first. For the rotation to work properly we need two things, we need to add a "yaw_speed" field to the turret that contains the speed that we want it to rotate at, and a function that consistently sets some specifc values, specifically ideal_yaw and angles_y. Luckily there is a function that does just that for us, ai_face. So we need to put that somewhere, but where is a little tricky. We can't put it in think because neither ai_face or ChangeYaw (the helper function that ai_face calls that actually rotates the model) resets nextthink meaning it would only run once which isn't exactly ideal. There are 2 options that we as the mapper can consistently control though, use and th_pain. So we can put our rotation function in one and the shooting function in the other, it doesn't really matter which one since the pain state of the turret will need to be activated by a use'd entity shooting at it anyway. So I put ai_face in use and the shooting function in th_pain, in my case hknight_shot. So now it should look like this:
|