Frictional Games Forum (read-only)

Full Version: Making An Acid
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I want to create an acid, just like in the normal game at the very beginning where you go to the lab and must get the flasks to create the acid pot, the items are Chemistry Pot ,jars of Orpiment, Cuprite, Aqua Regia and lastly Calamine., And when I make the acid, I want to put each chemical on that chemistry acid doing machine at the lab it will create acid for me and then I will want to use it on a pod on the wall just like in the game.

the machine looks like




at part 2:24 you can see the chemical-acid doing machine. if anyone knows how to do all these things, then please tell.

sorry for my english. , thanks for anyone who helps.
The script in Amnesia shows how to do it. If you do want to know how to do it, that's your best chance. All it uses are items/chemicals that are placed throughout those other levels, and then have a AddUseItemCallback for each item/chemical so when used onto the laboratory kit, each sets a chemical jar active while removing the chemical from your inventory and then it checks to see if all chemicals were placed down with a local variable integer, and then once they are placed down, it has the player twist the wheels causing each chemical to be released into the chemical jar that you placed there before. Then it adds bubbling sound here and there with some cool particle systems.

Simple for the player, yet very time consuming for the scripter. Ingenious. Tongue
Hmm, I'll try copy+c and paste it into my files, where do i find the script in the files?, because I can't seem to find., I dont really know how it looks though.
Steam version:
amnesia the dark descent --> maps --> main --> ch01 --> 04_wine_cellar_lab.hps

Retail version:
amnesia the dark descent --> Redist --> maps --> main --> ch01 --> 04_wine_cellar_lab.hps

I hope this was what you're talking about, unless you're talking about inside the actual script. :/
(07-25-2011, 09:00 PM)Kyle Wrote: [ -> ]The script in Amnesia shows how to do it. If you do want to know how to do it, that's your best chance. All it uses are items/chemicals that are placed throughout those other levels, and then have a AddUseItemCallback for each item/chemical so when used onto the laboratory kit, each sets a chemical jar active while removing the chemical from your inventory and then it checks to see if all chemicals were placed down with a local variable integer, and then once they are placed down, it has the player twist the wheels causing each chemical to be released into the chemical jar that you placed there before. Then it adds bubbling sound here and there with some cool particle systems.

Simple for the player, yet very time consuming for the scripter. Ingenious. Tongue

I just realised, it's not even that complicated if you put your mind to it, because I almost know how to script it Smile
(07-25-2011, 09:16 PM)JoeBradleyUK Wrote: [ -> ]I just realised, it's not even that complicated if you put your mind to it, because I almost know how to script it Smile

And I know how to script it. Wink
You know how to script it or got it?, If so, can you send it to me please?, I dont know how to do AddUseItemCallback or however it's called, this is what my HPS file looks like at the moment., But it seems like my game crashes everytime I want to play my custom story after I did this.

Spoiler below!
void OnStart()

{
AddUseItemCallback("", "Key1", "Door1", "KeyOnDoor", true);
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Door1", false, true);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("Key1");
}


