Frictional Games Forum (read-only)
[SOLVED]I screw up amnesia, - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SOLVED]I screw up amnesia, (/thread-29816.html)



[SOLVED]I screw up amnesia, - Casotime1999 - 04-12-2015

I have a little problem with scripts, When i tried to make lever puzzle script it won't work,
script:
void OnStart()
{
for(int i=0; i<=10; i++) SetEntityConnectionStateCollideCallback("lever"+i, "ConnLev", true);
}
void ConnLev(string &in asEntity, int LeverState)
for(int j=0; j<=10; j++){
{
if(GetLeverState("lever"+i) == -1)
{
GivePlayerDamage(500.0f, true);
FadeOut(0);
TeleportPlayer("Players1");
AddTimer("T1", 0.1f "Ending");
}
}
void ending(string &in asTimer)
{
StartCredits("", false, "Ending", "badfinal", -1);
}
Why this won't work I screwed up this game, I can't understand!!! Someone can help me?please don't get be mad


RE: I screw up amnesia, - FlawlessHappiness - 04-12-2015

You say it won't work. How do you know? Do you get an error? Does nothing happen?

What I think you want to do, instead of all those for-loops is this:

PHP Code:
void OnStart()
{
for(
int i=0i<=10i++) SetEntityConnectionStateCollideCallback("lever"+i"ConnLev"true);
}

void ConnLev(string &in asEntityint LeverState)
{
if(
LeverState == -1)
{
GivePlayerDamage(500.0ftrue);
FadeOut(0);
TeleportPlayer("Players1");
Ending();
}
}

void Ending()
{
StartCredits(""false"Ending""badfinal", -1);




RE: I screw up amnesia, - Casotime1999 - 04-15-2015

it doesn't happen when i set the lever1 for example to 0 it fade in but if i set it to 1 or -1 it won't work. I'm so blind. And i tried this method:
void Puzzle(string &in asEntity, int LeverState)
{
if(GetLeverState("leva1") ==0
&& GetLeverState("leva2") == 1)SetPropHealth("door", 0);


}
and it doesn't do anything, i followed some tutorials, it still not working


RE: I screw up amnesia, - Romulator - 04-15-2015

What exactly are you trying to do with your script?


RE: I screw up amnesia, - FlawlessHappiness - 04-15-2015

(04-15-2015, 10:07 AM)Casotime1999 Wrote: it doesn't happen when i set the lever1 for example to 0 it fade in but if i set it to 1 or -1 it won't work. I'm so blind. And i tried this method:
void Puzzle(string &in asEntity, int LeverState)
{
if(GetLeverState("leva1") ==0
&& GetLeverState("leva2") == 1)SetPropHealth("door", 0);


}
and it doesn't do anything, i followed some tutorials, it still not working

I think that's because 0 is a very hard state to use. 0 is, if it hasn't been set to anything. And I think that only triggers if it hasn't been set ever, in that level. So if you made it 1, and then moved it back to the middle it'd still be 1.

Either use 1 or -1


(04-15-2015, 11:30 AM)(拉赫兰) Romulator Wrote: What exactly are you trying to do with your script?

If I understood it correctly, he wants to, when he moves a lever, to check if 2 levers are in specific places. If they are, do something.


RE: I screw up amnesia, - Romulator - 04-15-2015

I know something wants to happen when the levers are in place, but if we knowexactly what is wanted - and how to do so in script, then we can assist somewhat further in the way the loop(s) required is to be constructed.

It also just helps in organising what script functions can be used, how many levers, etc.

You can never have too much information :3


RE: I screw up amnesia, - FlawlessHappiness - 04-15-2015

He wants this to happen:
GivePlayerDamage(500.0f, true);
FadeOut(0);
TeleportPlayer("Players1");
AddTimer("T1", 0.1f "Ending");

From what I understand, there are 2 levers.
The callback calls when any lever is put into a state.
If both levers are in the correct state, the above happens.


RE: I screw up amnesia, - Casotime1999 - 04-15-2015

I've found another method, I made a area script, and i matched the lever with AddEntityCollideCallback function inside the function I put the SetLeverStuckState, I found the error, when i pulled the lever i forgot to stuck the lever at LeverState and the game checked if all 2 lever = 1(at bottom) i'll blow up the door, and disable the area, and the final dialogue is starting. Consider this post SOLVED.


RE: I screw up amnesia, - FlawlessHappiness - 04-15-2015

(04-15-2015, 09:59 PM)Casotime1999 Wrote: Consider this post SOLVED.

If you want to, you can edit the title in your main post so that it says [SOLVED]