| 
		
	
		| CorinthianMerchant   Posting Freak
 
 Posts: 2,876
 Threads: 84
 Joined: Nov 2011
 Reputation: 
131
 | 
			| Machine puzzle and other things 
 
				How do I... 
Make a player teleport to another map after interacting with an examine area?Make 5 different bulkheads open after placing an entity on a script area?Make an elevator lever teleport the player to a new map after two entities are placed on two different script areas?A machine puzzle that makes a lever interactable after the player pulls another lever after a lever puzzle setting lever number 1,3,4 up and 2,5,6 down and place three coal pieces inside a script area (and making a ever interactable afterwards?)
 Still hasn't gotten over the loss of wubwub... |  |  
	| 11-02-2012, 09:55 PM |  |  
	
		| CorinthianMerchant   Posting Freak
 
 Posts: 2,876
 Threads: 84
 Joined: Nov 2011
 Reputation: 
131
 | 
			| RE: Machine puzzle and other things 
 
				Bump!
			 
 Still hasn't gotten over the loss of wubwub... |  |  
	| 11-03-2012, 01:31 PM |  |  
	
		| FlawlessHappiness   Posting Freak
 
 Posts: 3,980
 Threads: 145
 Joined: Mar 2012
 Reputation: 
171
 | 
			| RE: Machine puzzle and other things 
 
				Changing to another map would be:ChangeMap(string& asMapName, string& asStartPos, string& asStartSound, string& asEndSound);
 Immediatly loads another map.
 asMapName - the file to load
 asStartPos - the name of the StartPos on the next map
 asStartSound - the sound that is played when the change starts
 asEndSound - the sound that is played when the new map is loaded
 
 You would have to play with variables to solve the other stuff
 
 Trying is the first step to success. |  |  
	| 11-03-2012, 02:26 PM |  |  
	
		| The chaser   Posting Freak
 
 Posts: 2,486
 Threads: 76
 Joined: Jun 2012
 Reputation: 
