| 
		
	
		| TheGreatCthulhu   Member
 
 Posts: 213
 Threads: 10
 Joined: Oct 2010
 Reputation: 
32
 | 
			| RE: i forgot how to script :c 
 
				 (12-17-2012, 12:13 PM)nightsxp Wrote:  what;s wrong??
 
 AddEntityCollideCallback("Player","Area ","lantern");
 
 
 
 
 void gothrough(string &in asParent, string &in asChild, int alState)
 {
 if(HasItem("lantern") == true)
 {
 
 SetEntityActive("block", false);
 
 
 }
 
 
 }
 
 
 i actually want: if player has lantern he can go throuh ''Area''
 This is wrong: AddEntityCollideCallback("Player","Area ","lantern");
 
That function takes 5 parameters, not 3; look at the declaration (this is the declaration, not how you call it!):
 void AddEntityCollideCallback(string& asParentName,       // your "Player" parameter
 string& asChildName,        // your "Area" parameter
 string& asFunction,          // callback function - your "lantern" parameter <---- watch it!
 bool abDeleteOnCollide,     // pass either true or false here
 int alStates                     // check the docs to see what to pass here (either -1, 0, or 1)
 );
Next, if you want the gothrough() function to be called by the game when the player and the area collide, then you have to specify it's name "gothrough" instead of "lantern" above - otherwise the engine will look for a callback function called "lantern", and it will never call this function.
 
Also, when you have troubles, always describe the errors in more detail - what did you expect to happen vs what actually happens, what are the error messages, if any, etc...
 
P.S. BTW, if you need a bit more guidance, the proper way to call AddEntityCollideCallback() is (asuming you want gothrough as your callback): 
AddEntityCollideCallback("Player", "Area ", "gothrough", true, 1);
			 |  |  
	| 12-17-2012, 01:13 PM |  |  
	
		| nightsxp   Member
 
 Posts: 53
 Threads: 8
 Joined: Sep 2011
 Reputation: 
0
 | 
			| RE: i forgot how to script :c 
 
				 (12-17-2012, 01:13 PM)TheGreatCthulhu Wrote:   (12-17-2012, 12:13 PM)nightsxp Wrote:  what;s wrong??This is wrong: AddEntityCollideCallback("Player","Area ","lantern");
 
 AddEntityCollideCallback("Player","Area ","lantern");
 
 
 
 
 void gothrough(string &in asParent, string &in asChild, int alState)
 {
 if(HasItem("lantern") == true)
 {
 
 SetEntityActive("block", false);
 
 
 }
 
 
 }
 
 
 i actually want: if player has lantern he can go throuh ''Area''
 
 That function takes 5 parameters, not 3; look at the declaration (this is the declaration, not how you call it!):
 
 void AddEntityCollideCallback(string& asParentName,       // your "Player" parameter
 string& asChildName,        // your "Area" parameter
 string& asFunction,          // callback function - your "lantern" parameter <---- watch it!
 bool abDeleteOnCollide,     // pass either true or false here
 int alStates                     // check the docs to see what to pass here (either -1, 0, or 1)
 );
Next, if you want the gothrough() function to be called by the game when the player and the area collide, then you have to specify it's name "gothrough" instead of "lantern" above - otherwise the engine will look for a callback function called "lantern", and it will never call this function.
 
 Also, when you have troubles, always describe the errors in more detail - what did you expect to happen vs what actually happens, what are the error messages, if any, etc...
 
 P.S. BTW, if you need a bit more guidance, the proper way to call AddEntityCollideCallback() is (asuming you want gothrough as your callback):
 AddEntityCollideCallback("Player", "Area ", "gothrough", true, 1);
 Thanks yo you all :I i will try to understand.
			 
				
(This post was last modified: 12-17-2012, 02:31 PM by nightsxp.)
 |  |  
	| 12-17-2012, 01:31 PM |  |  
	
		| nightsxp   Member
 
 Posts: 53
 Threads: 8
 Joined: Sep 2011
 Reputation: 
