First off you can remove those Once, Twice, Thrice scripts and use a single one with parameters to shorten the code.
void RodMeOnce(string &in asItem, string &in asEntity)
{
SetEntityActive(asEntity + "_stat", true);
PlaySoundAtEntity("", "13_rod_in.snt", "rods", 0, false);
RemoveItem(asEntity);
AddLocalVarInt("Rods", 1);
if(GetLocalVarInt("Rods") == 3)
{
PlaySoundAtEntity("", "13_machine_extra.snt", "machine_sound", 0, false);
PlaySoundAtEntity("", "13_machine_run.snt", "machine_sound", 0, false);
}
}
Do the sounds play though? I think the script stops right there. There are only those three callbacks when you enter, and those three code blocks (which could be only one) don't seem to advance the script to the other ones. Unless you have callbacks added to entities in the level? I'm guessing you do at least for the levers. I can't really check the level at the moment though.
This script might not do what you want it to. Let's just see what will happen if done.
void LeverBox(string &in asEntity, int LeverState)
{
if(GetLeverState("lever_machine_lever_1") == -1
&& GetLeverState("lever_machine_lever_2") == -1
&& GetLeverState("lever_machine_lever_3") == -1
&& GetLeverState("lever_machine_lever_4") == -1
&& GetLeverState("lever_machine_lever_5") == -1
&& GetLeverState("lever_machine_lever_6") == -1)
{
PlaySoundAtEntity("", "sob01.snt", "Player", 0, false);
SetEntityActive("elevator_lever_1", false);
SetEntityActive("elevator_lever_2", true);
for(int i = 1; i <= 6; i++)
SetEntityInteractionDisabled("lever_machine_lever_"+i, true);
}
if(GetLeverState("elevator_lever_2") == -1)
{
SetEntityPlayerInteractCallback("elevator_lever_2", "Activate", true);
}
}
Is this callback added to all the lever_machine_lever entities? Anything else?
Pulling all lever_machine_lever to state -1 will activate the main code, which plays some sounds and changes the elevator_lever entity. To prevent this some happening again, interaction is disabled for these levers. The last part will only activate if elevator_lever_2 is already set to state -1
before the other levers are set, or else they will remain uninteractable and can not call the code. Because elevator_lever_2 is enabled after pulling the other levers, this can cause it to not be finished, unless this callback is also added to the elevator_lever_2, however if so, it will also run the main code again once pulled, because even though the other levers are uninteractable, they're still in state -1 which will pass the code.