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
Another Problem Again...
JoeBradleyUK Offline
Member

Posts: 115
Threads: 20
Joined: Jul 2011
Reputation: 0
#1
Another Problem Again...

I want to make it so when i walk into an area, you look at the monster (which walks to a patrol node) for a period of time then it stops, when it reaches the path rode is disappears.

It won't work here is my script:
void OnStart(){AddEntityCollideCallback("Player", "ScareOne", "ScareOne", true, 1);}
{AddEntityCollideCallback("Player", "ScareTwoArea", "ScareTwo", true, 1);}
void ScareOne(string &in asParent, string &in asChild, int alState){SetLampLit("ScareOneLight", true, true);SetLampLit("ScareOneLightTwo", true, true);SetEntityActive("ScareOneMonster", true);ShowEnemyPlayerPosition("ScareOneMonster");PlaySoundAtEntity("", "react_scare3.ogg", "Player", 10.0f, true);PlayMusic("LevelOneMusic", true, 10.0f, 2.0f, 2.0f, true);SetSwingDoorLocked("ScareOneDoor", true, true);}
void ScareTwo(string &in asParent, string &in asChild, int alState){AddEnemyPatrolNode("ScareTwoMonster", "ScareTwo", 10.0f, "");StartPlayerLookAt("ScareTwoMonster", 5.0f, 6.0f, "");AddTimer("ScareTwo", 3.0f, "ScareTimerTwo");}
void ScareTimerTwo(string &in asTimer){StopPlayerLookAt();}
void OnEnter(){}void OnLeave(){}

:Work In Progress:
Insanity
(This post was last modified: 10-16-2011, 11:17 AM by JoeBradleyUK.)
10-14-2011, 10:15 PM
Find
Statyk Offline
Schrödinger's Mod

Posts: 4,390
Threads: 72
Joined: Sep 2011
Reputation: 241
#2
RE: Another Problem Again...

(10-14-2011, 10:15 PM)JoeBradleyUK Wrote: I want to make it so when i walk into an area, you look at the monster (which walks to a patrol node) for a period of time then it stops, when it reaches the path rode is disappears.

It won't work here is my script:
void OnStart(){AddEntityCollideCallback("Player", "ScareOne", "ScareOne", true, 1);}
{AddEntityCollideCallback("Player", "ScareTwoArea", "ScareTwo", true, 1);}
void ScareOne(string &in asParent, string &in asChild, int alState){SetLampLit("ScareOneLight", true, true);SetLampLit("ScareOneLightTwo", true, true);SetEntityActive("ScareOneMonster", true);ShowEnemyPlayerPosition("ScareOneMonster");PlaySoundAtEntity("", "react_scare3.ogg", "Player", 10.0f, true);PlayMusic("LevelOneMusic", true, 10.0f, 2.0f, 2.0f, true);SetSwingDoorLocked("ScareOneDoor", true, true);}
void ScareTwo(string &in asParent, string &in asChild, int alState){AddEnemyPatrolNode("ScareTwoMonster", "ScareTwo", 10.0f, "");StartPlayerLookAt("ScareTwoMonster", 5.0f, 6.0f, "");AddTimer("ScareTwo", 3.0f, "ScareTimerTwo");}
void ScareTimerTwo(string &in asTimer){StopPlayerLookAt();}
void OnEnter(){}void OnLeave(){}

Not exactly sure if this is exactly how you typed this script, but you have so much wrong here...
+ Firstly, You can't just TYPE. You have to organize by "Entering" and hitting "Tab".
+ NOTHING can be put in front of a squiggly-bracket ("{ / }") - These guys).
+ You have to put .snt after SOUND files and .ogg after MUSIC files.
+ An area and a callback can't be the same name. It could possibly confuse the script.

I went ahead and revised everything for you. Delete everything in your .hps and copy this whole thing into there:

//________________________

////////////////
//I'm not sure, but Making the AREA the same name as the CallbackFunc could also screw things up. I changed things for you so you don't have to worry...
////////////////
void OnStart()
{
AddEntityCollideCallback("Player", "ScareOne", "ScareCallback", true, 1);
AddEntityCollideCallback("Player", "ScareTwoArea", "ScareTwo", true, 1);
}

////////////////
//Make sure to put .snt and .ogg in the correct places!
////////////////

