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
SetPlayerActive(false) Help!
MaZiCUT Offline
Senior Member

Posts: 536
Threads: 31
Joined: Jun 2012
Reputation: 17
#1
SetPlayerActive(false) Help!

void OnStart()
{
wakeUp();
AddEntityCollideCallback("Player", "KillTheLights", "LightsOut", true, 1);
AddEntityCollideCallback("Player", "KillTheLights", "Freeze", true, 1);
}

void Freeze(string &in asParent, string &in asChild, int alState)
{
SetPlayerActive(false);
AddTimer("", 10, "");
SetPlayerActive(true);
}


Hello i'm having troubble with something. This is what happends:
I go to the custom story, launch.. it's dark i wake up then i go forwards and collide with an area that kills the lights, but i want that area to also freeze the player aka SetPlayerActive(false); and then you have to wait a specific time, 10 seconds in my case, so can you please help? Smile


I'm new here so if this is in the wrong section please tell me.

Ignore the red!



I fixed it with help from [b]P44RTHURN4X and with his script i just made a new area for the freeze and it worked.[/b]
(This post was last modified: 06-08-2012, 05:02 PM by MaZiCUT.)
06-08-2012, 04:29 PM
Website Find
P44RTHURN4X Offline
Junior Member

Posts: 35
Threads: 16
Joined: Apr 2012
Reputation: 0
#2
RE: SetPlayerActive(false) Help!

Hmm, that's weird...

Why does you have no names in your timer? for example:

SetPlayerActive(false);
AddTimer("game_timer", 10.0f, "freeze_end");
SetPlayerActive(true);

1. You have to put 10.0f not 10 in the timer
2. you have to continue the timer, for example:

void Freeze(string &in asParent, string &in asChild, int alState)

{

SetPlayerActive(false);

AddTimer("game_timer", 10.0f, "freeze_end");

}

void freeze_end(string &in asTimer)
{
SetPlayerActive(true);
}

Try this and then tell me what happens then...



GReeZe' P44
06-08-2012, 04:45 PM
Find
MaZiCUT Offline
Senior Member

Posts: 536
Threads: 31
Joined: Jun 2012
Reputation: 17
#3
RE: SetPlayerActive(false) Help!

(06-08-2012, 04:45 PM)P44RTHURN4X Wrote: Hmm, that's weird...

Why does you have no names in your timer? for example:

SetPlayerActive(false);
AddTimer("game_timer", 10.0f, "freeze_end");
SetPlayerActive(true);

1. You have to put 10.0f not 10 in the timer
2. you have to continue the timer, for example:

void Freeze(string &in asParent, string &in asChild, int alState)

{

SetPlayerActive(false);

AddTimer("game_timer", 10.0f, "freeze_end");

}

void freeze_end(string &in asTimer)
{
SetPlayerActive(true);
}

Try this and then tell me what happens then...



GReeZe' P44
The player still is able to walk normally right through and nothing happends Sad

i can post the full script:


void OnStart()
{
wakeUp();
AddEntityCollideCallback("Player", "KillTheLights", "LightsOut", true, 1);
AddEntityCollideCallback("Player", "KillTheLights", "Freeze", true, 1);
}


void Freeze(string &in asParent, string &in asChild, int alState)


{
SetPlayerActive(false);
AddTimer("game_timer", 10.0f, "freeze_end");
}


void freeze_end(string &in asTimer)
{
SetPlayerActive(true);
}


void wakeUp()
{
FadeOut(0);
FadeIn(30);
FadeImageTrailTo(2, 2);
FadeSepiaColorTo(100, 4);
SetPlayerActive(false);
FadePlayerRollTo(90, 15, 180);
FadeRadialBlurTo(0.15, 2);
SetPlayerCrouching(true);
AddTimer("trig1", 11.0f, "beginStory");
}


void beginStory(string &in asTimer){
ChangePlayerStateToNormal();
SetPlayerActive(true);
FadePlayerRollTo(0, 33, 33);
FadeRadialBlurTo(0.0, 1);
FadeSepiaColorTo(0, 4);
SetPlayerCrouching(false);
FadeImageTrailTo(0,1);
}




