Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 2 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Making An Acid
clock123 Offline
Member

Posts: 76
Threads: 18
Joined: Jul 2011
Reputation: 0
#7
RE: Making An Acid

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?
(This post was last modified: 07-26-2011, 08:08 AM by clock123.)
07-26-2011, 07:55 AM
Find


Messages In This Thread
Making An Acid - by clock123 - 07-25-2011, 08:04 PM
RE: Making An Acid - by Kyle - 07-25-2011, 09:00 PM
RE: Making An Acid - by JoeBradleyUK - 07-25-2011, 09:16 PM
RE: Making An Acid - by Kyle - 07-25-2011, 09:17 PM
RE: Making An Acid - by clock123 - 07-25-2011, 09:08 PM
RE: Making An Acid - by Kyle - 07-25-2011, 09:14 PM
RE: Making An Acid - by clock123 - 07-26-2011, 07:55 AM
RE: Making An Acid - by Tanshaydar - 07-26-2011, 08:35 AM
RE: Making An Acid - by clock123 - 07-26-2011, 11:29 AM
RE: Making An Acid - by clock123 - 07-26-2011, 12:33 PM
RE: Making An Acid - by Khyrpa - 07-26-2011, 12:48 PM



Users browsing this thread: 1 Guest(s)