![]() |
Fancy door + quest 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 (https://www.frictionalgames.com/forum/forum-35.html) +--- Thread: Fancy door + quest scripting. (/thread-6941.html) |
RE: Fancy door + quest scripting. - Streetboat - 03-19-2011 Wow, brilliant. That one simple fix (Changing true to false) fixed everything. The fire and key puzzle works like a charm now, thank you very much. On to my next question (I'm finally getting the hang of this, I've written a few of my own fairly complex scripts since I started this thread, and they work!); How do I make a sound entity not play instantly when the map loads? I want a sound to wait until I hit an area to play, then play once. I've unchecked 'active' on the sound itself, I've activated it and told it to play in the script, and so on. It still plays as soon as the level loads. Also, could you please elaborate on what exactly I need to be putting in OnEnter and OnLeave? I do understand what they actually do, but I don't know what to tell them to do to make it check if I have the lantern or not in the next level. Should I tell it to remember something when I leave the level, or tell it to check something when I enter the level? RE: Fancy door + quest scripting. - Nye - 03-19-2011 Try using the function, Code: HasItem(string& asName); So, you would put Code: if(HasItem("lantern") == true I have never done the above code, but it should work! ![]() Second, you don't need to put anything inside the OnLeave() and OnEnter(). Although, inside the OnLeave(), I put sounds (eg. creepy whispers) and also specify the loading screen and text I want the player to load. Here is an example from one of my scripts: Code: void OnEnter() Also, it's up to you what you do with the lantern check. Maybe it would be cooler if you entered the area, created a 'Block Box' entity and created a trigger in the darkness, just before the block box. Then, when the player collides with the trigger, if he has the lantern, the callback removes the block box ((SetEntityActive, "BlockBox", false) ![]() Finally, with regards to your sound question. ONLY use the level editor for repeated sounds (eg. waterfall streams, water drips, machine humming). Every other sound, you should create triggers and use the PlaySoundAtEntity function to call. (Create a script area for the entity and place it where you want the sound source to be). Otherwise, the game will just play every single sound and it gets really buggy ![]() RE: Fancy door + quest scripting. - Streetboat - 03-19-2011 Okay, I'm sorry I can't ever get these things right, but you've been immensely helpful thus far. If you want to see the fruits of your labors, check my thread in the Showcase. ![]() Anyways, here's my code, I'm totally stumped as to why it won't work. It seems fine to me. Code: void OnStart() It says 'expected "," or ";", and unexpected "if". What does that mean, unexpected if? RE: Fancy door + quest scripting. - Oscar House - 03-19-2011 The lantern_warn function doesn't seem to have its own brackets. Try adding those. RE: Fancy door + quest scripting. - Pandemoneus - 03-19-2011 If you want to use vars between levels, you will have to use GlobalVars. RE: Fancy door + quest scripting. - Streetboat - 03-20-2011 I fixed it, I was missing some damn brackets... Oscar House got it right, boy do I feel dumb. <.< Anyways, progress is pretty solid at this point. No real issues anymore, although I do have a question: is it possible to make Entity decals active or inactive in a script? I used the blood decal entities (I know you can't activate or deactivate normal decals), and set them to inactive, then in the script told them to activate but it just doesn't seem to work. It's not a very complex code at all, I don't see what could be wrong. RE: Fancy door + quest scripting. - Pandemoneus - 03-20-2011 As far as I know you can't (de)activate decals. You would probably have to create new entities and apply the decal texture to them via the model editor. RE: Fancy door + quest scripting. - Streetboat - 03-20-2011 I can't appear to activate anything via script, though, including areas and whatnot. RE: Fancy door + quest scripting. - Streetboat - 03-21-2011 Okay so yeah, this is weird. Setting things to active or not seems to only affect a few items, and only when it feels like it. Things that I set to inactive appear anyways at the start of the map, and won't change states in my script. What gives? RE: Fancy door + quest scripting. - Pandemoneus - 03-21-2011 As I said, you can only set entities inactive aswell as areas. |