void LightsOut(string &in asParent, string &in asChild, int alState)
{
SetLampLit("lamp_1", false, true);
AddTimer("", 2, "Out2");
}


void Out2(string &in asTimer)
{
SetLampLit("lamp_2", false, true);
AddTimer("", 2, "Out3");
}


void Out3(string &in asTimer)
{
SetLampLit("lamp_3", false, true);
AddTimer("", 2, "Out4");
}


void Out4(string &in asTimer)
{
SetLampLit("lamp_4", false, true);
AddTimer("", 2, "Out5");
}


void Out5(string &in asTimer)
{
SetLampLit("lamp_5", false, true);
AddTimer("", 2, "Out6");
}


void Out6(string &in asTimer)
{
SetLampLit("lamp_6", false, true);
}


void OnEnter()
{


}


void OnLeave()
{


}
06-08-2012, 04:56 PM
Website Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#4
RE: SetPlayerActive(false) Help!

(06-08-2012, 04:45 PM)P44RTHURN4X Wrote: Hmm, that's weird...

Why does you have no names in your timer? for example:

SetPlayerActive(false);
AddTimer("game_timer", 10.0f, "freeze_end");
SetPlayerActive(true);

1. You have to put 10.0f not 10 in the timer
2. you have to continue the timer, for example:

void Freeze(string &in asParent, string &in asChild, int alState)

{

SetPlayerActive(false);

AddTimer("game_timer", 10.0f, "freeze_end");

}

void freeze_end(string &in asTimer)
{
SetPlayerActive(true);
}

Try this and then tell me what happens then...



GReeZe' P44
1. He doesn't need to write 10.0f he can just write 10 the f is only used when you use the like 0.342f or 1.53f if it's a number that doesn't have decimals it's not needed to have a f

the first part of a timer, the one you call game_timer is only necessary if you need to stop the timer with RemoveTimer(""); if you don't need to remove the timer the name of the timer is not necessary. But it need to call a function for example freeze_end

06-08-2012, 07:25 PM
Find
P44RTHURN4X Offline
Junior Member

Posts: 35
Threads: 16
Joined: Apr 2012
Reputation: 0
#5
RE: SetPlayerActive(false) Help!

No, he have to type 10.0f, cause the "f" is important, otherwise the cpu cant read the time and the timer start automatically in 1 second after other scripts! And the names, you said it's just for Remove... it's not! These are the internal names which you need in every script in .hps files! .hps are just working with void, bool and float and this 3 kind of scripting are just working with your own internal names. the other name, for the callback, can be all things like "1" or "a". But if you do other callback funcs you need another cbname like "12" or "ab" or only "2" or "b".

It's working better with notepad++ - there are important numbers/letters and words in colors.



GReeZe' P44
06-09-2012, 12:43 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#6
RE: SetPlayerActive(false) Help!

(06-09-2012, 12:43 PM)P44RTHURN4X Wrote: No, he have to type 10.0f, cause the "f" is important, otherwise the cpu cant read the time and the timer start automatically in 1 second after other scripts! And the names, you said it's just for Remove... it's not! These are the internal names which you need in every script in .hps files! .hps are just working with void, bool and float and this 3 kind of scripting are just working with your own internal names. the other name, for the callback, can be all things like "1" or "a". But if you do other callback funcs you need another cbname like "12" or "ab" or only "2" or "b".

Doubles can be safely converted to floats if the double does not surpass 32-bit. Ints can likewise be safely converted to floats or doubles. The only reason why you would need to put an f at the end of the decimal value for float arguments is if you're overly concerned about performance or syntax.

As for timer names, they are not required; an empty string will do, unless you plan on using the timer names--which is good practice to use them, lest you create hundreds of timer callbacks.

Tutorials: From Noob to Pro
06-09-2012, 10:06 PM
Website Find




Users browsing this thread: 1 Guest(s)