How to have more scripts then one at a time.[Solved] - 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: How to have more scripts then one at a time.[Solved] (/thread-9444.html) |
How to have more scripts then one at a time.[Solved] - clock123 - 07-28-2011 Hey, when ever I add more then one script into my game files to my custom map it crashes, how should I fix that?, here's what I'm trying to add. Spoiler below!
RE: How to have more scripts then one at a time. - MrCookieh - 07-28-2011 Code: { this is not a proper function. It needs a head (void example(...){}) to work (like your void KeyOnDoor(...){}). So you have to decide: Should the code trigger automatically at the beginning, then put it in the OnStart(){}. Otherwise, add your Callback in your OnStart() and the function for the callback before the {. If you don't understand it, then you can tell me what should happen, that the function gets triggered, so I can give you an example code. RE: How to have more scripts then one at a time. - palistov - 07-28-2011 If you're referring to multiple script files, then no. Just one script file is required. If you're referring to co-routines (multiple functions being executed at the same time) then yes it is possible and very easy to do with AngelScript. Looking at your code example, you need to make sure you use appropriate syntax and scripting practices. You have a call stack without a name/type! If that braced call stack is supposed to be part of the 'KeyOnDoor' function, just remove the two middle braces. All lines in the function will be executed at the same time. You can use double fore-slashes to indicate a comment line with which you can organize and/or label your call stack. You can combine functions when appropriate but there is always support for co-routines when needed. RE: How to have more scripts then one at a time. - clock123 - 07-28-2011 Let's say I want to add another key to the game, how do I put it without the game crashing? RE: How to have more scripts then one at a time. - MrCookieh - 07-28-2011 you mean another key, which opens a door? do the same like you did it with your first key: Code: AddUseItemCallback("", "Key2", "Door2", "KeyOnDoor2", true); Code: void KeyOnDoor2(string &in asItem, string &in asEntity) RE: How to have more scripts then one at a time. - clock123 - 07-28-2011 So I put the new key-script in the same line with the same french brackets or making a new line with new french brackets? RE: How to have more scripts then one at a time. - MrCookieh - 07-28-2011 Your script with the second key: Code: void OnStart() |