How to make someone look somewhere for a specified time. - 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 Articles (https://www.frictionalgames.com/forum/forum-40.html) +---- Thread: How to make someone look somewhere for a specified time. (/thread-10973.html) |
How to make someone look somewhere for a specified time. - flamez3 - 10-25-2011 I don't know if this has been done but here it is: Okay, you're going to need to make a script area (8) (make sure it is a script area) and place it where you want the player to look, and make it's name to what ever you like (I named it LOOK for the tutorial).Also put a ScriptArea so that when the player walks in it, the function is triggered Like so (I named this "PLAYERLOOK"): [attachment=2151] Once you have done that, we can get into the scripting! What you will need to put in void OnStart() is this: Code: AddEntityCollideCallback("Player" , "PLYAERLOOK" , "Look" , true , 1); This means that when the player collides with the Script Area the "Look" function will come into play Now we have to put this code in anywhere BUT inside void OnStart(): Code: void Look(string &in asParent, string &in asChild, int alState){ StartPlayerLookAt("LOOK1", 6, 6, "notneededfortutorial");} This means, that when the "Look" function is triggered, the player will look at the scriptarea "LOOK1", which we placed earlier. The 6, 6 are the rate on how fast the Player looks at the script area. The first 6 is for how fast it goes, and the other 6 is for how fast it can go. The "notneededfortutorial" is not needed in the tutorial (ironic) but for those who want to know; you put the name of another function so that it will call it once the scriptarea has been looked at.... E.G: When the player looks at the area, a monster spawns somewhere) Now that we have the player looking at the ScriptArea, we want him to stop, not look at it forever. For this, we have to use timers. This make's it alot easier as it tells the game when it should activate another function in accordance to the time you put in. Here's the script: Code: AddTimer("look01", 1.0f, "Timer_1"); This means that the name of this is that "look01" is the name of this timer, the 1.0f is how long the timer last's for, and "Timer_1" means that once the 1.0f is up, it will call the function "Timer_1". (Note: you can put how ever long you want for the time, you don't always have to put the "f" in front of the time, but you should do it anyway just to be safe.) Now once we have done this, we need to make a timer function called "Timer_1" to tell the game once it is done with the timer we just made. The script you will be using is this: Code: void Timer_1(string &in asTimer) This means that when the timer is activated, it will stop the player looking at the script area. All together it should look like this: Code: void OnStart() That's it RE: How to make someone look somewhere for a specified time. - BesTCracK - 12-05-2011 Well it works good but when I make the potion from the two potions I want that potion I MADE to use for next combine with OTHER potion to again make new one , how the script have to look like ? This text joins to this http://www.frictionalgames.com/forum/thread-11653.html RE: How to make someone look somewhere for a specified time. - Gamemakingdude - 12-06-2011 Wrong sectiong BesTCracK go post in Development support. |