| 
		
	
		| giacomo9   Junior Member
 
 Posts: 37
 Threads: 11
 Joined: Nov 2012
 Reputation: 
0
 | 
			| Exploding doors 
 
				The player has an explosive potion. When you use it on the door, they explode - how to do it? I have a script for this, but it shows the information "Cannot use this item in this way"...Here's the script:
 ("Completed" - that is exploding potion; "cheryl" - this is normal door; "cherylBroken" - this is broken door)
 
 AddUseItemCallback("", "Completed", "cheryl", "Boom", true);
 
 void Boom(string &in asItem, string &in asEntity)
 {
 SetEntityActive("cheryl", false);
 SetEntityActive("cherylBroken", true);
 PlaySoundAtEntity("", "06_break_wood.snt", "cheryl", 0, false);
 RemoveItem("Complete");
 }
 |  |  
	| 12-03-2012, 09:18 PM |  |  
	
		| FlawlessHappiness   Posting Freak
 
 Posts: 3,980
 Threads: 145
 Joined: Mar 2012
 Reputation: 
171
 | 
			| RE: Exploding doors 
 
				Where exactly did you put AddUseItemCallback("", "Completed", "cheryl", "Boom", true);
 
 These:
 SetEntityActive("cheryl", false);
 SetEntityActive("cherylBroken", true);
 PlaySoundAtEntity("", "06_break_wood.snt", "cheryl", 0, false);
 
 can be replaced by this:
 SetPropHealth("cheryl", 0);
 
 
 Also you have a typo here: RemoveItem("Complete");
 It should be: RemoveItem("Completed");
 
 Trying is the first step to success. |  |  
	| 12-03-2012, 09:37 PM |  |  
	
		| giacomo9   Junior Member
 
 Posts: 37
 Threads: 11
 Joined: Nov 2012
 Reputation: 
0
 | 
			| RE: Exploding doors 
 
				I put it under "void OnStart()" in my .hps file, as here:
 ////////////////////////////
 // Run when starting map
 void OnStart()
 {
 SetPlayerLampOil(0.0f);
 AddUseItemCallback("", "Completed", "cheryl", "Boom", true);
 AddUseItemCallback("", "basementkey_1", "basement_1", "KeyOnDoor", true);
 (...)
 |  |  
	| 12-03-2012, 09:44 PM |  |  
	
		| FlawlessHappiness   Posting Freak
 
 Posts: 3,980
 Threads: 145
 Joined: Mar 2012
 Reputation: 
171
 | 
			| RE: Exploding doors 
 
				And you're sure the item is called "Completed" and the door is called "cheryl"?You have to be 100% sure with capitals and all that
 
 Trying is the first step to success. |  |  
	| 12-03-2012, 10:29 PM |  |  
	
		| giacomo9   Junior Member
 
 Posts: 37
 Threads: 11
 Joined: Nov 2012
 Reputation: 
0
 | 
			| RE: Exploding doors 
 
				You're right, I did not notice the error in the name. Now everything is working. Thank you for your time    |  |  
	| 12-03-2012, 10:44 PM |  |  
	
		| The chaser   Posting Freak
 
 Posts: 2,486
 Threads: 76
 Joined: Jun 2012
 Reputation: 
113
 | 
			| RE: Exploding doors 
 
				 (12-03-2012, 10:44 PM)giacomo9 Wrote:  You're right, I did not notice the error in the name. Now everything is working. Thank you for your time  When it says "Cannot use item this way!" is because names are wrong.
			 
                               THE OTHERWORLD (WIP) ![[Image: k6vbdhu]](http://tinyurl.com/k6vbdhu)  
Aculy iz dolan. |  |  
	| 12-03-2012, 11:00 PM |  |  
	
		| FlawlessHappiness   Posting Freak
 
 Posts: 3,980
 Threads: 145
 Joined: Mar 2012
 Reputation: 
171
 | 
			| RE: Exploding doors 
 
				 (12-03-2012, 11:00 PM)The chaser Wrote:   (12-03-2012, 10:44 PM)giacomo9 Wrote:  You're right, I did not notice the error in the name. Now everything is working. Thank you for your time When it says "Cannot use item this way!" is because names are wrong. Not exactly. It means that it finds no connection between the item and the entity. For example if the names are wrong.
			 
 Trying is the first step to success. |  |  
	| 12-04-2012, 06:50 AM |  |  |