Kyle 
 
 
		
			Posting Freak 
			
			
			
 
			
	Posts: 911 
	Threads: 36 
	Joined: Sep 2010
	
 Reputation: 
7
		
	 | 
	
		
			
  
Problem With "AddPlayerBodyForce" Func 
			 
			
				I made this awesome script and everything works except the player does not change position...   
The "AddPlayerBodyForce(float afX, float afY, float afZ, bool abUseLocalCoords);" doesn't work.   
Any tips or answers?
 
If you wanted to see the whole script... here you go.
 //////////////////////START: ALTARLAMP ROOM 
 
void AltarLampFunc(string &in asParent , string &in asChild , int alState) 
{ 
    StopMusic(0.2f , 10); 
    GiveSanityDamage(15 , true); 
    SetSwingDoorLocked("cellar_wood01_2" , true , true); 
    SetLampLit("altar_lamp_1" , true , true); 
    AddTimer("MusicEvent" , 4.0f , "MusicEventFunc"); 
    AddTimer("PlayerMoveTimer" , 5.0f , "PlayerMoveTimerFunc"); 
} 
void MusicEventFunc(string &in asTimer) 
{ 
    PlayMusic("19_event_brute.ogg" , false , 1.0f , 0.1f , 10.0f , false); 
} 
void PlayerMoveTimerFunc(string &in asTimer) 
{ 
    AddPlayerBodyForce(0.0 , 2.0 , 0.0 , true); 
    AddTimer("PlayerMoveTimer2" , 1.0f , "PlayerMoveTimerFunc2"); 
} 
void PlayerMoveTimerFunc2(string &in asTimer) 
{ 
    AddPlayerBodyForce(2.0 , 0.0 , 0.0 , true); 
    AddTimer("PlayerMoveTimer3" , 1.0f , "PlayerMoveTimerFunc3"); 
} 
void PlayerMoveTimerFunc3(string &in asTimer) 
{ 
    AddPlayerBodyForce(-4.0 , 0.0 , 0.0 , true); 
    AddTimer("PlayerMoveTimer4" , 1.0f , "PlayerMoveTimerFunc4"); 
} 
void PlayerMoveTimerFunc4(string &in asTimer) 
{ 
    StopMusic(1.0f , 2.0f); 
    AddPlayerBodyForce(2.0 , 0.0 , 0.0 , true); 
    SetSwingDoorLocked("cellar_wood01_2" , false , true); 
    AddTimer("AltarLampOff" , 1.0f , "AltarLampOffFunc");  
} 
void AltarLampOffFunc(string &in asTimer) 
{ 
    SetLampLit("altar_lamp_1" , false , true); 
} 
 
//////////////////////END: ALTARLAMP ROOM
 
Edit: By the way, the room I put it in keeps on dissapearing... like, wtf?
			  
			
			
 
			
		 |  
	 
 | 
 
	| 10-23-2010, 11:58 PM  | 
	
		
	 | 
 
 
	
		
		Entih 
 
 
		
			Junior Member 
			
			
			
 
			
	Posts: 47 
	Threads: 4 
	Joined: Sep 2010
	
 Reputation: 
0
		
	 | 
	
		
			
RE: Problem With "AddPlayerBodyForce" Func 
			 
			
				You're using values like 2.0, and -4.0.  To get any significant result, I needed to go as high as 500.0, or 2000.0 (in some cases, 4500.0). 
Not only that, but i had to apply that value every twentieth of a second!
 
Essentially, you're giving the player a very light breeze every second for a brief instant of a moment.  You need to apply a much, much higher force over the course of a longer period of time.
 
Also, while this is a matter of preference, I prefer using the same function for timer situations like that, and just tell them apart using the timer name.  "if(asTimer == "PlayerMoveTimer4"){...}" kind of deal.  It keeps the code less cluttered for me, in more ifs and less functions.
 
For example, this would apply a force of 500 whatever's to the player in the X axis every twentieth of a second for 1 second:
 void PushPlayer(string &in asTimer) 
{ 
     if(GetLocalVarInt("PushingStage") == 20) 
     { 
          AddPlayerBodyForce(500.0f, 0.0f, 0.0f, true); 
          AddLocalVarInt("PushingStage", 1); 
          AddTimer("Blah", 0.05f, "PushPlayer"); 
     } 
}
 
It's your job as a script writer to find a way to work in that idea though, always the hard part.
 
As per the room... mind clarifying a little?
			  
			
			
			
		 |  
	 
 | 
 
	| 10-24-2010, 02:52 AM  | 
	
		
	 | 
 
 
	
		
		Kyle 
 
 
		
			Posting Freak 
			
			
			
 
			
	Posts: 911 
	Threads: 36 
	Joined: Sep 2010
	
 Reputation: 
7
		
	 | 
	
		
			
RE: Problem With "AddPlayerBodyForce" Func 
			 
			
				Thanks, I thought the "-4" and the "2" actually move you on the grid that much. 
The problem about the room is that whenever the altar_lamp_1 and the ScriptArea_5 (which was in the callback) are in the same room, it disapears from the last time I edited the place...
 
Edit: Is it all right to remove the cache file? I don't know, it's just that it won't show anything that was from the last save I did in the editor! Nothing changed...   
			 
			
			
 
			
		 |  
	 
 | 
 
	| 10-24-2010, 12:58 PM  | 
	
		
	 | 
 
 
	
		
		anzki 
 
 
		
			Member 
			
			
			
 
			
	Posts: 88 
	Threads: 6 
	Joined: Apr 2010
	
 Reputation: 
1
		
	 | 
	
		
			
RE: Problem With "AddPlayerBodyForce" Func 
			 
			
				Yes it is all right to remove cache file.
			 
			
			
 
			
		 |  
	 
 | 
 
	| 10-24-2010, 04:05 PM  | 
	
		
	 | 
 
 
	
		
		nofsky 
 
 
		
			Senior Member 
			
			
			
 
			
	Posts: 423 
	Threads: 13 
	Joined: Sep 2008
	
 Reputation: 
1
		
	 | 
	
		
 | 
 
	| 10-24-2010, 06:49 PM  | 
	
		
	 | 
 
 
	
		
		Kyle 
 
 
		
			Posting Freak 
			
			
			
 
			
	Posts: 911 
	Threads: 36 
	Joined: Sep 2010
	
 Reputation: 
7
		
	 | 
	
		
			
RE: Problem With "AddPlayerBodyForce" Func 
			 
			
				It shows the altar_lamp, the door, and the scriptarea_5 but whenever I make another room, it just disapears...   
Any idea?
 
Is there a boundary that goes to the edge of the editing area? -_-
			  
			
			
 
			
		 |  
	 
 | 
 
	| 10-24-2010, 11:55 PM  | 
	
		
	 | 
 
 
	
		
		Kyle 
 
 
		
			Posting Freak 
			
			
			
 
			
	Posts: 911 
	Threads: 36 
	Joined: Sep 2010
	
 Reputation: 
7
		
	 | 
	
		
			
RE: Problem With "AddPlayerBodyForce" Func 
			 
			
				Cool! I fixed it! Thanks guys for all your help and suggestions!   
			 
			
			
 
			
		 |  
	 
 | 
 
	| 10-25-2010, 02:57 AM  | 
	
		
	 | 
 
 
	 
 |