Casotime1999
Junior Member
Posts: 23
Threads: 6
Joined: Mar 2015
Reputation:
0
|
[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 |
|
FlawlessHappiness
Posting Freak
Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation:
171
|
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:
void OnStart() { for(int i=0; i<=10; i++) SetEntityConnectionStateCollideCallback("lever"+i, "ConnLev", true); }
void ConnLev(string &in asEntity, int LeverState) { if(LeverState == -1) { GivePlayerDamage(500.0f, true); FadeOut(0); TeleportPlayer("Players1"); Ending(); } }
void Ending() { StartCredits("", false, "Ending", "badfinal", -1); }
Trying is the first step to success.
|
|
04-12-2015, 08:32 PM |
|
Casotime1999
Junior Member
Posts: 23
Threads: 6
Joined: Mar 2015
Reputation:
0
|
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 |
|
Romulator
Not Tech Support ;-)
Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation:
195
|
RE: I screw up amnesia,
What exactly are you trying to do with your script?
Discord: Romulator#0001
|
|
04-15-2015, 11:30 AM |
|
FlawlessHappiness
Posting Freak
Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation:
171
|
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.
|
|
04-15-2015, 12:31 PM |
|
Romulator
Not Tech Support ;-)
Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation:
195
|
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
(This post was last modified: 04-15-2015, 01:13 PM by Romulator.)
|
|
04-15-2015, 01:11 PM |
|
FlawlessHappiness
Posting Freak
Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation:
171
|
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 |
|
Casotime1999
Junior Member
Posts: 23
Threads: 6
Joined: Mar 2015
Reputation:
0
|
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 |
|
FlawlessHappiness
Posting Freak
Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation:
171
|
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 |
|
|