I'm having a little problem with scripting right now. Yesterday I was able to make the player walk into an area and have music play. Now, I want the player to walk into the same area and in doing so forces him to look at a door nearby. I've been scripting for a while today and I think everything is correct, but when I load the custom story it crashes. It did this to me yesterday when I tried loading the music area script, but all I did to fix it was delete the cache file of the map the script was tied to. Here's the code:
I suggest indenting it correctly to make it easier to read. Tab only inside a block, not the block itself.
Your last timer, the stoptimer one, has a semi-colon at the end of the constructor. Remove that. Also add a space between string and &in within the parameters.
By the way, you can merge the triggermusic and triggerlook functions. Since they happen at the same time, they might as well be in the same function. It's not required though.
The only problem I see it's that triggerlook function is structured as if you were going to use it for a timer, but still you declare a callback for it.
Plus, you misspelled string&in, that could rise an error.
Hey MudBill, you've been building the awesome temple story I've been watching lately. How would I be able to merge the two functions?
And thanks Amn, the misspelled code got rid of the crash. But when I enter the area the PlayerLookAt function doesn't do anything (the music plays, so I know that string is working). Could it be related to the structuring of the code? If so, how would I be able to fix this?
I was able to fix the problem. I combined the two functions together... I'm not sure if that's what fixed it or not.
Yes, that's exactly how you merge those functions. This looks just right (Though the missing space is still absent, but if it works, perhaps it's not needed).
Bump...
You should use the DEBUG MODE!
Google DEBUG MODE AMNESIA.
It should bring you there :
Well, i grabbed it for you.
You should have this into your FAVORITE ( internet explorere \ Firefox etc.. ) http://wiki.frictionalgames.com/hpl2/amn...evenvguide
For any more questions you can ask there here on the forum here :
-
Spoiler below!
Quote:In order to make maps for Amnesia you will need to set up the game, so you can easily test maps and reload scripts. First of all, follow these steps to create a dev user:
1.
Enter the game normally, create a profile name (e.g. MyName) and then exit.
2.
Enter the save directory (“My Documents/Amnesia/Main” in windows by default; ”~/.frictionalgames/Amnesia/Main” in Linux) and rename the user name (e.g. MyName) to “dev_user”.
3.
Open main_settings.cfg and set ShowMenu=“false”, ShowPreMenu=“false”, ExitMenuDirectly=“true”, LoadDebugMenu=“true” (also setting SaveConfig=“false” should be good).
4.
If Amnesia is 1.0.1 or above, you must set ForceCacheLoadingAndSkipSaving=“false” main_settings.cfg, or else map changes will not show!
5.
Open user_settings.cfg (in “dev_user” folder), inside the Debug element add AllowQuickSave=“true” (F4=save, F5=load) and change ScriptDebugOn=“true”.
6.
In user_settings.cfg, inside the Map element set Folder=”“ to the root folder for your maps (eg Folder=“MyMaps/”), this folder MUST be located inside the maps folder in the game directory (where you put the tools).
7.
In user_settings.cfg, inside the Map element set File=”“ to point to the map you want to load (eg File=“my_map.map”).
8.
In order to avoid running into “File index out of bounds” errors when designing your custom story in the level editor, edit the file resources.cfg located in the root the directory of Amnesia (i.e. where Amnesia is installed) and add the custom_stories directory to the list.
Now you can simply run Amnesia and the map will be loaded directly without any menu. You can now press F1 to open a debug menu to turn on/off various things and more importantly quick reload the map. This is probably the most important thing to do when editing. When changed a script or added entities to a map, do NOT restart the game, instead simply press “Quick reload”. If a mesh or texture has been updated, you need to press “Reload”.
(This post was last modified: 03-14-2014, 02:05 AM by DnALANGE.)