problems with scripting - 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: problems with scripting (/thread-9708.html) |
RE: problems with scripting - Tanshaydar - 08-12-2011 I didn't understand what you mean by break down, but for looking at an enemy, you can use StartPlayerLookAt like that: StartPlayerLookAt("enemy_name", 5, 5, ""); and for a few second later, you should use a timer: AddTimer("seconds_later", 4, "MapChanger"); then: void MapChanger(string &in asTimer) { ChangeMap("map name", "PlayerStartArea_1", "", ""); } RE: problems with scripting - Brute - 08-12-2011 Maybe I should explain something more... I had a nightmare sequence in my story. The player rans in a corridor and a monster is hunting him. The End of the corridor is a dead end. The player enters an area then, which should make the following things: The player break down, what means, the player falls on the ground (maybe by insanity), he looks to his Hunter (the enemy) and after a few seconds, the game change the map. I had already a script in it but it doesn't work. Maybe it is a total fail... Here is the script, I had tried to use: void LevelChange(string &in asTimer) { if(asTimer == "1") { StartPlayerLookAt("Nightmare",7,100,""); // Nightmare is the enemy } if(asTimer == "3") { SetPlayerRunSpeedMul(0); FadePlayerRollTo(60,8,15); MovePlayerHeadPos(-1,-1.2f,0,0.4f,0.2f); ChangeMap("Map01.map", "Game_Start", "", ""); } } I also had this line by onStart() AddEntityCollideCallback("Player" , "Nightmare_End" , "LevelChange" , true , 1); The names are correct, at this point, I am sure. RE: problems with scripting - Tanshaydar - 08-12-2011 Ah, I see. For collide call back functions, you should put something different instead of (string &in asTimer) Should be like this: void LevelChange(string &in asParent, string &in asChild, int alState) { AddTimer("First",1, " TimerFunction"); AddTimer("Second",3, " TimerFunction"); } void TimerFunction(string &in asTimer) { if(asTimer == "First") { StartPlayerLookAt("Nightmare",7,100,""); // Nightmare is the enemy } if(asTimer == "Second") { SetPlayerRunSpeedMul(0); FadePlayerRollTo(60,8,15); MovePlayerHeadPos(-1,-1.2f,0,0.4f,0.2f); ChangeMap("Map01.map", "Game_Start", "", ""); } } RE: problems with scripting - Brute - 08-12-2011 OMG! Thank you Tanshaydar! It works, and I think, I had now understand to use timer. Thanks so much! But which script must I wrote in the second map to stop this? I had already tried StopPlayerLookAt() but he is still crouching. RE: problems with scripting - Tanshaydar - 08-12-2011 ChangePlayerStatetoNormal or something like that, I don't remember exactly, should do it. RE: problems with scripting - Tesseract - 08-12-2011 SetPlayerCrouching(false); that will stop him from crouching. RE: problems with scripting - Brute - 08-12-2011 I had just seen, that I had already SetPlayerCrouching(false); line in the other map in a wake script. So I think I must change the HeadPos of the Player. But what is the normal position of his head? RE: problems with scripting - Endlvl - 08-12-2011 Don't spam RE: problems with scripting - Tesseract - 08-13-2011 (08-12-2011, 03:01 PM)Brute Wrote: I had just seen, that I had already SetPlayerCrouching(false); line in the other map in a wake script. So I think I must change the HeadPos of the Player. this is a normal player head pos took me FOREVER to get it right U_U MovePlayerHeadPos(0, 0, 0, 2, 0.5f); RE: problems with scripting - Brute - 08-13-2011 Thanks Saffire192. Now it works. I will report, when I had other problems with my full conversion. But meanwhile you could help me with another custom story, which I had stop, because my weak knowledge of scripting. Quote: I had already problem by making buttons and levers. So this is my concept. The player used a lever ( I had also tried with a button, with no succes) which makes the following things: - He unlock a door - He activate some enemys - He plays a sound But nothing works! Not even with a button! Maybe my script is total fail again... This is by onStart Quote:SetEntityConnectionStateChangeCallback("LeverExit01", "OpentheExit"); And this is the rest: Quote:void OpentheExit(string &in asConnectionName, string &in asMainEntity, string &in asConnectEntity, int alState)So what is wrong? I have also a small question. It is possible to make enemys never dissapear and always followed their pathnodes, like in Justine? How did I do this? |