//////////////////////
//BEGIN ACID MACHINE//
/*Use jar on machine to place it under pipe
*/
void ItemJarOnMachine(string &in asItem, string &in asEntity)
{
SetEntityActive("chemical_container_static_1", true);

RemoveItem(asItem);

PlaySoundAtEntity("PlaceJar","puzzle_place_jar", "AreaCompleteSuccess", 0, false);

SetLocalVarInt("chemical_container_static_1", 1);
}
/*Use chemicals on machine or valves to add it to bottles
*/
void AddChemical(string &in asItem, string &in asEntity)
{
RemoveItem(asItem);

AddLocalVarInt("ChemicalsInMachine", 1);

SetEntityActive("JarEmpty"+asItem, false);
SetEntityActive("Jar"+asItem, true);

PlaySoundAtEntity(asItem+"Sound","puzzle_add_chemical.snt", asEntity, 1, false);
FadeLightTo("Light"+asItem, -1, -1, -1, -1, 0.5f, 0.1f);

//Moved sanity boost to first instead of last, migth be better to boost early if player didn't get all 4.
if(GetLocalVarInt("ChemicalsInMachine") == 1)
GiveSanityBoostSmall();

if(GetLocalVarInt("ChemicalsInMachine") == 3 )
BreakMyStairs();

if(GetLocalVarInt("ChemicalsInMachine") == 4){
CompleteQuest("04FindChemicals","04FindChemicals");
UnBlockHint("EntityWheel");
for(int i=1;i<=4;i++)
SetEntityPlayerInteractCallback("Valve_"+i, "InteractAcidMachine02", true);
SetLocalVarInt("DoBigFeet", 0);
}
}
/*When touching the vales
*/
void InteractAcidMachine(string &in asEntity)
{
if(GetLocalVarInt("ChemicalsInMachine") != 4)
{
AddQuest("04FindChemicals","04FindChemicals");
SetMessage("Ch01Level04", "InteractAcidMachineNoChem",-1);
}
else if(GetLocalVarInt("ChemicalsInMachine") == 4)
{
SetWheelStuckState("ValveIgnite", 0, false);
}
}
void InteractAcidMachine02(string &in asEntity)
{
if(GetLocalVarInt("ValveIgniteFirst") == 0)
{
SetMessage("Ch01Level03", "MachineNeedsToStart", 0);
SetLocalVarInt("ValveIgniteFirst", 1);
for(int i=1;i<=4;i++)
SetEntityPlayerInteractCallback("Valve_"+i, "InteractAcidMachine", false);
}
}
/*Moving the big valve will turn on the burners and ready the machine
*/
void InteractTurnOnAcidMachine(string &in asName, string &in asMainEntity, string &in asConnectEntity, int alState)
{
AddDebugMessage("Connect "+asMainEntity+" and "+asConnectEntity+" state:"+alState, false);

if(alState == 1)
{
for(int i=1;i<=4;i++) {
CreateParticleSystemAtEntity(asName+"Fire"+i, "ps_fire_candle.ps", "Valve_"+i+"_AreaBottle", false);

FadeLightTo("Valve_"+i+"_Light", -1, -1, -1, -1, 0.4f, 1);

SetWheelStuckState("Valve_"+i, 0, true);
}

SetLocalVarInt("ValveIgniteFirst", 1);

FadeLightTo("LightBurn", -1, -1, -1, -1, 3.0f, 2);

PlaySoundAtEntity("IgniteSound", "general_fire_burning_low", "Valve_1_AreaBottle", 1, false);

SetWheelStuckState("ValveIgnite", 1, true);
}
else if(alState == -1)
{
for(int i=1;i<=4;i++){
DestroyParticleSystem(asName+"Fire"+i);

FadeLightTo("Valve_"+i+"_Light", -1, -1, -1, -1, 0, 1);

SetWheelStuckState("Valve_"+i, -1, true);
}

FadeLightTo("LightBurn", -1, -1, -1, -1, 0, 2);

StopSound("IgniteSound", 1);
}
}
/*Turning the four valves on/off to try and get the sequence right
*/
void InteractTurnValve(string &in asName, string &in asMainEntity, string &in asConnectEntity, int alState)
{
/*START WHAT HAPPENS WHEN VAVLES ARE TURNED ON
*/
if(alState == 1) {

/*Mark Valve as on
*/
//SetLocalVarInt(asMainEntity, 1);
AddLocalVarInt("ValvesNrOn", 1);

AddDebugMessage("ValvesNrOn: "+GetLocalVarInt("ValvesNrOn")+" And Feet "+GetLocalVarInt("DoBigFeet"), false);

if(GetLocalVarInt("ValvesNrOn") == 0){
SetWheelStuckState("ValveIgnite", -1, true);

PlaySoundAtEntity("FinalBoil","puzzle_boil.snt", "Valve_4_AreaValve", 1, false);

CreateParticleSystemAtEntity("FinalSteam", "ps_acid_machine_bubble_large02.ps", "Valve_4_AreaValve", false);
CreateParticleSystemAtEntity("FinalFlow", "ps_acid_machine_bubble_end.ps", "AreaCompleteSuccess", false);

FadeLightTo("LightBurn", -1, 1, -1, -1, 3.0f, 5);
FadeLightTo("LightAcid", -1, -1, -1, -1, 0.3f, 2);

AddTimer("done", 2, "TimerAcidDone");

} else DoEffectLarge(asName, asConnectEntity);

/*Only an event, nothing puzzle related
*/
if(GetLocalVarInt("ValvesNrOn") == -2 && GetLocalVarInt("DoBigFeet") == 0){
AddTimer("Feet_1", 2.5f, "TimerBigFeet");
PlaySoundAtEntity("bang","general_thunder.snt", "Player", 0, false);
PlaySoundAtEntity("biggus","04_big_feet.snt", "Player", 0, false);
SetLocalVarInt("DoBigFeet", 1);
}

/*If three vavles on, reset the machine
*/
/*if((GetLocalVarInt("Valve_1")+GetLocalVarInt("Valve_2")+GetLocalVarInt("Valve_3")+GetLocalVarInt("Valve_4")) > 2 ) {
for(int i=1;i<=4;i++) SetWheelStuckState("Valve_"+i, -1, true);

AddTimer("release", 0.1f, "TimerReleaseValves");
return;
}*/

/*If the valve turned on is the correct order move ahead, if not hint of wrong order
*/
/*if(asMainEntity == "Valve_1"){
if(GetLocalVarInt("RoadToSuccess") == 0) DoEffectLarge(asName, asConnectEntity);
else DoEffectSmall(asName, asConnectEntity);
}
else if(asMainEntity == "Valve_2"){
if(GetLocalVarInt("RoadToSuccess") == 1) DoEffectLarge(asName, asConnectEntity);
else DoEffectSmall(asName, asConnectEntity);
}
else if(asMainEntity == "Valve_3"){
if(GetLocalVarInt("RoadToSuccess") == 3){
DoEffectLarge(asName, asConnectEntity);

//This has nothing to do with puzzle, it's a pure event in level triggered by how far puzzle completed
if(GetLocalVarInt("DoBigFeet") != 1){ AddTimer("Feet_1", 2.5f, "TimerBigFeet"); PlaySoundAtEntity("bang","general_thunder.snt", "Player", 0, false);
PlaySoundAtEntity("biggus","04_big_feet.snt", "Player", 0, false); SetLocalVarInt("DoBigFeet", 1);
}
}
else DoEffectSmall(asName, asConnectEntity);
}
else if(asMainEntity == "Valve_4"){
if(GetLocalVarInt("RoadToSuccess") == 5) DoEffectLarge(asName, asConnectEntity);
else DoEffectSmall(asName, asConnectEntity);
}*/
}

/*START WHAT HAPPENS WHEN VAVLES ARE TURNED OFF
*/
else if(alState == -1){

/*Mark valve as off
*/
//SetLocalVarInt(asMainEntity, 0);

AddLocalVarInt("ValvesNrOn", -1);

DestroyParticleSystem(asName+"PSteam");
StopSound(asName+"SBoil",1); StopSound(asName+"SSteam",1);

/*If valved turned off in the right order, allow for attempt at turning the next valve in the correct order
*/
/*if(asMainEntity == "Valve_1" && GetLocalVarInt("RoadToSuccess") == 2) AddLocalVarInt("RoadToSuccess", 1);

else if(asMainEntity == "Valve_2" && GetLocalVarInt("RoadToSuccess") == 4) AddLocalVarInt("RoadToSuccess", 1);

else if(asMainEntity == "Valve_3" && GetLocalVarInt("RoadToSuccess") == 6){ //Full sequence correct, spit out the chemical substance
SetWheelStuckState("ValveIgnite", -1, true);

PlaySoundAtEntity("FinalBoil","puzzle_boil.snt", "Valve_4_AreaValve", 1, false);

CreateParticleSystemAtEntity("FinalSteam", "ps_acid_machine_bubble_large02.ps", "Valve_4_AreaValve", false);
CreateParticleSystemAtEntity("FinalFlow", "ps_acid_machine_bubble_end.ps", "AreaCompleteSuccess", false);

FadeLightTo("LightBurn", -1, 1, -1, -1, 3.0f, 5);
FadeLightTo("LightAcid", -1, -1, -1, -1, 0.3f, 2);

AddTimer("done", 2, "TimerAcidDone");
}
else if(asMainEntity == "Valve_4" && GetLocalVarInt("RoadToSuccess") == 6) AddLocalVarInt("RoadToSuccess", -1);*/

/*If all valves are off, reset the machine
*/
/*if((GetLocalVarInt("Valve_1")+GetLocalVarInt("Valve_2")+GetLocalVarInt("Valve_3")+GetLocalVarInt("Valve_4")) == 0 )
SetLocalVarInt("RoadToSuccess", 0);*/
}

AddDebugMessage("Rate of success "+GetLocalVarInt("RoadToSuccess"), false);
AddDebugMessage(asMainEntity+" is turned to "+alState, true);
}
/*Large effects as correct valve rotated
*/
void DoEffectLarge(string &in asName, string &in asWhere)
{
CreateParticleSystemAtEntity(asName+"PSteam", "ps_acid_machine_bubble_large.ps", asWhere, false);

PlaySoundAtEntity(asName+"SBoil","puzzle_boil_low.snt", asWhere, 1, false);
PlaySoundAtEntity(asName+"SSteam","puzzle_gas.snt", asWhere, 1, false);

AddLocalVarInt("RoadToSuccess", 1);
}
/*Small effects as incorrect valve rotated
*/
void DoEffectSmall(string &in asName, string &in asWhere)
{
CreateParticleSystemAtEntity(asName+"PSteam", "ps_acid_machine_bubble_small.ps", asWhere, false);

PlaySoundAtEntity(asName+"SBoil","puzzle_boil_low.snt", asWhere, 1, false);
}
/*When reseting machine on more than 2 valves turned, this timer turns it on again
*/
void TimerReleaseValves(string &in asTimer)
{
for(int i=1;i<=4;i++) SetWheelStuckState("Valve_"+i, 0, false);

SetLocalVarInt("RoadToSuccess", 0);
}
/*The acid spit on success, if no jar present the acid will just spill and it is possible to try again
*/
void TimerAcidDone(string &in asTimer)
{
DestroyParticleSystem("Part4PSteam");
DestroyParticleSystem("FinalSteam");

PlaySoundAtEntity("AcidDone","puzzle_acid", "AreaCompleteSuccess", 0, false);

StopSound("FinalBoil",1);

FadeLightTo("LightAcid", -1, -1, -1, -1, 0, 4);
FadeLightTo("LightBurn", -1, 0.3f, -1, -1, 0, 3);

SetWheelStuckState("ValveIgnite", 0, true);

if(GetLocalVarInt("chemical_container_static_1") == 1){
SetEntityActive("chemical_container_static_1", false);
SetEntityActive("chemical_container_2", true);
//SetPropActiveAndFade("chemical_container_static_1", false, 0.5f);
//SetPropActiveAndFade("chemical_container_2", true, 0.5f);

PlaySoundAtEntity("AcidSuccess","puzzle_acid_success", "AreaCompleteSuccess", 0, false);
PlayMusic("04_puzzle_acid.ogg", false, 0.7f, 0.5f, 10, false);
//GiveSanityBoostSmall();

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

}
else {
PlaySoundAtEntity("AcidFail","puzzle_acid_fail", "AreaCompleteSuccess", 0, false);
SetMessage("Ch03Level26", "NoContainerBelowSqueezer", 0);
}
}
void PickFinalAcid(string &in asEntity, string &in asType)
{
GiveSanityBoostSmall();

SetGlobalVarString(asEntity, asEntity);

AddTimer("Thunder", 0.75f, "TimerEnterClank");
}
void EntityCallPickEmptyChem(string &in asEntity, string &in type)
{
GiveSanityBoostSmall();
}

