Theforgot3n1
Member
Posts: 192
Threads: 20
Joined: Apr 2012
Reputation:
6
|
RE: Levers in Order
(08-13-2012, 07:39 PM)TheIcyPickle Wrote: huh, i tried your script, a few errors, easy to fix btw but, it seems that the levers do not stick up when you pull one of the wrong levers first, it does not stay up. Which in turn removes the "puzzle" aspect.
haha I think its something to do with your script. Ill check it as well.
void GiveSanityDamage(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "react_pant.snt", "Player", 0, false);
PlaySoundAtEntity("", "enemy_hallucination_disappear.snt", "Player", 0, false);
GiveSanityDamage(10, false);
SetMessage("Messages", "holyfuckingshit", 4.0f);
}
void SetSwingDoorLocked(string &in asEntity, int alState)
{
if(GetLocalVarInt("Sequence") == 0 && asEntity == "lever_simple01_2")
{
AddLocalVarInt("Sequence", 1);
SetLeverStuckState(asEntity, alState, true);
}
if(GetLocalVarInt("Sequence") == 1 && asEntity == "lever_simple01_3")
{
AddLocalVarInt("Sequence", 1);
SetLeverStuckState(asEntity, alState, true);
}
if(GetLocalVarInt("Sequence") == 2 && asEntity == "lever_simple01_1")
{
AddLocalVarInt("Sequence", 1);
SetLeverStuckState(asEntity, alState, true);
SetSwingDoorLocked("hatch_metal01_1", false, true);
PlayMusic("03_puzzle_secret.ogg", false, 0.3, 0.1, 10, false);
PlaySoundAtEntity("", "unlock_door", "Player", 0, false);
FadeLightTo("SpotLight_8", 0, 0, 0, 0, -1, 0.5f);
FadeLightTo("SpotLight_4", 0.4f, 0.5f, 0.9f, -1, -1, 0.5f);
GiveSanityBoost();
}
if(GetLeverState(asEntity) == 1)
//If it does not get stuck due to success, it means it failed, so make it stuck as failed.
{
AddLocalVarInt("Fail", 1);
SetLeverStuckState(asEntity, alState, true);
if((GetLeverState("lever_simple01_3") == alState) && (GetLeverState("lever_simple01_2") == alState) && (GetLeverState("lever_simple01_1") == alState))
//If the last possible stuck one was due to a fail, then reset all and play a "machine fail" sound.
/*This little "if" is only possible thanks to the fact that you can't have a success at the last lever without success at all of them. So if you intend to make the lever pulls rely only on themselves, then redo this "if". (Ignore this part if you like it the way it is)*/
{
PlaySoundAtEntity("", "13_machine_fail.snt","Player",0.1f, false);
SetLeverStuckState("lever_simple01_3", 0, false);
SetLeverStuckState("lever_simple01_2", 0, false);
SetLeverStuckState("lever_simple01_1", 0, false);
SetLocalVarInt("Sequence",0);
SetLocalVarInt("Fail",0);
/*Note that in this script, the Variable "Fail" is entirely useless. I just wanted to put it there for you to use if you want to, for like having different sounds depending on how many fails there were.*/
}
}
}
is how I did it. Change a few things from true to false, 0 to 1. And so on. It works now. Haha nice work guys! However if you think it could be better, do tell!
Also. if you can, one more thing, this is sort off off the topic, but, I have a door that is supposed to fly open. It does, but its either too slow, or too fast that is closes shut again. Anyway how to make a door fly open quickly and keep it there? Glad that I could help.
Hm, try to find the perfect float number. Otherwise, I suppose it could be something with the positioning of the door.
(This post was last modified: 08-13-2012, 08:22 PM by Theforgot3n1.)
|
|