Mudbill 
 
 
		
			Muderator 
			
			
			
 
			
	Posts: 3,881 
	Threads: 59 
	Joined: Apr 2013
	
 Reputation: 
179
		
	 | 
	
		
			
RE: [SOLVED] Using a Single Crowbar on Multiple Doors 
			 
			
				Okay we need to do something more clever then.  
Oh, and one more thing: If you're using a lot of things with for-loops, it might be better to simply use the same one, by doing so:
 for(int i = 1; i <= 4; i++) {     AddUseItemCallback("crowbarondoors", "Crowbar_1", "Door_"+i, "UseCrowbarOnDoor", false);     AddEntityCollideCallback("Joint_Door_"+i, "AreaBreak_"+i, "BreakDoor", true, 1); } 
 
  
			 
			
			
 
			
				
(This post was last modified: 09-22-2014, 09:45 AM by Mudbill.)
 
				
			 
		 |  
	 
 | 
 
	| 09-22-2014, 09:44 AM  | 
	
		
	 | 
 
 
	
		
		FlawlessHappiness 
 
 
		
			Posting Freak 
			
			
			
 
			
	Posts: 3,980 
	Threads: 145 
	Joined: Mar 2012
	
 Reputation: 
171
		
	 | 
	
		
			
RE: [SOLVED] Using a Single Crowbar on Multiple Doors 
			 
			
				Do you have to use the brackets, when doing so? 
I believe it's just setting the variable i to 1;4 and as long as you keep it in the same brackets wouldn't it work just by putting +i in both functions?
  (09-22-2014, 09:44 AM)AGP Wrote:  It's now gone back to skipping the particle effects. :/ 
 
It did work using "_"+i, but it did make the particles appear for all the other doors. 
Did you remember to rename the areas correctly? 
What are the names of the areas?
			  
			
			
 
Trying is the first step to success. 
			
		 |  
	 
 | 
 
	| 09-22-2014, 09:46 AM  | 
	
		
	 | 
 
 
	
		
		Mudbill 
 
 
		
			Muderator 
			
			
			
 
			
	Posts: 3,881 
	Threads: 59 
	Joined: Apr 2013
	
 Reputation: 
179
		
	 | 
	
		
			
RE: [SOLVED] Using a Single Crowbar on Multiple Doors 
			 
			
				Well, the for-loop block finishes before repeating, so i will still be the same value on both entries until they're done and it repeats, at which point i has increased and it occurs again.
			 
			
			
 
			
				
(This post was last modified: 09-22-2014, 09:50 AM by Mudbill.)
 
				
			 
		 |  
	 
 | 
 
	| 09-22-2014, 09:49 AM  | 
	
		
	 | 
 
 
	
		
		AGP 
 
 
		
			Senior Member 
			
			
			
 
			
	Posts: 448 
	Threads: 45 
	Joined: Dec 2012
	
 Reputation: 
23
		
	 | 
	
		
			
RE: [SOLVED] Using a Single Crowbar on Multiple Doors 
			 
			
				 (09-22-2014, 09:44 AM)Mudbill Wrote:  Okay we need to do something more clever then.  
 
Oh, and one more thing: If you're using a lot of things with for-loops, it might be better to simply use the same one, by doing so: 
 
for(int i = 1; i <= 4; i++) {     AddUseItemCallback("crowbarondoors", "Crowbar_1", "Door_"+i, "UseCrowbarOnDoor", false);     AddEntityCollideCallback("Joint_Door_"+i, "AreaBreak_"+i, "BreakDoor", true, 1); } 
 
  
For some reason, changing that made the crowbar not work at all. :/
 
EDIT: I need to learn to read first.... This is henceforth going to be known as the night of the facepalms! Just needed to change Crowbar_1 to crowbar.
 
*facepalm*
			  
			
			
 
			
				
(This post was last modified: 09-22-2014, 09:52 AM by AGP.)
 
				
			 
		 |  
	 
 | 
 
	| 09-22-2014, 09:49 AM  | 
	
		
	 | 
 
 
	
		
		FlawlessHappiness 
 
 
		
			Posting Freak 
			
			
			
 
			
	Posts: 3,980 
	Threads: 145 
	Joined: Mar 2012
	
 Reputation: 
171
		
	 | 
	
		
			
RE: [SOLVED] Using a Single Crowbar on Multiple Doors 
			 
			
				Please answer this   
 (09-22-2014, 09:46 AM)FlawlessHappiness Wrote:  Did you remember to rename the areas correctly? 
