I've got one last script to complete until my custom story is finished. However I cannot get it to work. This is how I intended it to be.
1. Pull a lever (collide script) and you will get AddLocalVarInt
2. Then I've made a script that checks if the player has this localvarint, which he now got.
3. Now, a timer SHOULD start and play a sound + shake the entire room.
Now the last thing does not happen. I would think I'm not supposed to use AddLocalVarInt. But what am I supposed to use instead? Script down below incase you need it. I'm very sorry if I might confuse you with my english, but I cannot help it
//Western piston
void ActivateWestPiston(string &in asParent, string &in asChild, int alState)
{
SetMoveObjectState("barrier_piston_1", -0.3);
PlaySoundAtEntity("", "17_piston_move", "barrier_piston_1", 1.0f, false);
SetEntityInteractionDisabled("button_simple_4", true);
AddLocalVarInt("EastPiston", 1);
}
//Eastern piston
void ActivateEastPiston(string &in asParent, string &in asChild, int alState)
{
SetMoveObjectState("barrier_piston_2", -0.3);
PlaySoundAtEntity("", "17_piston_move", "barrier_piston_2", 1.0f, false);
SetEntityInteractionDisabled("button_simple_3", true);
AddLocalVarInt("WestPiston", 1);
}
//Pour down the potion in the machine
void PotionOnMachine(string &in asItem, string &in asEntity)
{
GiveSanityBoostSmall();
SetMessage("Messages", "PotionPouredDown", 0);
RemoveItem(asItem);
GiveItemFromFile("glass_container_1", "glass_container.ent");
AddLocalVarInt("PotionPoured", 1);
//The pistons are pulled and the potion has been poured in the machine
if(GetLocalVarInt("WestPiston")==1)
{
AddTimer("explosion", 3.0f, "TimerMachineTheme");
AddTimer("quests", 9.0f, "TimerMachineTheme");
SetEntityActive("ScriptArea_1", false);
SetEntityActive("AreaGetPotionBack", false);
}
}
//The timer for the machine
void TimerMachineTheme(string &in asTimer)
{
if(asTimer == "explosion"){
PlaySoundAtEntity("implodoelexplodo", "27_orb_implode.snt", "Player", 0.0f, false);
StartScreenShake(0.2f, 6, 0.5f, 3);
}
if(asTimer == "quests"){
//Complete all quests that has anything to do with this
CompleteQuest("MagicPotionFail", "MagicPotionFail");
CompleteQuest("PotionPourDownManual", "PotionPourDownManual");
CompleteQuest("BrokenButtonsDownstairs", "BrokenButtonsDownstairs");
GiveSanityBoostSmall();
PlayMusic("13_puzzle_machine.ogg", false, 1.0f, 0.5f, 10, false);
SetGlobalVarInt("BarrierMachineFixed", 1);
}
}