I've noticed a problem with DP's MOVETYPE_WALK on non-clients feature. Actually, it took me ages and AGES of agonizing bug testing to figure out what it was, but I finally located what it is.
It turns out that the engine movement code for MOVETYPE_WALK doesn't seem to care about when you set origins. The bug cropped up for me when I tried to make a non-client respawn, and it kept on appearing either where it died, or at the same spawnpoint over and over again. Many hours later I realized it was linked to the entity's MOVETYPE_WALK. I was able to set origin fine when the entity was MOVETYPE_TOSS, but with WALK I couldn't even accurately set the origin, even when I set it a thousand or so times a second (the entity would spawn in the spot then begin to droop down below the location because of gravity, instead of constantly returning to that spot). So I'm guessing that some engine-side origin variable isn't getting set.
Thankfully I have come up with a hacky fix: set the entity's movetype to TOSS for 0.5 seconds when he respawns, then set it back to WALK afterwords. That way another movetype takes control long enough to get the offending variable reset before WALK takes over again.
However, please fix the bug soon. It's a rather ungainly fix, and MOVETYPE_WALK on non-players is going to be important in this mod.
Problem with DP's MOVETYPE_WALK :(
Problem with DP's MOVETYPE_WALK :(
When my computer inevitably explodes and kills me, my cat inherits everything I own. He may be the only one capable of continuing my work.
Re: Problem with DP's MOVETYPE_WALK :(
looks like the position its reset, so the code ignore the change and continue the movement...
I have to check that.
what engine?
I have to check that.
what engine?
I showed this thread to LordHavoc, and he said he's unsure what causes it, but he has a better workaround. Do this:
AFTER setorigin. It resets because it thinks it's in solid.
Code: Select all
self.oldorigin = self.origin;
I was once a Quake modder
Okay, that makes sense. Just to be sure, I'll redirect the setorigin function to call setorigin_real and then update .oldorigin if the entity's movetype is WALK (as typed below, more or less). That should cover all the bases and keep me from forgetting a spot.
Thanks, Urre and LordHavoc!
Thanks, Urre and LordHavoc!
Code: Select all
void(entity e, float org) setorigin =
{
setorigin_real(e, org);
if(e.movetype == MOVETYPE_WALK)
e.oldorigin = e.origin;
};
When my computer inevitably explodes and kills me, my cat inherits everything I own. He may be the only one capable of continuing my work.