What are the names of the areas? 
			 
			
			
 
Trying is the first step to success. 
			
		 |  
	 
 | 
 
	| 09-22-2014, 09:50 AM  | 
	
		
	 | 
 
 
	
		
		AGP 
 
 
		
			Senior Member 
			
			
			
 
			
	Posts: 448 
	Threads: 45 
	Joined: Dec 2012
	
 Reputation: 
23
		
	 | 
	
		
			
RE: [SOLVED] Using a Single Crowbar on Multiple Doors 
			 
			
				The areas are AreaBreak_1 (and then so on till 4) and AreaEffect_1 (up until 4). They were all duplicated from their originals, so they match the firsts.
			 
			
			
 
			
		 |  
	 
 | 
 
	| 09-22-2014, 09:53 AM  | 
	
		
	 | 
 
 
	
		
		FlawlessHappiness 
 
 
		
			Posting Freak 
			
			
			
 
			
	Posts: 3,980 
	Threads: 145 
	Joined: Mar 2012
	
 Reputation: 
171
		
	 | 
	
		
			
RE: [SOLVED] Using a Single Crowbar on Multiple Doors 
			 
			
				Ok, so this is why the effects won't spawn: 
 (09-22-2014, 09:39 AM)FlawlessHappiness Wrote:  Since you're having the two things in the collide callback, why not have them call at 
 
"AreaEffect_"+asParent. 
 
And just rename all the effect areas to the right names. 
You forgot to rename the areas to the right thing. If the Joint collides with areabreak, then the effect areas should be "AreaEffect_AreaBreak_1", and "AreaEffect_AreaBreak_2", and so on...
			  
			
			
 
Trying is the first step to success. 
			
		 |  
	 
 | 
 
	| 09-22-2014, 09:57 AM  | 
	
		
	 | 
 
 
	
		
		AGP 
 
 
		
			Senior Member 
			
			
			
 
			
	Posts: 448 
	Threads: 45 
	Joined: Dec 2012
	
 Reputation: 
23
		
	 | 
	
		
			
RE: [SOLVED] Using a Single Crowbar on Multiple Doors 
			 
			
				 (09-22-2014, 09:57 AM)FlawlessHappiness Wrote:  Ok, so this is why the effects won't spawn: 
 (09-22-2014, 09:39 AM)FlawlessHappiness Wrote:  Since you're having the two things in the collide callback, why not have them call at 
 
"AreaEffect_"+asParent. 
 
And just rename all the effect areas to the right names.  
You forgot to rename the areas to the right thing. If the Joint collides with areabreak, then the effect areas should be "AreaEffect_AreaBreak_1", and "AreaEffect_AreaBreak_2", and so on... 
Oh! Okay! I get what you mean now!
 
I'll have to test it out in the morning as it's getting pretty late over here.
			  
			
			
 
			
		 |  
	 
 | 
 
	| 09-22-2014, 10:14 AM  | 
	
		
	 | 
 
 
	
		
		FlawlessHappiness 
 
 
		
			Posting Freak 
			
			
			
 
			
	Posts: 3,980 
	Threads: 145 
	Joined: Mar 2012
	
 Reputation: 
171
		
	 | 
	
		
			
RE: [SOLVED] Using a Single Crowbar on Multiple Doors 
			 
			
				I hope it works out for you ^_^ 
Remeber that it's only because we are using +asParent here, that you can name the selected area "AreaEffect_AreaBreak_1"   
			 
			
			
 
Trying is the first step to success. 
			
		 |  
	 
 | 
 
	| 09-22-2014, 10:30 AM  | 
	
		
	 | 
 
 
	
		
		AGP 
 
 
		
			Senior Member 
			
			
			
 
			
	Posts: 448 
	Threads: 45 
	Joined: Dec 2012
	
 Reputation: 
23
		
	 | 
	
		
			
RE: Using a Single Crowbar on Multiple Doors 
			 
			
				I tried it and still the same problem. But when I switched it back to using +i, it works! Aside from all the doors playing the effect at the same time. 
 
If a solution cannot be found for this, I may leave it with the doors setting off the effects at the same time. Since the doors that require the crowbar aren't anywhere near each other, it shouldn't hinder things too badly.
			 
			
			
 
			
		 |  
	 
 | 
 
	| 09-22-2014, 08:03 PM  | 
	
		
	 | 
 
 
	 
 |