Dizturbed
Member
Posts: 160
Threads: 39
Joined: Jun 2011
Reputation:
0
|
Script Help
As you may know, I started scripting and making stories again, but lost a lot of funk the past year.
So I would like to know how to basically wake up / fadein and stand up slowly.
If you could help me with this I would be much obliged.
|
|
07-30-2012, 09:00 PM |
|
Lizard
Member
Posts: 174
Threads: 23
Joined: Jul 2012
Reputation:
5
|
RE: Script Help
Since you have done this before, i guess that i can just post this example, in belive, that you will work out from it
void OnStart();
{
SetPlayerActive(false);
FadeOut(0);
FadePlayerRollTo(65, 20, 20);
MovePlayerHeadPos(-1, -0.45, -1.1, 20, 1);
AddTimer("activate_player", 3, "FadeIn");
SetLightVisible("BoxLight_1", false);
FadeImageTrailTo(3, 1);
FadeRadialBlurTo(0.4, 1);
}
void FadeIn(string &in timer_name)
{
FadeIn(2);
AddTimer("Start", 2, "WakeUp");
}
void WakeUp(string &in timer_name)
{
if (timer_name == "Start")
{
SetLightVisible("BoxLight_1", true);
AddTimer("MoveHead", 1, "WakeUp");
}
else if (timer_name == "MoveHead")
{
FadeImageTrailTo(0, 1);
FadeRadialBlurTo(0, 1);
MovePlayerHeadPos(-0.5, -0.2, -1.1, 2, 2);
FadePlayerRollTo(0, 1.7, 500);
AddTimer("ActivatePlayer", 2, "WakeUp");
}
else if (timer_name == "ActivatePlayer")
{
MovePlayerHeadPos(0, 0, 0, 2, 2);
SetPlayerActive(true);
}
}
PS. This example runs with two PlayerStartPositions
CURRENT PROJECT:
A Fathers Secret == Just started
(This post was last modified: 07-30-2012, 10:19 PM by Lizard.)
|
|
07-30-2012, 10:17 PM |
|
Dizturbed
Member
Posts: 160
Threads: 39
Joined: Jun 2011
Reputation:
0
|
RE: Script Help
(07-30-2012, 10:17 PM)ZereboO Wrote: Since you have done this before, i guess that i can just post this example, in belive, that you will work out from it
void OnStart();
{
SetPlayerActive(false);
FadeOut(0);
FadePlayerRollTo(65, 20, 20);
MovePlayerHeadPos(-1, -0.45, -1.1, 20, 1);
AddTimer("activate_player", 3, "FadeIn");
SetLightVisible("BoxLight_1", false);
FadeImageTrailTo(3, 1);
FadeRadialBlurTo(0.4, 1);
}
void FadeIn(string &in timer_name)
{
FadeIn(2);
AddTimer("Start", 2, "WakeUp");
}
void WakeUp(string &in timer_name)
{
if (timer_name == "Start")
{
SetLightVisible("BoxLight_1", true);
AddTimer("MoveHead", 1, "WakeUp");
}
else if (timer_name == "MoveHead")
{
FadeImageTrailTo(0, 1);
FadeRadialBlurTo(0, 1);
MovePlayerHeadPos(-0.5, -0.2, -1.1, 2, 2);
FadePlayerRollTo(0, 1.7, 500);
AddTimer("ActivatePlayer", 2, "WakeUp");
}
else if (timer_name == "ActivatePlayer")
{
MovePlayerHeadPos(0, 0, 0, 2, 2);
SetPlayerActive(true);
}
}
PS. This example runs with two PlayerStartPositions Yes, but where am I supposed to put this script?
This is my script as it is
void OnStart(){SetEntityPlayerInteractCallback("TouchArea_1", "Grunt_Gone", true);AddEntityCollideCallback("Player", "Door_Close", "CloseDoor", true, 1);AddEntityCollideCallback("Player", "Walk", "WalkArea", true, 1);AddEntityCollideCallback("Player", "ScriptArea_1", "bedtime", true, 1);SetPlayerActive(false);FadeOut(0);FadePlayerRollTo(65, 20, 20);MovePlayerHeadPos(-1, -0.45, -1.1, 20, 1);AddTimer("activate_player", 3, "FadeIn");FadeImageTrailTo(3, 1);FadeRadialBlurTo(0.4, 1);} void WalkArea(string &in asParent, string &in asChild, int alState){MovePlayerForward(50.0f);AddTimer("walktime", 0.1f, "timerdone");PlaySoundAtEntity("", "react_sigh.snt", "Player", 0, false);SetPlayerActive(false);} void timerdone(string &in asTimer){AddTimer("restarter", 0, "atwalkto");} void CloseDoor(string &in asParent, string &in asChild, int alState){SetSwingDoorClosed("mansion_1", true, true);} void bedtime(string &in asParent, string &in asChild, int alState){FadeOut(1.2f);StartPlayerLookAt("bed_nice_1", 1.0f, 1.0f, "");AddTimer("WakeUp", 5.0f, "itstime");} void itstime(string &in asTimer){RemoveTimer("WakeUp");TeleportPlayer("PlayerStartArea_2");StopPlayerLookAt();}void FadeIn(string &in timer_name){FadeIn(2);AddTimer("Start", 2, "WakeUp"); } void WakeUp(string &in timer_name){if (timer_name == "Start"){SetLightVisible("BoxLight_1", true);AddTimer("MoveHead", 1, "WakeUp");} else if (timer_name == "MoveHead"){FadeImageTrailTo(0, 1);FadeRadialBlurTo(0, 1);MovePlayerHeadPos(-0.5, -0.2, -1.1, 2, 2);FadePlayerRollTo(0, 1.7, 500);AddTimer("ActivatePlayer", 2, "WakeUp");} else if (timer_name == "ActivatePlayer"){MovePlayerHeadPos(0, 0, 0, 2, 2);SetPlayerActive(true);}}
I want the player to be moved to the bed and when you get close to it you fall asleep and wake up in that state, how am I supposed to set it up then?
Please respond
void OnStart()
{
SetEntityPlayerInteractCallback("TouchArea_1", "Grunt_Gone", true);
AddEntityCollideCallback("Player", "Door_Close", "CloseDoor", true, 1);
AddEntityCollideCallback("Player", "Walk", "WalkArea", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_1", "bedtime", true, 1);
SetPlayerActive(false);
FadeOut(0);
FadePlayerRollTo(65, 20, 20);
MovePlayerHeadPos(-1, -0.45, -1.1, 20, 1);
AddTimer("activate_player", 3, "FadeIn");
FadeImageTrailTo(3, 1);
FadeRadialBlurTo(0.4, 1);
}
void WalkArea(string &in asParent, string &in asChild, int alState)
{
MovePlayerForward(50.0f);
AddTimer("walktime", 0.1f, "timerdone");
PlaySoundAtEntity("", "react_sigh.snt", "Player", 0, false);
SetPlayerActive(false);
}
void timerdone(string &in asTimer)
{
AddTimer("restarter", 0, "atwalkto");
}
void CloseDoor(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansion_1", true, true);
}
void bedtime(string &in asParent, string &in asChild, int alState)
{
FadeOut(1.2f);
StartPlayerLookAt("bed_nice_1", 1.0f, 1.0f, "");
AddTimer("WakeUp", 5.0f, "itstime");
}
void itstime(string &in asTimer)
{
RemoveTimer("WakeUp");
TeleportPlayer("PlayerStartArea_2");
StopPlayerLookAt();
}
void FadeIn(string &in timer_name)
{
FadeIn(2);
AddTimer("Start", 2, "WakeUp");
}
void WakeUp(string &in timer_name)
{
if (timer_name == "Start")
{
SetLightVisible("BoxLight_1", true);
AddTimer("MoveHead", 1, "WakeUp");
}
else if (timer_name == "MoveHead")
{
FadeImageTrailTo(0, 1);
FadeRadialBlurTo(0, 1);
MovePlayerHeadPos(-0.5, -0.2, -1.1, 2, 2);
FadePlayerRollTo(0, 1.7, 500);
AddTimer("ActivatePlayer", 2, "WakeUp");
}
else if (timer_name == "ActivatePlayer")
{
MovePlayerHeadPos(0, 0, 0, 2, 2);
SetPlayerActive(true);
}
}
(This post was last modified: 07-31-2012, 12:52 PM by Dizturbed.)
|
|
07-31-2012, 12:52 PM |
|
Lizard
Member
Posts: 174
Threads: 23
Joined: Jul 2012
Reputation:
5
|
RE: Script Help
Just to make sure. Your looking for a script were you walk up to the bed, and falls asleep and then wakes up again?
CURRENT PROJECT:
A Fathers Secret == Just started
|
|
07-31-2012, 01:05 PM |
|
Dizturbed
Member
Posts: 160
Threads: 39
Joined: Jun 2011
Reputation:
0
|
RE: Script Help
(07-31-2012, 01:05 PM)ZereboO Wrote: Just to make sure. Your looking for a script were you walk up to the bed, and falls asleep and then wakes up again? Yes, where I wake up after a few seconds..
And then wake up on F.Ex. PlayerStartArea_2
I can do the rest I think...
Sorry for this, it's been a long time since the last time.
And I didn't even know how to use "else if" and "for" loops..
(This post was last modified: 07-31-2012, 01:09 PM by Dizturbed.)
|
|
07-31-2012, 01:08 PM |
|
Lizard
Member
Posts: 174
Threads: 23
Joined: Jul 2012
Reputation:
5
|
RE: Script Help
It took some time, but this script makes it look like when you go near the bed and collide with an area, the player will fall as sleep and wakes up again several second later.
I now have 3 PlayerStartPositions.
And a area close to the bed, to call all the action.
PlayerStaartPosition_3 as you can be set a random place, so that the player dosen't spawn in the bed, and then make him go to area besides the bed.
In OnStart(); you put this
AddEntityCollideCallback("Player", "SleepArea", "Sleeping", true,1);
And timers will take care of the rest.
The final sricpt looks like this:
void OnStart();
{
AddEntityCollideCallback("Player", "SleepArea", "Sleeping", true,1);
}
void Sleeping(string &in asParent, string &in asChild, int alState)
{
FadePlayerFOVMulTo(1.5, 1);
FadeOut(2);
SetPlayerActive(false);
AddTimer("sleep", 4, "MoveToBed");
SetLightVisible("BoxLight_1", false);
}
void MoveToBed(string &in timer_name)
{
TeleportPlayer("PlayerStartArea_1");
FadePlayerRollTo(65, 20, 20);
MovePlayerHeadPos(-1, -0.45, -1.1, 20, 1);
FadeImageTrailTo(3, 1);
FadeRadialBlurTo(0.4, 1);
AddTimer("sleep2", 2, "teleport");
}
void teleport(string &in timer_name)
{
AddTimer("wakingup", 2, "FadeIn");
}
void FadeIn(string &in timer_name)
{
FadeIn(2);
AddTimer("Start", 2, "WakeUp");
}
void WakeUp(string &in timer_name)
{
if (timer_name == "Start")
{
TeleportPlayer("PlayerStartArea_1");
SetLightVisible("BoxLight_1", true);
AddTimer("MoveHead", 1, "WakeUp");
}
else if (timer_name == "MoveHead")
{
FadeImageTrailTo(0, 1);
FadeRadialBlurTo(0, 1);
MovePlayerHeadPos(-0.5, -0.2, -1.1, 2, 2);
FadePlayerRollTo(0, 1.7, 500);
AddTimer("ActivatePlayer", 2, "WakeUp");
}
else if (timer_name == "ActivatePlayer")
{
MovePlayerHeadPos(0, 0, 0, 2, 2);
SetPlayerActive(true);
}
}
CURRENT PROJECT:
A Fathers Secret == Just started
|
|
07-31-2012, 01:38 PM |
|
Dizturbed
Member
Posts: 160
Threads: 39
Joined: Jun 2011
Reputation:
0
|
RE: Script Help
So do you want me to add the teleport script myself or is it already in therE?
Can't see it.
But thanks!
FOUNDIT
(This post was last modified: 07-31-2012, 01:44 PM by Dizturbed.)
|
|
07-31-2012, 01:43 PM |
|
Lizard
Member
Posts: 174
Threads: 23
Joined: Jul 2012
Reputation:
5
|
RE: Script Help
its already there
tested it myself, before i posted it
The teleport happens in the WakeUp timer
CURRENT PROJECT:
A Fathers Secret == Just started
(This post was last modified: 07-31-2012, 01:46 PM by Lizard.)
|
|
07-31-2012, 01:44 PM |
|
Dizturbed
Member
Posts: 160
Threads: 39
Joined: Jun 2011
Reputation:
0
|
RE: Script Help
But now I can put my head through walls and stuff..
nvm fixed it.
(This post was last modified: 07-31-2012, 02:25 PM by Dizturbed.)
|
|
07-31-2012, 02:20 PM |
|
|