| 
		
	
		| Ermu   Member
 
 Posts: 86
 Threads: 13
 Joined: Jan 2012
 Reputation: 
2
 | 
			| Lock opened with armor puzzle 
 
				Hey!
 So, my problem is that i've been making a puzzle, where you need to find 2 armor heads and place them to 2 helmetless armors, to unlock the door. My problem is at the point that there should be the both armor heads placed to unlock the door, but the door will unlock even if there is one helmet only placed, and as i said, it shouldn't unlock until both have been placed.
 
 The reason why i placed "else"s at the point it checks for the other armor, is because i thought that would work since it didn't work without it.
 
 SCRIPT:
 
 void OnStart()
 {
 AddEntityCollideCallback("upstairs_doorhead_2", "upstairs_doorarea_2", "upstairsdoor2", true, 1);
 AddEntityCollideCallback("upstairs_doorhead_1", "upstairs_doorarea_1", "upstairsdoor1", true, 1);
 }
 
 void upstairsdoor1(string &in asParent, string &in asChild, int alState)
 {
 SetEntityActive("upstairs_doorhead_1", false);
 SetEntityActive("upstairs_doorheadless_1", false);
 SetEntityActive("upstairs_doorarmor_1", true);
 if(GetEntityExists("upstairs_doorheadless_2") == true)
 {
 SetSwingDoorLocked("upstairs_door", false, false);
 }
 else
 {
 SetSwingDoorLocked("upstairs_door", false, true);
 }
 }
 
 void upstairsdoor2(string &in asParent, string &in asChild, int alState)
 {
 SetEntityActive("upstairs_doorhead_2", false);
 SetEntityActive("upstairs_doorheadless_2", false);
 SetEntityActive("upstairs_doorarmor_2", true);
 if(GetEntityExists("upstairs_doorheadless_1") == true)
 {
 SetSwingDoorLocked("upstairs_door", false, false);
 }
 else
 {
 SetSwingDoorLocked("upstairs_door", false, true);
 }
 }
 
 Thanks for your help, Ermu.
 
				
(This post was last modified: 02-16-2012, 05:05 PM by Ermu.)
 |  |  
	| 02-16-2012, 05:04 PM |  |  
	
		| SilentStriker   Posting Freak
 
 Posts: 950
 Threads: 26
 Joined: Jul 2011
 Reputation: 
43
 | 
			| RE: Lock opened with armor puzzle 
 
				Use LocalVarInt and then when the LocalVarInt is 2 then that opens the door   
 |  |  
	| 02-16-2012, 05:54 PM |  |  
	
		| Ermu   Member
 
 Posts: 86
 Threads: 13
 Joined: Jan 2012
 Reputation: 
2
 | 
			| RE: Lock opened with armor puzzle 
 
				 (02-16-2012, 05:54 PM)SilentStriker Wrote:  Use LocalVarInt and then when the LocalVarInt is 2 then that opens the door  Not familiar with that, can you give me example/put it in the script? 
			 |  |  
	| 02-16-2012, 08:24 PM |  |  
	
		| Statyk   Schrödinger's Mod
 
 Posts: 4,390
 Threads: 72
 Joined: Sep 2011
 Reputation: 
241
 | 
			| RE: Lock opened with armor puzzle 
 
				Something like this:
 //____________________________
 
 
 void OnStart()
 {
 
 SetLocalVarInt("armorbank", 0); //sets a "bank" for integers to be added and be called later
 
 AddEntityCollideCallback("upstairs_doorhead_2", "upstairs_doorarea_2", "upstairsdoor2", true, 1);
 AddEntityCollideCallback("upstairs_doorhead_1", "upstairs_doorarea_1", "upstairsdoor1", true, 1);
 }
 
 void upstairsdoor1(string &in asParent, string &in asChild, int alState)
 {
 SetEntityActive("upstairs_doorhead_1", false);
 SetEntityActive("upstairs_doorheadless_1", false);
 SetEntityActive("upstairs_doorarmor_1", true);
 
 
 AddLocalVarInt("armorbank", 1); //Adds ONE to the "armorbank"
 CHECKHEADS(); //Calls the function below. Saves space
 }
 
 void upstairsdoor2(string &in asParent, string &in asChild, int alState)
 {
 SetEntityActive("upstairs_doorhead_2", false);
 SetEntityActive("upstairs_doorheadless_2", false);
 SetEntityActive("upstairs_doorarmor_2", true);
 
 
 AddLocalVarInt("armorbank", 1); //Adds ONE to the "armorbank"
 CHECKHEADS(); //Calls the function below. Saves space
 }
 
 
 void CHECKHEADS()
 {
 if(GetLocalVarInt("armorbank") == 2) //checks the bank. If it has 2, it continues.
 {
 SetSwingDoorLocked("upstairs_door", false, true);
 }
 }
 
				
(This post was last modified: 02-16-2012, 09:22 PM by Statyk.)
 |  |  
	| 02-16-2012, 09:21 PM |  |  
	
		| Ermu   Member
 
 Posts: 86
 Threads: 13
 Joined: Jan 2012
 Reputation: 
2
 | 
			| RE: Lock opened with armor puzzle 
 
				Thanks! Works now!
 Also, i've been wondering, how do you get that blue splash on your screen with the "swoosh" sound when you ie. unlock a door or correctly solve a puzzle.
 |  |  
	| 02-16-2012, 09:58 PM |  |  
	
		| SilentStriker   Posting Freak
 
 Posts: 950
 Threads: 26
 Joined: Jul 2011
 Reputation: 
43
 | 
			| RE: Lock opened with armor puzzle 
 
				GiveSanityBoost(); or GiveSanityBoostSmall(); 
AddPlayerSanity(float afSanity);
  
 
				
(This post was last modified: 02-16-2012, 10:22 PM by SilentStriker.)
 |  |  
	| 02-16-2012, 10:21 PM |  |  |