Page MenuHomeFeedback Tracker

isWalking player; always returns false
Closed, ResolvedPublic

Description

isWalking player always returns false, regardless of whether you are walking or not. I noticed as one of my scripts depends on it. In this script, an enemy will engage you if you run too close to him (!isWalking player > player setCaptive false). Since the outcome is always false, this condition will always be true. Hence I noticed that even if I approached an enemy slowly they would engage me.

Details

Legacy ID
1338106864
Severity
None
Resolution
Fixed
Reproducibility
Always
Category
Scripting
Steps To Reproduce

Create new mission
Place playable soldier
Preview
Confirm that you are walking
execute code in the debug console:

hint str isWalking player

hint will say "false", where should have been "true".

Additional Information

Not tested on AI

Event Timeline

Frett edited Steps To Reproduce. (Show Details)Mar 8 2015, 9:15 PM
Frett edited Additional Information. (Show Details)
Frett set Category to Scripting.
Frett set Reproducibility to Always.
Frett set Severity to None.
Frett set Resolution to Fixed.
Frett set Legacy ID to 1338106864.May 8 2016, 11:37 AM

Try this instead. Put this in the players Init field in the editor:

null = 0 spawn {while {true} do {hintSilent str (isWalking player); sleep 0.1;}}

Make sure that your charachter is WALKING and not SPRINTING or JOGGING. If you do not know how go to:
configure > controls > Infantry movement > Walk or run toggle

Even when using the debug method I still got a True return when WALKING, not jogging.

This command is also not reliable for what you want to do. It doesn't necessarily say the unit is walking. It says that walking is toggled and not jogging. If the unit is sprinting it could still return true. I just means that the units current default pace is walking. So its whether the unit will return to walking or jogging after it is done sprinting.

It even says here "Returns true if walk is TOGGLED.": https://community.bistudio.com/wiki/isWalking

try: https://community.bistudio.com/wiki/speed

Also "(!isWalking player > player setCaptive false)" Is improper syntax

Frett added a subscriber: Frett.May 8 2016, 11:37 AM
Frett added a comment.Mar 8 2015, 10:37 PM

Syntax is ok. Of course I didn't write it down like in the example.

I reported because it worked before. << (that is: 1.38 non-dev build)

So, the following part of my script did the job but now it doesn't:

if (!isWalking _p) then

				{
					hint format ["FIRING!!!"];
					_p setCaptive false;
					_close doFire _p;
				};

// FYI

_p = player
_close = nearestenemy.

Again, this worked before. So something has changed.

Frett added a comment.Mar 8 2015, 10:48 PM

In fact, even your code returns false for me.

But then again it is not really different other than that it would check whether you are walking or not with a 0.1 s interval. Stays false whatever I do.

Are you sure you are testing on the latest dev build?

And of course I know the difference between walking, sprinting and jogging...

I can do the work-around with speed, thanks for the tip. But I found the isWalking condition to be a bit more elegant.

Edit:

Now that I think about it: using 'speed' is much better as it will prevent enemy units from engaging if they walk into you. But still, isWalking isnt working for me, and that is what this report is about.

Can confirm isWalking always returns false, no matter if walk is toggled or forced with forceWalk command

Sorry i'm 1.40 stable and it worked for me. Sorry for any assumptions, just wanted to cover all the bases.

fixed in todays dev