I am trying to use Entity:TakeDamageInfo on a ragdoll prop of mine. Everything works in that it takes damage, force is applied properly, etc. But what I do not see happening is blood being produced from the damage wounds. Basically I am trying to programatically create a murder scene wherein an NPC/prop_ragdoll is randomly damaged with random force velocities (which works) but I would also like the force to include blood splatter from the server-simulated wound.
Is there a straightforward way to go about splattering blood around? If there isn’t a function for doing this, how does blood splatter work in general? Maybe it is some kind of entity that gets created…
Great suggestion! Unforuntately, it didn’t work =(
After doing a lot of research, I have discovered there is a specific entity type env_blood which is an environment entity that evidently does exactly what I am looking for.
I tried many different ways to create this entity object and spawn it on my ragdoll, however, the blood splatter won’t activate (or even render, for that matter). I have a suspicion I am going to have to use this environment entity to achieve my goal.
According to the valve docs, you can only interact with that type of entity through ‘Input’ calls. I tried using the ent:Input() but to no avail. The documentation for that method is very bad though, so I probably did something wrong.
Another option I found was that I am able to create client-side particle systems on a given entity. But that doesn’t produce the effect I am looking for.
Again, thanks for your suggestion! Do you happen to have any idea how to use environment entities?
Yeah I fucking hate whoever redid the articles on the wiki. They need to be drug out into the street and shot. See, they used to have all the inputs and keyvalues listed in their literal form, something that we can use. We can’t use the plain english that they provide us with.
But no, I don’t work with a lot of visual shit. Most of my work is behind the scenes shit like game mechanics.
Yeah I totally agree. The documentation is really terrible for some of this stuff.
Fixed! Here is the code that lets you spawn blood, evidently. =P
// Create a blood entity
local blood = ents.Create(“env_blood”);
// Give it a name for the engine (might be optional)
// Bind it to an entity. I specify an entity type (since I only have 1).
// Give it the spawnflags of 8. (stream, I believe). Possibly unecessary.
// Random direction
blood:SetKeyValue(“spraydir”, math.random(500) … " " … math.random(500) … " " … math.random(500));
// Huge spray amount to make big splatters.
// Tell it to only collide with the world.
blood:SetCollisionGroup( COLLISION_GROUP_WORLD );
// Set the position equal to the origin you want the blood to originate from.
blood:SetPos( carl:GetPos() );
// Spawn the blood entity
// Activate the effect.
Hey, that’s useful. But yeah, basically what happened is that people pointing and clicking in hammer were like “it not calld dat n0ob” and this one guy went around changing everything to what was in the hammer dropdowns instead of what their literal names were, which is useful to mod makers and Garry’s Mod scripters.
Man, we should probably make our own wiki with entity names and their proper keyvalues listed.
Ahhh wow. If you are talking about the valve documentation, I ended up viewing the history and using one of the original articles (because it is actually a wiki). But even that didn’t help too much. I then wen to the “old gmod wiki” and they also have ZERO documentation on the function. Both resources are pretty lacking =/
At least I figured it out though! I hope it can help someone else down the road.
Edit And yes, if someone made a REAL wiki - that would be fantastic.
If there was a place to contribute, I would certainly have a lot of changes in mind. I wish the maurtis.tv one was open source or something. It has a good base of information, but just not enough examples and some pretty misleading stuff. If I had more time I would consider trying to start up a project of this caliber, but I have too much going on as it is =P
Coincidentally, I am a web software developer - so I do have experience with this kind of thing.