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
Script Help Wake up script
Saren Offline
Member

Posts: 196
Threads: 20
Joined: Jan 2012
Reputation: 1
#11
RE: Wake up script

(04-30-2012, 05:26 PM)JetlinerX Wrote: No capital V on "Void"

Its only void.
I know, I fixed that
New script looks like this:

void wakeUp () {
FadeOut(0);
FadeIn(20);
FadeImageTrailTo(2, 2);
FadeSepiaColorTo(100, 4);
SetPlayerActive(false);
FadePlayerRollTo(65, 20, 20);
FadeRadialBlurTo(0.15, 2);
AddTimer("trig1", 15.0f, "beginStory");
}

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

(This post was last modified: 05-01-2012, 12:51 AM by Saren.)
04-30-2012, 07:55 PM
Find
Adrianis Offline
Senior Member

Posts: 620
Threads: 6
Joined: Feb 2012
Reputation: 27
#12
RE: Wake up script

If you get Notepad++ and install all the plugins correctly (as seen here http://wiki.frictionalgames.com/hpl2/thi...xt/notepad), then clicking on a '(' or '{' will highlight in red the corresponding ')' and '}', this means you can click through the brackets in order to find where the corresponding opening or closing bracket is. You may find it makes it much easier to spot mistakes like that
05-01-2012, 07:48 PM
Find
Saren Offline
Member

Posts: 196
Threads: 20
Joined: Jan 2012
Reputation: 1
#13
RE: Wake up script

(05-01-2012, 07:48 PM)Adrianis Wrote: If you get Notepad++ and install all the plugins correctly (as seen here http://wiki.frictionalgames.com/hpl2/thi...xt/notepad), then clicking on a '(' or '{' will highlight in red the corresponding ')' and '}', this means you can click through the brackets in order to find where the corresponding opening or closing bracket is. You may find it makes it much easier to spot mistakes like that
Yea it does that, also when you select a word and it highlights all the other same words in green, right?



(This post was last modified: 05-01-2012, 11:05 PM by Saren.)
05-01-2012, 11:05 PM
Find
Adrianis Offline
Senior Member

Posts: 620
Threads: 6
Joined: Feb 2012
Reputation: 27
#14
RE: Wake up script

Correct. So wait, is it working now? You re-posted your script but didn't say if its still not working Smile

If your getting a script error, could you post it up? The first of the two numbers in brackets (e.g. (45, 10) refers to the line number in your script where the problem occured, and helps enormously in finding the problem.
05-02-2012, 07:26 PM
Find
Saren Offline
Member

Posts: 196
Threads: 20
Joined: Jan 2012
Reputation: 1
#15
RE: Wake up script

(05-02-2012, 07:26 PM)Adrianis Wrote: Correct. So wait, is it working now? You re-posted your script but didn't say if its still not working Smile

If your getting a script error, could you post it up? The first of the two numbers in brackets (e.g. (45, 10) refers to the line number in your script where the problem occured, and helps enormously in finding the problem.
Oh right, haha, yea, but no, well, the map works, but the script dose'nt, my .hps looks like this now..

void wakeUp () {
FadeOut(0);
FadeIn(20);
FadeImageTrailTo(2, 2);
FadeSepiaColorTo(100, 4);
SetPlayerActive(false);
FadePlayerRollTo(0, 2, 500);
FadeRadialBlurTo(0.15, 2);
SetPlayerCrouching(true);
AddTimer("trig1", 15.0f, "beginStory");
}

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

//Run at the start of the game.
void OnGameStart()
{

//Callbacks
{
AddEntityCollideCallback("Player", "Spawnmusic", "PlayMusic", true, 1);
AddEntityCollideCallback("Player", "Stopmusic", "StopMusic", true, 1);
AddEntityCollideCallback("Player", "Missingstaff", "Message1", true, 1);
AddEntityCollideCallback("Player", "Guarddogthoughts", "Message2", true, 1);
AddUseItemCallback("", "Masterbedroomkey", "masterbedroomdoor", "UsedKeyOnDoor", true);
AddEntityCollideCallback("Player", "PlayerCollide", "MonsterFunction", true, 1);
AddEntityCollideCallback("Player", "PlayerCollide2", "MonsterFunction2", true, 1);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("masterbedroomdoor", false, true);
PlaySoundAtEntity("", "unlock_door", "masterbedroomdoor", 0, false);
PlaySoundAtEntity("", "03_puzzle_secret", "Player", 0, false);
RemoveItem("Masterbedroomkey");
}

//Doormessages
void MasterBedroomDoor(string &in entity)
{
SetMessage("Messages", "MasterBedroomDoor", 0);
}


//StartMusic

//PlayMusic(01_puzzle_passage.ogg, true, 0.9f, 0, 100, false);


//StopMusic

//StopMusic(5, 100);


//Crowbar
void OnEnter()
{
AddUseItemCallback("", "crowbar_1", "crowbar_door", "UsedCrowbarOnDoor", true);
AddEntityCollideCallback("crowbar_joint_1", "ScriptArea_1", "CollideAreaBreakDoor", true, 1);
}

void UsedCrowbarOnDoor(string &in asItem, string &in asEntity)
{
AddTimer("", 0.2, "TimerSwitchShovel");
RemoveItem("crowbar_1");
}


void TimerSwitchShovel(string &in asTimer)
{
PlaySoundAtEntity("","puzzle_place_jar.snt", "", 0, false);
SetEntityActive("crowbar_joint_1", true);
}


void CollideAreaBreakDoor(string &in asParent, string &in asChild, int alState)
{
AddPlayerSanity(25);
PlayMusic("10_puzzle01.ogg", false, 0.7, 0.1, 10, false);
SetSwingDoorLocked("crowbar_door", false, true);
AddPropImpulse("crowbar_door", 0, 0, -50, "World");
SetSwingDoorDisableAutoClose("crowbar_door", true);
SetSwingDoorClosed("crowbar_door", false, false);
SetMoveObjectState("crowbar_door", 1);
PlaySoundAtEntity("","break_wood_metal", "BreakEffect", 0, false);
CreateParticleSystemAtEntity("", "ps_hit_wood", "BreakEffect", false);
SetEntityActive("crowbar_joint_1", false);
SetLocalVarInt("Door", 1);
}

//Foodstorage grunt
void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("grunt_foodstorage", true);
ShowEnemyPlayerPosition("grunt_foodstorage");
AddEnemyPatrolNode("grunt_foodstorage", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("grunt_foodstorage", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("grunt_foodstorage", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("grunt_foodstorage", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("grunt_foodstorage", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("grunt_foodstorage", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("grunt_foodstorage", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("grunt_foodstorage", "PathNodeArea_8", 0, "");
}

void Despawngrunt_foodstorage(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("grunt_foodstorage", false);
}

//Penumbra dog
void MonsterFunction2(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("guard_dog", true);
ShowEnemyPlayerPosition("guard_dog");
AddEnemyPatrolNode("guard_dog", "PathNodeArea_9", 0, "");
AddEnemyPatrolNode("guard_dog", "PathNodeArea_10", 0, "");
AddEnemyPatrolNode("guard_dog", "PathNodeArea_11", 0, "");
AddEnemyPatrolNode("guard_dog", "PathNodeArea_12", 0, "");
AddEnemyPatrolNode("guard_dog", "PathNodeArea_13", 0, "");
AddEnemyPatrolNode("guard_dog", "PathNodeArea_14", 0, "");
AddEnemyPatrolNode("guard_dog", "PathNodeArea_15", 0, "");
AddEnemyPatrolNode("guard_dog", "PathNodeArea_16", 0, "");
AddEnemyPatrolNode("guard_dog", "PathNodeArea_17", 0, "");
AddEnemyPatrolNode("guard_dog", "PathNodeArea_18", 0, "");
AddEnemyPatrolNode("guard_dog", "PathNodeArea_19", 0, "");
AddEnemyPatrolNode("guard_dog", "PathNodeArea_20", 0, "");
AddEnemyPatrolNode("guard_dog", "PathNodeArea_21", 0, "");
AddEnemyPatrolNode("guard_dog", "PathNodeArea_22", 0, "");
AddEnemyPatrolNode("guard_dog", "PathNodeArea_23", 0, "");
AddEnemyPatrolNode("guard_dog", "PathNodeArea_24", 0, "");
AddEnemyPatrolNode("guard_dog", "PathNodeArea_25", 0, "");
AddEnemyPatrolNode("guard_dog", "PathNodeArea_26", 0, "");
AddEnemyPatrolNode("guard_dog", "PathNodeArea_27", 0, "");
}

//Messages
void Message1(string &in asChild, string &in asParent, int alState)
{
SetMessage("Messages", "Missingstaff", 5);
}

void Message2(string &in asChild, string &in asParent, int alState)
{
SetMessage("Messages", "Guarddogthoughts", 5);
}

void OnLeave()
{
}




05-03-2012, 12:48 PM
Find
Homicide13 Offline
Senior Member

Posts: 323
Threads: 41
Joined: Nov 2010
Reputation: 14
#16
RE: Wake up script

What are the error messages that it gives you? When you run the script it should give you a line number and a character number that denotes where the error is, plus a short description of the error.


also your code here is a little off:

PHP Code: (Select All)
//Run at the start of the game.
void OnGameStart()
{

//Callbacks
{
AddEntityCollideCallback("Player""Spawnmusic""PlayMusic"true1);
AddEntityCollideCallback("Player""Stopmusic""StopMusic"true1);
AddEntityCollideCallback("Player""Missingstaff""Message1"true1);
AddEntityCollideCallback("Player""Guarddogthoughts""Message2"true1);
AddUseItemCallback("""Masterbedroomkey""masterbedroomdoor""UsedKeyOnDoor"true);
AddEntityCollideCallback("Player""PlayerCollide""MonsterFunction"true1);
AddEntityCollideCallback("Player""PlayerCollide2""MonsterFunction2"true1);


(This post was last modified: 05-03-2012, 03:27 PM by Homicide13.)
05-03-2012, 03:13 PM
Find
Saren Offline
Member

Posts: 196
Threads: 20
Joined: Jan 2012
Reputation: 1
#17
RE: Wake up script

(05-03-2012, 03:13 PM)Homicide13 Wrote: What are the error messages that it gives you? When you run the script it should give you a line number and a character number that denotes where the error is, plus a short description of the error.


also your code here is a little off:

PHP Code: (Select All)
//Run at the start of the game.
void OnGameStart()
{

//Callbacks
{
AddEntityCollideCallback("Player""Spawnmusic""PlayMusic"true1);
AddEntityCollideCallback("Player""Stopmusic""StopMusic"true1);
AddEntityCollideCallback("Player""Missingstaff""Message1"true1);
AddEntityCollideCallback("Player""Guarddogthoughts""Message2"true1);
AddUseItemCallback("""Masterbedroomkey""masterbedroomdoor""UsedKeyOnDoor"true);
AddEntityCollideCallback("Player""PlayerCollide""MonsterFunction"true1);
AddEntityCollideCallback("Player""PlayerCollide2""MonsterFunction2"true1);

Lol that's the point, there is no FATAL ERROR, the wake up scene just don't wonna happen...

05-04-2012, 02:19 PM
Find
Homicide13 Offline
Senior Member

Posts: 323
Threads: 41
Joined: Nov 2010
Reputation: 14
#18
RE: Wake up script

Well either way, you haven't closed off your OnGameStart() function, so try doing that and seeing what happens.

05-04-2012, 02:50 PM
Find
Saren Offline
Member

Posts: 196
Threads: 20
Joined: Jan 2012
Reputation: 1
#19
RE: Wake up script

(05-04-2012, 02:50 PM)Homicide13 Wrote: Well either way, you haven't closed off your OnGameStart() function, so try doing that and seeing what happens.
Uh.... { ain't that a closing bracket? O.o

05-04-2012, 03:08 PM
Find
Homicide13 Offline
Senior Member

Posts: 323
Threads: 41
Joined: Nov 2010
Reputation: 14
#20
RE: Wake up script

That's an open bracket. Every '{' needs to have a '}' somewhere to close the block off.

For example, your code
PHP Code: (Select All)
void OnEnter()

{

AddUseItemCallback("""crowbar_1""crowbar_door""UsedCrowbarOnDoor"true);

AddEntityCollideCallback("crowbar_joint_1""ScriptArea_1""CollideAreaBreakDoor"true1);


calls everything between the {} charecters (in this case AddUseItemCallback and AddEntityCollideCallback) whenever the function (OnEnter) is called. The compiler (in this case the game that loads the map file) needs these bracket characters so that it knows what the contents of functions (or some statements such as if then statements or switch statement) are.

05-04-2012, 06:59 PM
Find




Users browsing this thread: 2 Guest(s)