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


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED]I screw up amnesia,
Casotime1999 Offline
Junior Member

Posts: 23
Threads: 6
Joined: Mar 2015
Reputation: 0
#1
Heart  [SOLVED]I screw up amnesia,

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
(This post was last modified: 04-16-2015, 08:11 AM by Casotime1999.)
04-12-2015, 08:28 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#2
RE: I screw up amnesia,

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: (Select All)
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);


Trying is the first step to success.
(This post was last modified: 04-12-2015, 08:34 PM by FlawlessHappiness.)
04-12-2015, 08:32 PM
Find
Casotime1999 Offline
Junior Member

Posts: 23
Threads: 6
Joined: Mar 2015
Reputation: 0
#3
RE: I screw up amnesia,

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
(This post was last modified: 04-15-2015, 10:09 AM by Casotime1999.)
04-15-2015, 10:07 AM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#4
RE: I screw up amnesia,

What exactly are you trying to do with your script?

Discord: Romulator#0001
[Image: 3f6f01a904.png]
04-15-2015, 11:30 AM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#5
RE: I screw up amnesia,

(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.

Trying is the first step to success.
(This post was last modified: 04-15-2015, 12:32 PM by FlawlessHappiness.)
04-15-2015, 12:31 PM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#6
RE: I screw up amnesia,

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

Discord: Romulator#0001
[Image: 3f6f01a904.png]
(This post was last modified: 04-15-2015, 01:13 PM by Romulator.)
04-15-2015, 01:11 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#7
RE: I screw up amnesia,

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.

Trying is the first step to success.
04-15-2015, 01:32 PM
Find
Casotime1999 Offline
Junior Member

Posts: 23
Threads: 6
Joined: Mar 2015
Reputation: 0
#8
RE: I screw up amnesia,

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.
04-15-2015, 09:59 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#9
RE: I screw up amnesia,

(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]

Trying is the first step to success.
04-15-2015, 11:06 PM
Find




Users browsing this thread: 4 Guest(s)