113
 | 
			| RE: Machine puzzle and other things 
 
				For 3:
 void OnStart();
 {
 AddEntityCollideCallback("Entity_1", "Script_1", "Blah", true, 1);
 AddEntityCollideCallback("Entity_2", "Script_2", "Blah_1", true, 1);
 }
 
 void Blah (string &in asParent, string &in asChild, int alState)
 {
 AddLocalVarInt("Gangnam", 1);
 func_check();
 }
 
 void Blah_1 (string &in asParent, string &in asChild, int alState)
 {
 AddLocalVarInt("Gangnam", 1);
 func_check();
 }
 
 void func_check();
 {
 if (GetLocalVarInt("Gangnam") == 2)
 {
 SetEntityConnectionStateChangeCallback("Levar_elevator", "Map");
 }
 }
 
 void Map (string &in asEntity, int alState)
 {
 if (alState == 1)
 {
 ChangeMap(string& asMapName, string& asStartPos, string& asStartSound, string& asEndSound);
 }
 }
 
                               THE OTHERWORLD (WIP) ![[Image: k6vbdhu]](http://tinyurl.com/k6vbdhu)  
Aculy iz dolan. |  |  
	| 11-03-2012, 07:06 PM |  |  
	
		| CorinthianMerchant   Posting Freak
 
 Posts: 2,876
 Threads: 84
 Joined: Nov 2011
 Reputation: 
131
 | 
			| RE: Machine puzzle and other things 
 
				 (11-03-2012, 02:26 PM)beecake Wrote:  Changing to another map would be:ChangeMap(string& asMapName, string& asStartPos, string& asStartSound, string& asEndSound);
 Immediatly loads another map.
 asMapName - the file to load
 asStartPos - the name of the StartPos on the next map
 asStartSound - the sound that is played when the change starts
 asEndSound - the sound that is played when the new map is loaded
 
 You would have to play with variables to solve the other stuff
 It doesn't work, I've tried SetEntityPlayerInteractCallback and SetEntityCallbackFunc. 
 Still hasn't gotten over the loss of wubwub... |  |  
	| 11-03-2012, 07:19 PM |  |  
	
		| FlawlessHappiness   Posting Freak
 
 Posts: 3,980
 Threads: 145
 Joined: Mar 2012
 Reputation: 
171
 | 
			| RE: Machine puzzle and other things 
 
				I don't know if it's possible to call a function by examining
			 
 Trying is the first step to success. |  |  
	| 11-03-2012, 08:18 PM |  |  
	
		| The chaser   Posting Freak
 
 Posts: 2,486
 Threads: 76
 Joined: Jun 2012
 Reputation: 
113
 | 
			| RE: Machine puzzle and other things 
 
				Does my script work?
			 
                               THE OTHERWORLD (WIP) ![[Image: k6vbdhu]](http://tinyurl.com/k6vbdhu)  
Aculy iz dolan. |  |  
	| 11-04-2012, 12:17 AM |  |  
	
		| CorinthianMerchant   Posting Freak
 
 Posts: 2,876
 Threads: 84
 Joined: Nov 2011
 Reputation: 
131
 | 
			| RE: Machine puzzle and other things 
 
				 (11-04-2012, 12:17 AM)The chaser Wrote:  Does my script work? No, it crashes. 
I get the following error in the hpl.log: 
------- SCRIPT OUTPUT BEGIN -------------------------- 
main (2, 1) : ERR : Unexpected token '{' 
main (20, 1) : ERR : Unexpected token '{' 
------- SCRIPT OUTPUT END ---------------------------- 
FATAL ERROR: Could not load script file 'TheManMachine/maps/14_MechanicalLaboratory.hps'! 
main (2, 1) : ERR : Unexpected token '{' 
main (20, 1) : ERR : Unexpected token '{'
			 
 Still hasn't gotten over the loss of wubwub... |  |  
	| 11-04-2012, 05:25 PM |  |  
	
		| The chaser   Posting Freak
 
 Posts: 2,486
 Threads: 76
 Joined: Jun 2012
 Reputation: 
113
 | 
			| RE: Machine puzzle and other things 
 
				Silly me   void OnStart() 
{
 
AddEntityCollideCallback("Entity_1", "Script_1", "Blah", true, 1);
 
AddEntityCollideCallback("Entity_2", "Script_2", "Blah_1", true, 1);
 
}
 
void Blah (string &in asParent, string &in asChild, int alState)
 
{
 
AddLocalVarInt("Gangnam", 1);
 
func_check();
 
}
 
void Blah_1 (string &in asParent, string &in asChild, int alState)
 
{
 
AddLocalVarInt("Gangnam", 1);
 
func_check();
 
}
 
void func_check();
 
{
 
if (GetLocalVarInt("Gangnam") == 2)
 
{
 
SetEntityConnectionStateChangeCallback("Levar_elevator", "Map");
 
}
 
}
 
void Map (string &in asEntity, int alState)
 
{
 
if (alState == 1)
 
{
 
ChangeMap( string&  asMapName,  string&  asStartPos,  string&  asStartSound,  string&  asEndSound); 
}
 
}
 
This is the correct script   
                               THE OTHERWORLD (WIP) ![[Image: k6vbdhu]](http://tinyurl.com/k6vbdhu)  
Aculy iz dolan. |  |  
	| 11-04-2012, 05:47 PM |  |  
	
		| CorinthianMerchant   Posting Freak
 
 Posts: 2,876
 Threads: 84
 Joined: Nov 2011
 Reputation: 
131
 | 
			| RE: Machine puzzle and other things 
 
				I still get:------- SCRIPT OUTPUT BEGIN --------------------------
 main (20, 1) : ERR : Unexpected token '{'
 ------- SCRIPT OUTPUT END ----------------------------
 FATAL ERROR: Could not load script file 'TheManMachine/maps/14_MechanicalLaboratory.hps'!
 main (20, 1) : ERR : Unexpected token '{'
 
 Still hasn't gotten over the loss of wubwub... |  |  
	| 11-04-2012, 06:05 PM |  |  |