| 
		
	
		| proshitness   Junior Member
 
 Posts: 20
 Threads: 3
 Joined: Nov 2011
 Reputation: 
0
 | 
			| Door 
 
				How to do a door swing lock script? 
the door is :castle_1 
script area: Shut1 
this is the script if you can help:
 void OnStart(){    AddEntityCollideCallback("Player", "Shut1", "CloseDoors", true, 1);}void OnEnter(){}
 void OnLeave(){}
 void CloseDoors(string &in asParent, bool abChild, bool abEffects){    setSwingDoorLocked("castle_1", true, true);}
 |  |  
	| 11-09-2011, 09:15 PM |  |  
	
		| flamez3   Posting Freak
 
 Posts: 1,281
 Threads: 48
 Joined: Apr 2011
 Reputation: 
57
 | 
			| RE: Door 
 
				void OnStart(){
 AddEntityCollideCallback("Player", "Shut1", "CloseDoors", true, 1);
 }
 
 void CloseDoors(string &in asParent, bool abChild, bool abEffects)
 {
 setSwingDoorLocked("castle_1", true, true);
 }
 
 
 
 
 That should work
 
 |  |  
	| 11-09-2011, 10:39 PM |  |  
	
		| Statyk   Schrödinger's Mod
 
 Posts: 4,390
 Threads: 72
 Joined: Sep 2011
 Reputation: 
241
 | 
			| RE: Door 
 
				
This should work. Includes the wind sound. If the sound does not play, you will have to make a Script Area near the door, title it something and change the name at: "PlaySoundAtEntity("", "general_wind_whirl.snt", "castle_1 ", 0, false);" to the name of the Script Area and it will work fine. Also, organizing your script with "Enter"s and "Tab"s can help a LOT. 
 
Your issues(fixed): 
- An entity collide does not have "bool abEffects", It is "int alState". 
- SetSwingDoorLocked was spelled: "setSwingDoorLocked" again with the capitalizations buddy =]
 
Just copy and paste this all.
 void OnStart(){
 AddEntityCollideCallback("Player", "Shut1", "CloseDoors", true, 1);
 }
 void OnEnter()
 {
 }
 void OnLeave()
 {
 }
 
 void CloseDoors(string &in asParent, bool abChild, int alState)
 {
 SetSwingDoorLocked("castle_1", true, true);
 PlaySoundAtEntity("", "general_wind_whirl.snt", "castle_1", 0, false);
 }
 
				
(This post was last modified: 11-09-2011, 10:46 PM by Statyk.)
 |  |  
	| 11-09-2011, 10:40 PM |  |  
	
		| proshitness   Junior Member
 
 Posts: 20
 Threads: 3
 Joined: Nov 2011
 Reputation: 
0
 | 
			| RE: Door 
 
				the door didn't work =\
 |  |  
	| 11-11-2011, 01:24 PM |  |  
	
		| flamez3   Posting Freak
 
 Posts: 1,281
 Threads: 48
 Joined: Apr 2011
 Reputation: 
57
 | 
			| RE: Door 
 
				 (11-11-2011, 01:24 PM)proshitness Wrote:  the door didn't work =\ Didn't work? Are you talking about locking a closed door, or by slamming an open door shut and than lock the door? 
			 
 |  |  
	| 11-11-2011, 01:40 PM |  |  
	
		| proshitness   Junior Member
 
 Posts: 20
 Threads: 3
 Joined: Nov 2011
 Reputation: 
0
 | 
			| RE: Door 
 
				slamming an open door shut and than lock the door
			 |  |  
	| 11-11-2011, 02:45 PM |  |  
	
		| flamez3   Posting Freak
 
 Posts: 1,281
 Threads: 48
 Joined: Apr 2011
 Reputation: 
57
 | 
			| RE: Door 
 
				 (11-11-2011, 02:45 PM)proshitness Wrote:  slamming an open door shut and than lock the door well than you need to add propforce: 
 
AddPropForce(string& asName, float afX, float afY, float afZ, string& asCoordSystem); 
SetSwingDoorLocked(string& asName, bool abLocked, bool abEffects);
			 
 |  |  
	| 11-11-2011, 03:11 PM |  |  
	
		| proshitness   Junior Member
 
 Posts: 20
 Threads: 3
 Joined: Nov 2011
 Reputation: 
0
 | 
			| RE: Door 
 
				Where to put it?
			 |  |  
	| 11-11-2011, 04:57 PM |  |  
	
		| Unearthlybrutal   Posting Freak
 
 Posts: 775
 Threads: 12
 Joined: May 2011
 Reputation: 
26
 | 
			| RE: Door 
 
				Use this instead of PropForce: 
SetSwingDoorClosed("castle_1", true, true);
 
It's much easier   
Here is the full thing:
 
void OnStart() 
{  
AddEntityCollideCallback("Player", "Shut1", "CloseDoors", true, 1); 
}
 
void CloseDoors(string &in asParent, bool abChild, bool abEffects) 
{  
SetSwingDoorClosed("castle_1", true, true); 
SetSwingDoorLocked("castle_1", true, true); 
}
			
 |  |  
	| 11-11-2011, 05:29 PM |  |  
	
		| proshitness   Junior Member
 
 Posts: 20
 Threads: 3
 Joined: Nov 2011
 Reputation: 
0
 |  |  
	| 11-11-2011, 06:49 PM |  |  |