Back to the Vavoom Forum Archives


Forum

A way to know when player is running

Wed, 15 Apr 2009 16:38:57

Crimson Wizard

I wonder is it possible to add readonly (perhaps) flag which tells that player is running (run button is down or autorun is on)? I need this to change player states for running (I am coding mod for Alex bomberman).
Fri, 17 Apr 2009 13:39:06

Firebrand

I don't know if it might work, but you could add a check inside the player class in VavoomC that makes the check as you described and turns on/off the flag <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) -->.
Fri, 17 Apr 2009 15:44:46

Crimson Wizard

[quote="Firebrand":24l6e5k4]I don't know if it might work, but you could add a check inside the player class in VavoomC that makes the check as you described and turns on/off the flag <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) -->. What is the sense in adding a check if I have no means to perform this check?
Fri, 17 Apr 2009 17:29:22

Janis Legzdinsh

Check ForwardMove and SideMove variables. 200/-200 is normal walking speed, 400/-400 is running.
Fri, 17 Apr 2009 21:35:47

Crimson Wizard

[quote="Janis Legzdinsh":3q76igy8]Check ForwardMove and SideMove variables. 200/-200 is normal walking speed, 400/-400 is running. Well, I already tried with them, but it was like it wasn't working. Not sure I did this right, but they were always 200. I explored code a bit and found out - at least I thought so - that actual speed is set up later, inside the engine, after the "Run" key is checked. Also, I am wondering, if ForwardMove and SideMove properties are set in decorate for player class, will these constants still be usable (200/400) to test running?
Sat, 18 Apr 2009 18:26:19

Janis Legzdinsh

That means that you're walking. "Run" key is handled on client side, and these are the final values. DECORATE speed factors are applied later, when calculating actual force. Alternatively you could check length of the Velocity vector which is actual movement speed.
Sun, 19 Apr 2009 18:27:35

Firebrand

Anyway, I think there should be a way to make progs aware of other buttons the player is pressing, since it would make things like this easier <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) -->.
Sun, 19 Apr 2009 20:27:41

Crimson Wizard

Actually yes, from loking into engine code I saw that it determines running using a very simple condition (Run button pressed or autorun toggled on). I will try checking ForwardMove and SideMove again, but still checking keys would be more suitable IMO. As for velocity, I am afraid that method is not very useful, because velocity can be changed by enviroment (something that pushes/pulls player).
Wed, 29 Apr 2009 15:09:00

Crimson Wizard

Well, I finally could get back to this and noticed I made some algebraic mistakes before. Yes, it is possible to make this check using Forward/SideMove. So, now I do not know if my proposal has any sense. Maybe it does, but I won't insist any futher for the moment.
Sun, 03 May 2009 21:16:08

Firebrand

I'm just curious, how did you manage to determine the proper speeds? Could you post the condition you are checking please?
Mon, 04 May 2009 11:43:34

Crimson Wizard

if (Player.ForwardMove > 200.0 || Player.ForwardMove < -200.0 ||
		Player.SideMove > 200.0 || Player.SideMove < -200.0)
{
	DoJump(RunState);
}
if (!(Player.ForwardMove > 200.0 || Player.ForwardMove < -200.0 ||
		Player.SideMove > 200.0 || Player.SideMove < -200.0))
{
	DoJump(WalkState);
}
In fact, I could not make this work for strafing, because it is faster than walking straight. I tried different values up to 400, but in the end decided to left it as is (i.e. strafing always counts as running).

Back to the Vavoom Forum Archives