0
 | 
			| RE: i forgot how to script :c 
 
				hi again x33 how can i teleport player from Area1 to Area2?and after 6 seconds he will return to Area1?
			 |  |  
	| 12-19-2012, 06:53 AM |  |  
	
		| FlawlessHappiness   Posting Freak
 
 Posts: 3,980
 Threads: 145
 Joined: Mar 2012
 Reputation: 
171
 | 
			| RE: i forgot how to script :c 
 
				You use this lineTeleportPlayer("Area2");
 
 The other one is just a timer. You know how to use them right?
 
 Trying is the first step to success. |  |  
	| 12-19-2012, 08:12 AM |  |  
	
		| nightsxp   Member
 
 Posts: 53
 Threads: 8
 Joined: Sep 2011
 Reputation: 
0
 | 
			| RE: i forgot how to script :c 
 
				 (12-19-2012, 08:12 AM)beecake Wrote:  You use this lineTeleportPlayer("Area2");
 
 The other one is just a timer. You know how to use them right?
 Maybe x3 Thanks a lot.
			 |  |  
	| 12-19-2012, 08:56 AM |  |  
	
		| FlawlessHappiness   Posting Freak
 
 Posts: 3,980
 Threads: 145
 Joined: Mar 2012
 Reputation: 
171
 | 
			| RE: i forgot how to script :c 
 
				Let's say you call a timer called TeleportTimerYou call these 2 lines:
 AddTimer("Area2", 0, "TeleportTimer");
 AddTimer("Area1", 6, "TeleportTimer");
 
 
 void TeleportTimer(string &in asTimer)
 {
 if(asTimer == "Area1")
 {
 TeleportPlayer("Area1");
 }
 
 if(asTimer == "Area2")
 {
 TeleportPlayer("Area2");
 }
 }
 
 Trying is the first step to success. |  |  
	| 12-19-2012, 11:02 AM |  |  
	
		| Your Computer   SCAN ME!
 
 Posts: 3,456
 Threads: 32
 Joined: Jul 2011
 Reputation: 
235
 | 
			| RE: i forgot how to script :c 
 
				TeleportPlayer already takes in only one string, so it's much simpler to do  AddTimer("PlayerStartAreaName", 6, "TeleportPlayer"); 
 |  |  
	| 12-19-2012, 11:28 AM |  |  
	
		| FlawlessHappiness   Posting Freak
 
 Posts: 3,980
 Threads: 145
 Joined: Mar 2012
 Reputation: 
171
 | 
			| RE: i forgot how to script :c 
 
				 (12-19-2012, 11:28 AM)Your Computer Wrote:  TeleportPlayer already takes in only one string, so it's much simpler to do 
 
 AddTimer("PlayerStartAreaName", 6, "TeleportPlayer"); 
 Yea, but might be harder to understand    
 Trying is the first step to success. |  |  
	| 12-19-2012, 11:36 AM |  |  
	
		| TheGreatCthulhu   Member
 
 Posts: 213
 Threads: 10
 Joined: Oct 2010
 Reputation: 
32
 | 
			| RE: i forgot how to script :c 
 
				How is that harder to understand? It's the same thing, except the call is now made directly. That's like saying that it's easier to write if you tape the pen at the end of a long stick, and use the stick instead    
Also, even with your indirect approach, the if statements are not required in this scenario - you can just pass the parameter along.
			 |  |  
	| 12-19-2012, 02:17 PM |  |  
	
		| FlawlessHappiness   Posting Freak
 
 Posts: 3,980
 Threads: 145
 Joined: Mar 2012
 Reputation: 
171
 | 
			| RE: i forgot how to script :c 
 
				Ok sorry
			 
 Trying is the first step to success. |  |  
	| 12-19-2012, 02:44 PM |  |  |