The if ? - 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: The if ? (/thread-13809.html) |
The if ? - Shives - 03-06-2012 Hi I often see an "If" in a script. I tryed to get it but I can't. What the If is for? When I should use it? How to script it? RE: The if ? - Unearthlybrutal - 03-06-2012 Example: Function when player touched the door (mansion_2) : void TouchDoor(string& asName) { if (GetSwingDoorLocked("mansion_2") == true) //checks if the door is locked { SetMessage("Messages", "DoorLocked", 0); // if locked --> message appears } else // if the door is not locked SetMessage("Messages", "DoorOpen", 0); } The "If" always checks stuff RE: The if ? - Datguy5 - 03-06-2012 Ive been thinking what the if is too :/ RE: The if ? - Shives - 03-06-2012 What if I want to make a monster. Which followes path nodes but if the player looks at the monster for 3 second. The path nodes will be cleared and the monster followes the player RE: The if ? - Nevicar - 03-06-2012 This is relevant to the first question asked and is mainly directed at Unearthlybrutal concerning "if" loops. I have this set up: if (SetEntityActive("m1") == true) { SetPlayerLookSpeed(0.5f); SetPlayerRunSpeed(0.5f); SetPlayerMoveSpeed(0.5f);} else SetPlayerLookSpeed(1f); SetPlayerRunSpeed(1f); SetPlayerMoveSpeed(1f); } Would this run correctly? The only reason I'm asking instead of testing is because I don't have access to Amnesia right now. RE: The if ? - Unearthlybrutal - 03-06-2012 (03-06-2012, 06:27 PM)Nevicar Wrote: This is relevant to the first question asked and is mainly directed at Unearthlybrutal concerning "if" loops.I'm not sure about that will the "SetEntityActive" work with the "If". But if it will, this should work: Spoiler below!
RE: The if ? - Nevicar - 03-06-2012 Thanks a lot! Will be sure to try when I get home. RE: The if ? - Shives - 03-07-2012 When I want to Clear the Path nodes if the Player looks at the monster for 3 Seconds. Should the script look like this? if (PlayerLookAt("m1") == true) { AddTimer("", 3, "MonsterClear"); } void MonsterClear(string &in asTimer) { if (PlayerLookAt("m1") == true) { ClearEnemyPatrolNodes("m1"); } RE: The if ? - Stepper321 - 03-07-2012 (03-07-2012, 01:46 PM)Shives Wrote: When I want to Clear the Path nodes if the Player looks at the monster for 3 Seconds. Should the script look like this?No, go to the look function. RE: The if ? - Shives - 03-07-2012 What I've to do with the look function? |