![]() |
Question about 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: Question about scripting (/thread-4455.html) Pages:
1
2
|
Question about scripting - w 1 z - 09-17-2010 Right, so I was just wondering what scripting language Frictional used for Amnesia. Is it an in-house (built from scratch) language or is it based on some other language such as C and its counterparts? I've been trying to get into the scripting part of modding and I've done well this far but I've hit a snag it seems due to my inexperience in scripting so I'm creating an encounter with a grunt that triggers when you try to open a door to an area this is what I have in the OnStart() function. Some of the default stuff is from the Tools wiki and most of the actual encounter code I borrowed off of this post http://www.frictionalgames.com/forum/thread-4425-post-36726.html#pid36726 Quote:void OnStart() It looks fine to me however when I try to compile/recompile the script in-game I get an "ERR: (3,1) Expected ',' or ";"" error. An answer to my question and to my problem would be appreciated, thanks. RE: Question about scripting - MulleDK19 - 09-17-2010 (09-17-2010, 03:08 AM)w 1 z Wrote: It looks fine to me however when I try to compile/recompile the script in-game I get an "ERR: (3,1) Expected ',' or ";"" error. An answer to my question and to my problem would be appreciated, thanks. You're missing a few brackets. Instead of: Code: void OnStart() Do this: Code: void OnStart() RE: Question about scripting - w 1 z - 09-17-2010 Well it fixed that issue but now for some reason the script is somehow disabled ie: it's not giving the lantern and tinderboxes now when I'm in Script debug mode and the encounter won't trigger with opening the door. The script compiles with no errors displaying on screen and in the debug messages the function isn't being called so there's something up Here's how it is now Code: void OnStart() Ok, the debug command for adding the lantern and tinderboxes is working now but there's still a problem. It's a little bit delayed for something which I'm not really worried about but the part I'm worried about is that the encounter still isn't triggering. I've looked over what I linked it to and it looks like everything should be in order. I might be missing a function or something somewhere. RE: Question about scripting - Armored Cow - 09-17-2010 Code: if(ScriptDebugOn()) EDIT: I'll just post my new problem here. I made a script to make a particle system appear and play a few sounds, as well as drain sanity, and now whenever I try to launch the game it says ERR: Unexpected end of file. My .hps file ends normally, with Code: void OnLeave() Anyone know why it's saying this? RE: Question about scripting - w 1 z - 09-17-2010 (09-17-2010, 04:36 AM)Armored Cow Wrote: It worked before like the way I had it but instead of the command giving the things when you load the level it gives you them when you open the door that I set to trigger the encounter to start with and the encounter doesn't start at all. Well for the time being I just moved the give lantern/tinderboxes commands down to void OnEnter() for the time being. There's still something up with the encounter trigger because even with the script debugon() removed it still won't trigger the encounter. Alright, I narrowed it down. I added a GiveSanityDamage line to encounter function and when I opened the door it worked...Sort of. There's something going on with the other lines of code up there that I think I might've messed up or I'm missing a call for it somewhere. RE: Question about scripting - jens - 09-17-2010 So bascially thins happen when you interact with the door? So that means the function works but there is no enemy activated or sound played? First, you do not need to play the sound for the enemy to enable, it will automatically play that sound when an enemy is activated. So remove that line. Then as for SetEntityActive("servant_grunt", true); make sure that the enemy really is called "servant_grunt" in the level editor, if you have not renamed him it is more likely that the name is "servant_grunt_1". Also make sure that the enemy has the Active box unchecked, so that he really only activates when you interact with the door. RE: Question about scripting - w 1 z - 09-17-2010 (09-17-2010, 07:11 AM)jens Wrote: So bascially thins happen when you interact with the door? So that means the function works but there is no enemy activated or sound played? Yeah I figured this out by poking around a few of scripts in the official maps. I got it to work and I removed that line. Thanks. RE: Question about scripting - Armored Cow - 09-17-2010 I'm still having the problem of the "Unexpected end of file" error whenever I try to load the game(map). I don't know what to do, and I can't test anything until I fix it ![]() RE: Question about scripting - jens - 09-17-2010 Add the whole file so we can see where the error is. I am guessing there is missing or too many { } so it does not open and close evenly. RE: Question about scripting - Armored Cow - 09-17-2010 Code: //////////////////////// |