| 
 [HELP] Script Enabling/Variables - himynamebob1 -  07-01-2012
 
 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.
 
 
 RE: [HELP] Script Enabling? - SilentStriker -  07-01-2012
 
 Local variables is the thing you are looking for
 
 
 RE: [HELP] Script Enabling? - Ongka -  07-01-2012
 
 
 If there is anything you'd like to know, feel free to let me know.Code: 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.
 
 RE: [HELP] Script Enabling? - JMFStorm -  07-01-2012
 
 If that looks complicated to you I'd recommend you should study this:
 http://wiki.frictionalgames.com/hpl2/tutorials/script/localandglobalvariables
 
 
 RE: [HELP] Script Enabling? - Your Computer -  07-01-2012
 
 I think local variables can be avoided if the sequence of callbacks are done properly. FullGameSave may also play a role here.
 
 
 RE: [HELP] Script Enabling? - himynamebob1 -  07-03-2012
 
 I'm seeming to have problems with this, here's my code.
 
 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()
 {
 }
 
 RE: [HELP] Script Enabling? - Cruzore -  07-03-2012
 
 What problems? Is there any error message, or does only 1 part of it not work? Go detailed with the problem.
 
 
 RE: [HELP] Script Enabling? - himynamebob1 -  07-03-2012
 
 There still is no restriction, I'm able to commit the scripts even if I haven't done the previous action leading up.
 
 
 RE: [HELP] Script Enabling? - himynamebob1 -  07-04-2012
 
 Hmm I still can not find the source of error.
 
 
 RE: [HELP] Script Enabling/Variables - himynamebob1 -  07-04-2012
 
 If anyone could help me I'd be very grateful, I'd very much like to continue my work.
   
 
 
 |