Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Having a "while" loop problem(possible overload)
Silent Darkness Offline
Junior Member

Posts: 37
Threads: 9
Joined: Jul 2012
Reputation: 0
#1
Having a "while" loop problem(possible overload)

I want to have a section of script that temporarily makes it so that the player is forced to crouch.

PHP Code: (Select All)
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?
(This post was last modified: 09-19-2013, 08:21 PM by Silent Darkness.)
09-19-2013, 08:18 PM
Find
DamnNoHtml Offline
Senior Member

Posts: 469
Threads: 34
Joined: Sep 2010
Reputation: 16
#2
RE: Having a "while" loop problem(possible overload)

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);

Creator of Wake, Through the Portal, Insomnia, and Cycles What to do with HPL3....
(This post was last modified: 09-19-2013, 08:43 PM by DamnNoHtml.)
09-19-2013, 08:42 PM
Find
Silent Darkness Offline
Junior Member

Posts: 37
Threads: 9
Joined: Jul 2012
Reputation: 0
#3
RE: Having a "while" loop problem(possible overload)

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.
(This post was last modified: 09-19-2013, 09:29 PM by Silent Darkness.)
09-19-2013, 09:29 PM
Find




Users browsing this thread: 1 Guest(s)