[SCRIPT] Script Error 3.0 - 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] Script Error 3.0 (/thread-13812.html) |
Script Error 3.0 - GoranGaming - 03-06-2012 The music on my custom story was messing. So I added a few lines. But I got an error: Here is my script: //Crowbar void UseCrowbarOnDoor(string &in asItem, string &in asEntity) { StartPlayerLookAt("crowbar_joint_1", 4, 1, ""); AddTimer("CrowStopLookTimer", 1, "CrowStopLookTimerFunc"); AddTimer(asEntity, 0.2, "TimerSwitchShovel"); PlaySoundAtEntity("pickupcrow","player_crouch.snt", "Player", 0.05, false); RemoveItem(asItem); GiveSanityDamage(10, false); } void CrowStopLookTimerFunc(string &in Timer) { StopPlayerLookAt(); } void TimerSwitchShovel(string &in asTimer) { PlaySoundAtEntity("attachshovel","puzzle_place_jar.snt", asTimer, 0, false); SetEntityActive("crowbar_joint_1", true); } void CollideAreaBreakDoor(string &in asParent, string &in asChild, int alState) { GiveSanityBoostSmall(); //PlayMusic("10_puzzle01.ogg", false, 0.7, 0.1, 10, false); SetSwingDoorLocked("CrowDoor", false, false); SetSwingDoorDisableAutoClose("CrowDoor", true); SetSwingDoorClosed("CrowDoor", false,false); PlaySoundAtEntity("break","break_wood_metal", "AreaBreakEffect", 0, false); CreateParticleSystemAtEntity("breakps", "ps_hit_wood", "AreaBreakEffect", false); AddPropImpulse("CrowDoor", -3, 0, 0, "world");//-3 SetEntityActive("crowbar_joint_1", false); SetEntityActive("crowbar_dyn_1", true); AddTimer("pushdoor", 0.1, "TimerPushDoor"); AddDebugMessage("Break door!", false); } void TimerPushDoor(string &in asTimer) { AddPropImpulse("CrowDoor", -1, 2, 4, "world");//-1 AddTimer("doorclose", 1.1, "TimerDoorCanClose"); } void TimerDoorCanClose(string &in asTimer) { SetSwingDoorDisableAutoClose("CrowDoor", false); } //End of Crowbar //Chemicals void PickChemical(string &in asEntity, string &in asType) { FadeLightTo("AquaLight", 0,0,0,0, -1, 2); } void PickChemical2(string &in asEntity, string &in asType) { FadeLightTo("AquaLight_2", 0,0,0,0, -1, 2); } //End of Chemicals //Monster void ActivateGrunt1Func(string &in asParent, string &in asChild, int alState) { if(HasItem("crowbar_1")){ SetEntityActive("servant_grunt_1", true); //CheckPoint("checkpoint1","PlayerStartArea_8","CPCall01", "", ""); } StopMusic(0, 1); AddTimer("react1", 0.5f, "ReactSound1Timer"); AddTimer("stoplockdoor", 4, "StopLockDoorFunc"); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 0.0f, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0.0f, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0.0f, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0.0f, ""); AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0.0f, ""); } void RemoveGrunt1Func(string &in asParent, string &in asChild, int alState) { SetEntityActive("servant_grunt_1", false); PlaySoundAtEntity("", "door_level_wood_open.snt", "DoorSpawn", 0, false); CreateParticleSystemAtEntity("ps_area_fog", "ps_area_fog.ps", "Grunt1Fog", false); PlayMusic("12_amb.ogg", true, 10, 2, 1, true); } void StopLockDoorFunc(string &in Timer) { SetEntityActive("LabDoor", false); } void ReactSound1Timer(string &in Timer) { PlayGuiSound("react_pant1.ogg", 1); } //End of Monster //Areas void EnableGrunt1Area(string &in Entity) { SetEntityActive("EnableGrunt1", true); } //End of Areas //Misc void StartMusic(string &in Timer) { PlayMusic("12_amb.ogg", true, 10, 2, 1, true); } void InteractCrowDoor(string &in Entity) { SetMessage("Messages", "CrowDoor", 1); } void InteractLabDoor(string &in Entity) { SetMessage("Messages", "LockedStorage", 1); AddPropImpulse("LabDoorDoor", 0, 0, 1, "world");//-3 PlaySoundAtEntity("", "locked_door.snt", "LabDoorDoor", 0, false); } //End of Misc void OnStart() { //EDITOR GiveItemFromFile("lantern", "lantern.ent"); for(int i=0;i< 10;i++) GiveItemFromFile("potion_sanity_"+i, "potion_sanity.ent"); //End of EDITOR //Crowbar AddEntityCollideCallback("crowbar_joint_1", "BreakDoor", "CollideAreaBreakDoor", true, 1); AddUseItemCallback("crowbarondoor", "crowbar_1", "CrowDoor","UseCrowbarOnDoor", true); //End of Crowbar //Monster AddEntityCollideCallback("Player", "EnableGrunt1", "ActivateGrunt1Func", true, 1); AddEntityCollideCallback("servant_grunt_1", "DisableGrunt1", "RemoveGrunt1Func", true, 1); //End of Monster //MUSIC StopMusic(0, 1) AddTimer("startmusic", 0.1f, "StartMusic"); //End of MUSIC } void OnEnter() { } void OnLeave() { StopMusic(0, 1); } And here is a video where I show the problem: Can anybody help? RE: Script Error 3.0 - Your Computer - 03-06-2012 StopMusic in OnStart is missing a semicolon. As for the music "issue," it seems like you don't understand the difference between OnStart and OnEnter. RE: Script Error 3.0 - GoranGaming - 03-07-2012 Ohh I do, but now I realise what was wrong. Thanks RE: Script Error 3.0 - Stepper321 - 03-07-2012 Actually, i would recommend that you do everythign OnEnter... It can result into some bugs. |