void EntityCallPickNote(string &in asEntity, string &in type)
{
AddQuest("04FindChemicals","04FindChemicals");
}
void EntityCallPickNote02(string &in asEntity, string &in type)
{
AddQuest("04ChemicalsMoved","04ChemicalsMoved");
}
//END ACID MACHINE//
////////////////////

EDIT : I think I found the problem, it tells me that there's no matching signatures to "BreakMyStairs();" , What should I do?
Delete the code where it calls for BreakMyStairs.
Alright, that worked, but the script doesnt seem to work.. what should I do? there are any tutorial for this?
Alright... nevermind the acid.. I'll try making it later, perhaps I'll ask the wiki to make tutorial for this.

I got new problem, When ever I try making a shelf which moves by lever, then when I go-ingame and press to start the custom map it crashes, maybe I did something wrong?

Spoiler below!
void OnStart()
{
SetEntityConnectionStateChangeCallback("Moveablebook1", "func_shelf");
}


void func_shelf(string &in asEntity, int alState)
{
if (alState == 1)
{
SetMoveObjectState("Secretshelf1",1.0f);
PlaySoundAtEntity("", "quest_completed.snt", "shelf_move_1", 0, false);
return;
}
}

{
AddUseItemCallback("", "Key1", "Door1", "KeyOnDoor", true);
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Door1", false, true);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("Key1");
}

Pages: 1 2