Another Problem Again... - Printable Version +- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum) +-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html) +--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html) +---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html) +---- Thread: Another Problem Again... (/thread-10754.html) |
Another Problem Again... - JoeBradleyUK - 10-14-2011 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: Code: void OnStart(){AddEntityCollideCallback("Player", "ScareOne", "ScareOne", true, 1);} RE: Another Problem Again... - Statyk - 10-14-2011 (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. 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() { } //_____________________ RE: Another Problem Again... - JoeBradleyUK - 10-15-2011 (10-14-2011, 11:04 PM)Statyk Wrote: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.(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. RE: Another Problem Again... - Juby - 10-15-2011 (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...+ 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 RE: Another Problem Again... - Statyk - 10-15-2011 (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.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 RE: Another Problem Again... - Gamemakingdude - 10-16-2011 To fix the problem, dont use editor. Use the source above rather than edtior. That will fix the code problems. RE: Another Problem Again... - JoeBradleyUK - 10-16-2011 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 |