Frictional Games Forum (read-only)

Full Version: Having a "while" loop problem(possible overload)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I want to have a section of script that temporarily makes it so that the player is forced to crouch.

PHP Code:
while(OnyourKnees >= 1)
  {
  
SetPlayerCrouching(true);
  } 

Running this at any point in the script causes any script code further along the line to simply not run at all, putting the map at a complete standstill. I'm not sure why this is.

Are while loops supposed to risk freezing up the entire script file?
That simple block should work. Where are you setting OnyourKnees to >=1?

Alternatively, why not just set the player to crouching, then use void SetPlayerCrouchDisabled(bool abX);
1. Initially, it was on OnEnter(), but putting it elsewhere only made it freeze up elsewhere.

2. Ooh. Alright, I already found a seperate solution to this problem by accident, but i'll keep this in mind.