Frictional Games Forum (read-only)
[SCRIPT] I need some help I can't check if the 4 chemicals are placed in the acid machine - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SCRIPT] I need some help I can't check if the 4 chemicals are placed in the acid machine (/thread-24679.html)



I need some help I can't check if the 4 chemicals are placed in the acid machine - davide32 - 02-22-2014

I tried to do a chemical acid but how can I check if the VarInt is = to 4 chemicals? Can the help me? i give you my hps file and the map for modify the hps file and check in the map what have i did
my hps file: https://www.mediafire.com/?8mq0vgei8595hfd
my map: http://www.mediafire.com/download/i03at366irttd19/Level5.map
send it from e-mail pls after modified the hps file with corrections in CAPS LOCK Please ask me


RE: I need some help I can't check if the 4 chhemicals are placed in te acid machine - Neelke - 02-22-2014

Ive checked your scripts and you have too many VarInts. Try deleteing a few and check later if it helps.


RE: I need some help I can't check if the 4 chemicals are placed in the acid machine - davide32 - 02-23-2014

today i found the solution but I can't make a fire but the lights are placed in the map and i set it with particle system created with script CreateParticleSystemAtEntity So i delete some varints setted

so I removed some varInts
This is my script:
void OnStart()
{
SetLocalVarInt("CheckChemicalsinMachine", 0); //VarInt of the 4 chemicals
for(int i=0; i<=4; i++)
{
SetWheelStuckState("Valve_" +i, -1, true);
}

SetWheelStuckState("ValveIgnite", -1, true);

SetPlayerSanity(10);
SetLocalVarInt("Var2", 0);
SetLocalVarInt("Var1", 0);
AddUseItemCallback("placebottle", "container", "AreaUseMachine", "ItemJarOnMachine", true);
AddUseItemCallback("placebottle2", "container", "AreaPlaceJar", "ItemJarOnMachine", true);
AddUseItemCallback("placebottle3", "container", "ValveIgnite", "ItemJarOnMachine", true);
AddUseItemCallback("", "Cuprite", "JarEmptyChemical_1", "Cupritesound", true);
AddUseItemCallback("", "Oripment", "JarEmptyChemical_2", "Oripmentsound", true);
AddUseItemCallback("", "Aqua Regia", "JarEmptyChemical_3", "AquaRegiasound", true);
AddUseItemCallback("", "Calamine", "JarEmptyChemical_4", "Calaminesound", true);
}
void ItemJarOnMachine(string &in asItem, string &in asEntity)
{
if (GetLocalVarInt("Var2") == 0)
{
RemoveItem(asItem);
SetEntityActive("Container_static_1", true);
PlaySoundAtEntity("PlaceJar","puzzle_place_jar", "AreaCompleteSuccess", 0, false);
CheckChemical();
{
}
}
else if (GetLocalVarInt("Var4")== 2)
{
AddLocalVarInt("Var4", 2);
SetWheelInteractionDisablesStuck("ValveIgnite", true);
}
}
void Cupritesound(string &in asItem, string &in asEntity)
{
AddLocalVarInt("CheckChemicalsinMachine", 1);
RemoveItem(asItem);
SetEntityActive("JarChemical_1", true);
SetEntityActive("JarEmptyChemical_1", false);
PlaySoundAtEntity("", "puzzle_add_chemical.snt", "Player", 0.1, false);
CheckChemical();
}

void Oripmentsound(string &in asItem, string &in asEntity)
{

AddLocalVarInt("CheckChemicalsinMachine", 1);
RemoveItem(asItem);
SetEntityActive("JarChemical_2", true);
SetEntityActive("JarEmptyChemical_2", false);
PlaySoundAtEntity("", "puzzle_add_chemical.snt", "Player", 0.1, false);
CheckChemical();
}
void AquaRegiasound(string &in asItem, string &in asEntity)
{
AddLocalVarInt("CheckChemicalsinMachine", 1);
RemoveItem(asItem);
SetEntityActive("JarChemical_3", true);
SetEntityActive("JarEmptyChemical_3", false);
PlaySoundAtEntity("", "puzzle_add_chemical.snt", "Player", 0.1, false);
CheckChemical();
}

void Calaminesound(string &in asItem, string &in asEntity)
{
AddLocalVarInt("CheckChemicalsinMachine", 1);
RemoveItem(asItem);
SetEntityActive("JarChemical_4", true);
SetEntityActive("JarEmptyChemical_4", false);
PlaySoundAtEntity("", "puzzle_add_chemical.snt", "Player", 0.1, false);
CheckChemical();
}

void Puzzle(string &in asEntity, int alState)
{
for (int i=0; i<=4; i++)
{
SetWheelInteractionDisablesStuck("Valve_"+i, true); //loop as the 4 Valve are Disable the StuckState
//else if the Var !=4 it compares the message
SetMessage("Messages", "conteiner", 0);
}
// check the varint
if (GetLocalVarInt("Var1") <=5)
{
if (alState == 1) //if the ValveIgnite +alState == 1 it unstuck the Valves
{
AddLocalVarInt("Var1", 1);
SetWheelInteractionDisablesStuck("Valve_1", true);
}
else AddLocalVarInt("Var1", 1);
if (alState == 1) //Valve_1
{
AddLocalVarInt("Var1", 1);
SetWheelInteractionDisablesStuck("Valve_3", true);
}
else if(alState ==1) //Valve_2
{
AddLocalVarInt("Var1", 1);
if (alState == 1) //Valve_3
{
AddLocalVarInt("Var1", 1);
SetWheelInteractionDisablesStuck("Valve_4", true);
}
}
}
}

void CheckChemical() //it check until the 4 wheels are stucked in state 1 the container will be active and the static container will be disapair, and give the boost sanity//
{
if (GetLocalVarInt("CheckChemicalsinMachine") !=4)
{

}
else if(GetLocalVarInt("CheckChemicalsinMachine") ==4)
{
GiveSanityBoost();
SetEntityActive("chemical_1", true);
SetEntityActive("Container_static_1", false);
}
for(int i=0; i<=4;i++)
{
CreateParticleSystemAtEntity("", "ps_fire_lab_burner.ps", "PointLight_"+i, false);
}
}