void ScareCallback(string &in asParent, string &in asChild, int alState)
{
SetLampLit("ScareOneLight", true, true);
SetLampLit("ScareOneLightTwo", true, true);
SetEntityActive("ScareOneMonster",true);
ShowEnemyPlayerPosition("ScareOneMonster");
PlaySoundAtEntity("", "react_scare3.snt", "Player", 10.0f, true);
PlayMusic("LevelOneMusic.ogg", true, 10.0f, 2.0f, 2.0f, true);
SetSwingDoorLocked("ScareOneDoor", true, true);
}
void ScareTwo(string &in asParent, string &in asChild, int alState)
{
AddEnemyPatrolNode("ScareTwoMonster", "ScareTwo", 10.0f, "");
StartPlayerLookAt("ScareTwoMonster", 5.0f, 6.0f, "");
AddTimer("ScareTwo", 3.0f, "ScareTimerTwo");
}
void ScareTimerTwo(string &in asTimer)
{
StopPlayerLookAt();
}

void OnEnter()
{

}

void OnLeave()
{

}

//_____________________
(This post was last modified: 10-14-2011, 11:05 PM by Statyk.)
10-14-2011, 11:04 PM
Find
JoeBradleyUK Offline
Member

Posts: 115
Threads: 20
Joined: Jul 2011
Reputation: 0
#3
RE: Another Problem Again...

(10-14-2011, 11:04 PM)Statyk Wrote:
(10-14-2011, 10:15 PM)JoeBradleyUK Wrote: I want to make it so when i walk into an area, you look at the monster (which walks to a patrol node) for a period of time then it stops, when it reaches the path rode is disappears.

It won't work here is my script:
void OnStart(){AddEntityCollideCallback("Player", "ScareOne", "ScareOne", true, 1);}
{AddEntityCollideCallback("Player", "ScareTwoArea", "ScareTwo", true, 1);}
void ScareOne(string &in asParent, string &in asChild, int alState){SetLampLit("ScareOneLight", true, true);SetLampLit("ScareOneLightTwo", true, true);SetEntityActive("ScareOneMonster", true);ShowEnemyPlayerPosition("ScareOneMonster");PlaySoundAtEntity("", "react_scare3.ogg", "Player", 10.0f, true);PlayMusic("LevelOneMusic", true, 10.0f, 2.0f, 2.0f, true);SetSwingDoorLocked("ScareOneDoor", true, true);}
void ScareTwo(string &in asParent, string &in asChild, int alState){AddEnemyPatrolNode("ScareTwoMonster", "ScareTwo", 10.0f, "");StartPlayerLookAt("ScareTwoMonster", 5.0f, 6.0f, "");AddTimer("ScareTwo", 3.0f, "ScareTimerTwo");}
void ScareTimerTwo(string &in asTimer){StopPlayerLookAt();}
void OnEnter(){}void OnLeave(){}

Not exactly sure if this is exactly how you typed this script, but you have so much wrong here...
+ Firstly, You can't just TYPE. You have to organize by "Entering" and hitting "Tab".
+ NOTHING can be put in front of a squiggly-bracket ("{ / }") - These guys).
+ You have to put .snt after SOUND files and .ogg after MUSIC files.
+ An area and a callback can't be the same name. It could possibly confuse the script.

I went ahead and revised everything for you. Delete everything in your .hps and copy this whole thing into there:

//________________________

////////////////
//I'm not sure, but Making the AREA the same name as the CallbackFunc could also screw things up. I changed things for you so you don't have to worry...
////////////////
void OnStart()
{
AddEntityCollideCallback("Player", "ScareOne", "ScareCallback", true, 1);
AddEntityCollideCallback("Player", "ScareTwoArea", "ScareTwo", true, 1);
}

////////////////
//Make sure to put .snt and .ogg in the correct places!
////////////////

void ScareCallback(string &in asParent, string &in asChild, int alState)
{
SetLampLit("ScareOneLight", true, true);
SetLampLit("ScareOneLightTwo", true, true);
SetEntityActive("ScareOneMonster",true);
ShowEnemyPlayerPosition("ScareOneMonster");
PlaySoundAtEntity("", "react_scare3.snt", "Player", 10.0f, true);
PlayMusic("LevelOneMusic.ogg", true, 10.0f, 2.0f, 2.0f, true);
SetSwingDoorLocked("ScareOneDoor", true, true);
}
void ScareTwo(string &in asParent, string &in asChild, int alState)
{
AddEnemyPatrolNode("ScareTwoMonster", "ScareTwo", 10.0f, "");
StartPlayerLookAt("ScareTwoMonster", 5.0f, 6.0f, "");
AddTimer("ScareTwo", 3.0f, "ScareTimerTwo");
}
void ScareTimerTwo(string &in asTimer)
{
StopPlayerLookAt();
}

