| 
		
	
		| himynamebob1   Member
 
 Posts: 57
 Threads: 12
 Joined: Jun 2012
 Reputation: 
0
 | 
			| [HELP] Script Enabling/Variables 
 
				Is there a way to make it so you can not use a script until something else happens so lets say, someone wants to cook something over a fire, well there has to be a check made that the fire is on before the item can be cooked. I also need help with the fact that a player can not put down a jar to pick up drops of something until they stab into the something and have it leak out.
			 
				
(This post was last modified: 07-04-2012, 08:27 PM by himynamebob1.)
 |  |  
	| 07-01-2012, 07:09 AM |  |  
	
		| SilentStriker   Posting Freak
 
 Posts: 950
 Threads: 26
 Joined: Jul 2011
 Reputation: 
43
 | 
			| RE: [HELP] Script Enabling? 
 
				Local variables is the thing you are looking for
			 
 |  |  
	| 07-01-2012, 09:05 AM |  |  
	
		| Ongka   Member
 
 Posts: 225
 Threads: 3
 Joined: Nov 2010
 Reputation: 
20
 | 
			| RE: [HELP] Script Enabling? 
 
				void OnStart(){
 SetLocalVarInt("FireActive", 0);
 }
 
 void InteractFire(string &in asEntity, int alState)
 {
 SetLocalVarInt("FireActive", 1);
 }
 
 void InteractStove(string &in asEntity, int alState)
 {
 if(GetLocalVarInt("FireActive") == 1)
 {
 //Script which can happen after the fire is turned on
 }
 else
 {
 //What happens if the fire isn't active
 }
 }
 //Extra var scripts: AddLocalVarInt("FireActive", 1) obviously adds the value 1 to FireActive
 //Put the Interact-names in the entity field "on interact" or something like that. It will call up this function.
If there is anything you'd like to know, feel free to let me know.
			 
 
				
(This post was last modified: 07-01-2012, 10:12 AM by Ongka.)
 |  |  
	| 07-01-2012, 10:12 AM |  |  
	
		| JMFStorm   Member
 
 Posts: 205
 Threads: 8
 Joined: Aug 2011
 Reputation: 
28
 |  |  
	| 07-01-2012, 12:28 PM |  |  
	
		| Your Computer   SCAN ME!
 
 Posts: 3,456
 Threads: 32
 Joined: Jul 2011
 Reputation: 
235
 | 
			| RE: [HELP] Script Enabling? 
 
				I think local variables can be avoided if the sequence of callbacks are done properly. FullGameSave may also play a role here.
			 
 |  |  
	| 07-01-2012, 03:03 PM |  |  
	
		| himynamebob1   Member
 
 Posts: 57
 Threads: 12
 Joined: Jun 2012
 Reputation: 
0
 | 
			| RE: [HELP] Script Enabling? 
 
				I'm seeming to have problems with this, here's my code.     //===========================================// This runs when the player enters the map
 void OnEnter()
 {
 SetLocalVarInt("Proccess", 0);
 SetLocalVarInt("Fire", 0);
 AddTimer("brute", 13.0f, "noisy");
 AddUseItemCallback("phekeg", "breakkegknife", "winekegpop", "boomkegopen", true);
 AddUseItemCallback("phekegs", "glass_container_1", "boardone", "boomkegopen2", true);
 AddUseItemCallback("phekegs2", "fullowine", "sheetmet", "boomkegopen23", true);
 AddUseItemCallback("phekegs23", "tinderbox_1", "bonfire_1", "boomkegopen233", true);
 
 }
 void boomkegopen233(string &in asItem, string &in asEntity)
 {
 SetLocalVarInt("Fire", 1);
 }
 void boomkegopen23(string &in asItem, string &in asEntity)
 {
 if (GetLocalVarInt("Fire") == 1)
 {
 SetEntityActive("glasnotdone", true);
 RemoveItem("fullowine");
 AddTimer("brute223", 5.0f, "outahere34");
 }
 
 }
 void outahere34(string &in asTimer)
 {
 if (GetLocalVarInt("Proccess") == 1)
 {
 SetEntityActive("glasnotdone", false);
 SetEntityActive("done", true);
 }
 
 }
 
 void boomkegopen2(string &in asItem, string &in asEntity)
 {
 SetEntityActive("glass_container_2", true);
 AddTimer("brute223", 5.0f, "outahere3");
 RemoveItem("glass_container_1");
 PlaySoundAtEntity("bruto23", "19_pour_blood.snt", "Player", 0.0f, false);
 }
 void outahere3(string &in asTimer)
 {
 SetEntityActive("glass_container_2", false);
 SetEntityActive("fullowine", true);
 }
 
 void boomkegopen(string &in asItem, string &in asEntity)
 {
 PlaySoundAtEntity("bruto2", "19_inject.snt", "Player", 0.0f, false);
 SetEntityActive("breakkeg_1", true);
 AddTimer("brute23", 2.0f, "outahere");
 RemoveItem("breakkegknife");
 SetLocalVarInt("Proccess", 1);
 }
 void outahere(string &in asTimer)
 {
 SetEntityActive("wineout", true);
 SetEntityActive("breakkeg_1", false);
 FadeInSound("wineout", 1.0f, true);
 CreateParticleSystemAtEntity("hhgh", "ps_liquid_epoxy.ps", "breakkeg_1", true);
 }
 void noisy(string &in asTimer)
 {
 PlaySoundAtEntity("bruto", "enabled01.snt", "brutenoise", 0.0f, false);
 AddTimer("brute2", 4.5f, "noie");
 }
 void noie(string &in asTimer)
 {
 PlayMusic("04_amb.ogg", true, 1.0, 0.0f, 0, false);
 }
 //===========================================
 // This runs when the player leaves the map
 void OnLeave()
 {
 }
 |  |  
	| 07-03-2012, 08:47 PM |  |  
	
		| Cruzore   Senior Member
 
 Posts: 301
 Threads: 2
 Joined: Jun 2012
 Reputation: 
37
 | 
			| RE: [HELP] Script Enabling? 
 
				What problems? Is there any error message, or does only 1 part of it not work? Go detailed with the problem.
			 
 Think, before you speak Google, before you post |  |  
	| 07-03-2012, 09:05 PM |  |  
	
		| himynamebob1   Member
 
 Posts: 57
 Threads: 12
 Joined: Jun 2012
 Reputation: 
0
 | 
			| RE: [HELP] Script Enabling? 
 
				There still is no restriction, I'm able to commit the scripts even if I haven't done the previous action leading up.
			 |  |  
	| 07-03-2012, 09:20 PM |  |  
	
		| himynamebob1   Member
 
 Posts: 57
 Threads: 12
 Joined: Jun 2012
 Reputation: 
0
 | 
			| RE: [HELP] Script Enabling? 
 
				Hmm I still can not find the source of error.
			 |  |  
	| 07-04-2012, 04:56 PM |  |  
	
		| himynamebob1   Member
 
 Posts: 57
 Threads: 12
 Joined: Jun 2012
 Reputation: 
0
 | 
			| RE: [HELP] Script Enabling/Variables 
 
				If anyone could help me I'd be very grateful, I'd very much like to continue my work.    |  |  
	| 07-04-2012, 09:22 PM |  |  |