![]() |
Script Area's wont work - 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: Script Area's wont work (/thread-14160.html) |
Script Area's wont work - sHock - 03-22-2012 Ohai there, i dont think my "Script Areas" work.. Not sure if its a problem in the level editor, or in the code so ill post pic's of the editor and the code. I tried to make a "Flying jesus" scare but when i walk into that area, nothing happends.. The code is a bit messy.. it is my first map.. hopefully you can make something out of it /////////////////////Run when starting mapvoid OnStart(){ AddUseItemCallback("", "OutKey", "OutDoor", "UseKey1", true); AddUseItemCallback("", "Room1_key", "Room1_door", "UseKey2", true); AddEntityCollideCallback("Player", "Scriptarea_1", "Chairmode", true, 1); AddEntityCollideCallback("Player", "FlyingJesus_1", "HolyJesus", true, 1); AddEntityCollideCallback("Jesus_1", "FlyingJesus_1", "Sound", true, 1); AddEntityCollideCallback("Player", "Scary_Area_4", "Scary_4", true, 1); SetPlayerLampOil(0);} void d2(string &in asItem, string &in asEntity){ SetSwingDoorLocked("door2", false, true); PlaySoundAtEntity("", "unlock_door", "d2", 0, false); RemoveItem("OutKey");}void UseKey1(string &in asitem, string &in Door){ SetSwingDoorLocked("OutDoor", false, true); PlaySoundAtEntity("", "unlock_door", "door", 0, false); RemoveItem(asitem); SetMessage("M", "v1", 3); SetEntityActive("Mansion_Monster1", true); AddEnemyPatrolNode("Mansion_Monster1", "Mansion_monster_path_1", 0.1, ""); SetEntityActive("Mansion_Monster1_1", true); AddEnemyPatrolNode("Mansion_Monster1_1", "Mansion_monster_path_1", 0.1, ""); SetEntityActive("Mansion_Monster1_2", true); AddEnemyPatrolNode("Mansion_Monster1_2", "Mansion_monster_path_1", 0.1, ""); GiveSanityDamage(20, true); StartScreenShake(0.10f, 0.1f, 0.10f, 0.1f); PlaySoundAtEntity("", "react_scare.snt", "Player", 0.0, false);}void UseKey2(string &in asitem, string &in Door){ SetSwingDoorLocked("Room1_Door", false, true); PlaySoundAtEntity("", "unlock_door", "door", 0, false); RemoveItem(asitem);} void Chairmode(string &in asItem, string &in asEntity) { SetLampLit("candlestick_wall_1", true, false); PlaySoundAtEntity("", "chair.ogg", "MrChair", 0, false); } void HolyJesus(string &in asParent, string &in asChild, int alState){SetEntityActive("Jesus_1", true);AddPropForce("Jesus_1", 0, 30000, 0, "World");} void Sound(string &in asParent, string &in asChild, int alState){PlaySoundAtEntity("", "24_iron_maiden.snt", "FlyingJesus_1", 0, false);} RE: Script Area's wont work - pandasFTW - 03-22-2012 well i cant see anything from the code, try and sort it out a bit ![]() (03-22-2012, 11:46 AM)pandasFTW Wrote: well i cant see anything from the code, try and sort it out a bitoh and i saw that the name of the script_area in the code was FlyingJesus_1, but in the level editor it is just FlyingJesus1 without underscore, those two need to match too! ![]() RE: Script Area's wont work - Obliviator27 - 03-22-2012 Though the problem has been solved, it will be easier for everybody to read your script if you space it out like so void OnStart() { // Line of code; // Line of code; } void OtherFunction { // Line of code; } It will also make it easier for you to sift through it should there be a problem. RE: Script Area's wont work - sHock - 03-22-2012 That fixed indeed ![]() RE: Script Area's wont work - JordanWeigle - 03-22-2012 (03-22-2012, 06:42 PM)sHock Wrote: That fixed indeedYeah, apparently, the code isn't "automatically" like that. I posted code once and had to go back through it and add "[br]'s" due to my OCD. :[ RE: Script Area's wont work - Your Computer - 03-22-2012 This is why the forum supports code boxes which retain line breaks. I would advise users to learn forum bb code rather than plainly posting their code. |