void OnEnter()
{

}

void OnLeave()
{

}

//_____________________
I haven't tested it out yet, as I can't, but I do have my hps file entered!! It's just when I put it in the forums it doesn't include the enters, no idea why.

:Work In Progress:
Insanity
10-15-2011, 12:28 AM
Find
Juby Away
Senior Member

Posts: 290
Threads: 2
Joined: May 2011
Reputation: 5
#4
RE: Another Problem Again...

(10-14-2011, 11:04 PM)Statyk Wrote: Not exactly sure if this is exactly how you typed this script, but you have so much wrong here...
+ Firstly, You can't just TYPE. You have to organize by "Entering" and hitting "Tab".
+ NOTHING can be put in front of a squiggly-bracket ("{ / }") - These guys).
+ You have to put .snt after SOUND files and .ogg after MUSIC files.
+ An area and a callback can't be the same name. It could possibly confuse the script.
+ You don't have to if you really wanted to, granted it would be difficult and confusing.
+ Yes you can, you can have the entire script file on one line, it makes no difference to the compiler as all compilers read script on one line. A function like "Testfunc(int para){ stuff }" would work.
+ Not all of the time, but recommended nontheless
+ Perhaps

Insanity. Static.
10-15-2011, 01:30 AM
Find
Statyk Offline
Schrödinger's Mod

Posts: 4,390
Threads: 72
Joined: Sep 2011
Reputation: 241
#5
RE: Another Problem Again...

(10-15-2011, 01:30 AM)Juby Wrote: + You don't have to if you really wanted to, granted it would be difficult and confusing.
+ Yes you can, you can have the entire script file on one line, it makes no difference to the compiler as all compilers read script on one line. A function like "Testfunc(int para){ stuff }" would work.
+ Not all of the time, but recommended nontheless
+ Perhaps
I'm just saying because whenever I DIDN'T do these things, my script would crash. Plus, I feel safe being as specific as possible =P



10-15-2011, 12:54 PM
Find
Gamemakingdude Offline
Senior Member

Posts: 470
Threads: 82
Joined: Nov 2010
Reputation: 9
#6
RE: Another Problem Again...

To fix the problem, dont use editor. Use the source above rather than edtior. That will fix the code problems.

Rep if like me or im helpful or you love my stories!
Stephanos house
10-16-2011, 12:22 AM
Find
JoeBradleyUK Offline
Member

Posts: 115
Threads: 20
Joined: Jul 2011
Reputation: 0
#7
RE: Another Problem Again...

I made the modifications you guys said but i still have a problem, it says it's on 6 - 1 unexpected token { or something like that
here's the script again, hopefully it will be entered like it is in my hps file:

void OnStart()
{
AddEntityCollideCallback("Player", "ScareOne", "ScareOneCallback", true, 1);
}

{
AddEntityCollideCallback("Player", "ScareTwoArea", "ScareTwoCallback", true, 1);
}

void ScareOneCallback(string &in asParent, string &in asChild, int alState)
{
SetLampLit("ScareOneLight", true, true);
SetLampLit("ScareOneLightTwo", true, true);
SetEntityActive("ScareOneMonster", true);
ShowEnemyPlayerPosition("ScareOneMonster");
PlaySoundAtEntity("", "react_scare3.snt", "Player", 10.0f, true);
PlayMusic("LevelOneMusic.ogg", true, 10.0f, 2.0f, 2.0f, true);
SetSwingDoorLocked("ScareOneDoor", true, true);
}

void ScareTwoCallback(string &in asParent, string &in asChild, int alState)
{
AddEnemyPatrolNode("ScareTwoMonster", "ScareTwo", 10.0f, "");
StartPlayerLookAt("ScareTwoMonster", 5.0f, 6.0f, "");
AddTimer("ScareTwo", 3.0f, "ScareTimerTwo");
}

void ScareTimerTwo(string &in asTimer)
{
StopPlayerLookAt();
}

I figured it out nevermind xD

:Work In Progress:
Insanity
(This post was last modified: 10-16-2011, 10:38 AM by JoeBradleyUK.)
10-16-2011, 10:13 AM
Find




Users browsing this thread: 1 Guest(s)