Frictional Games Forum (read-only)
Custom Story Script Problems - 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: Custom Story Script Problems (/thread-16975.html)

Pages: 1 2 3 4


RE: Custom Story Script Problems - zergling50 - 07-15-2012

(07-15-2012, 04:01 PM)beecake Wrote: PlaySoundAtEntity("", "unlock_door", entity, 0, false);
SetSwingDoorLocked(entity, false, true);


I dont think you can write 'entity' in there, without having an object in your map called: entity.

If you have an object called: entity, then you have to put these "" around the word.

SetSwingDoorLocked("entity", false, true);
PlaySoundAtEntity("", "unlock_door", "entity", 0, false);


In this case: [ SetSwingDoorLocked("entity", false, true); ] you are using a door. If you haven't changed your door name then it would be something like "mansion_1" or "castle_1".

Something like that, instead of entity
The guy I saw in the tutorial said that it was more efficient to do this because then you can reuse the code and not have to make a new code for each door and key you make. Ill try though and tell you in a second if it works.

(07-15-2012, 04:43 PM)zergling50 Wrote:
(07-15-2012, 04:01 PM)beecake Wrote: PlaySoundAtEntity("", "unlock_door", entity, 0, false);
SetSwingDoorLocked(entity, false, true);


I dont think you can write 'entity' in there, without having an object in your map called: entity.

If you have an object called: entity, then you have to put these "" around the word.

SetSwingDoorLocked("entity", false, true);
PlaySoundAtEntity("", "unlock_door", "entity", 0, false);


In this case: [ SetSwingDoorLocked("entity", false, true); ] you are using a door. If you haven't changed your door name then it would be something like "mansion_1" or "castle_1".

Something like that, instead of entity
The guy I saw in the tutorial said that it was more efficient to do this because then you can reuse the code and not have to make a new code for each door and key you make. Ill try though and tell you in a second if it works.


It still did not work, although I had a feeling this would be so as I did not change it to the entity and item thing until after it wasnt working originally. Anyone else? I have no idea whats going on and it is quite confusing, I just want to be able to make games. Any support or help is greatly appreceated! Thanks!
CURRENT CODE:
////////////////////////////
// Run when starting map
void OnStart()
{
AddUseItemCallback("OpenDoor", "key", "castle_1", "KeyOnDoor", true);
SetEntityPlayerInteractCallback("key", "ActivateMonster", true);
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{

}
void ActivateMonster(string &in asItem)
{
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "Idle");
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("castle_1", false, true);
PlaySoundAtEntity("", "unlock_door", "castle_1", 0, false);
RemoveItem("key");
}


RE: Custom Story Script Problems - FlawlessHappiness - 07-15-2012

Show me a picture of the door you want to script unlocked, with the door settings too


RE: Custom Story Script Problems - zergling50 - 07-15-2012

(07-15-2012, 04:43 PM)zergling50 Wrote:
(07-15-2012, 04:01 PM)beecake Wrote: PlaySoundAtEntity("", "unlock_door", entity, 0, false);
SetSwingDoorLocked(entity, false, true);


I dont think you can write 'entity' in there, without having an object in your map called: entity.

If you have an object called: entity, then you have to put these "" around the word.

SetSwingDoorLocked("entity", false, true);
PlaySoundAtEntity("", "unlock_door", "entity", 0, false);


In this case: [ SetSwingDoorLocked("entity", false, true); ] you are using a door. If you haven't changed your door name then it would be something like "mansion_1" or "castle_1".

Something like that, instead of entity
The guy I saw in the tutorial said that it was more efficient to do this because then you can reuse the code and not have to make a new code for each door and key you make. Ill try though and tell you in a second if it works.

(07-15-2012, 04:43 PM)zergling50 Wrote:
(07-15-2012, 04:01 PM)beecake Wrote: PlaySoundAtEntity("", "unlock_door", entity, 0, false);
SetSwingDoorLocked(entity, false, true);


I dont think you can write 'entity' in there, without having an object in your map called: entity.

If you have an object called: entity, then you have to put these "" around the word.

SetSwingDoorLocked("entity", false, true);
PlaySoundAtEntity("", "unlock_door", "entity", 0, false);


In this case: [ SetSwingDoorLocked("entity", false, true); ] you are using a door. If you haven't changed your door name then it would be something like "mansion_1" or "castle_1".

Something like that, instead of entity
The guy I saw in the tutorial said that it was more efficient to do this because then you can reuse the code and not have to make a new code for each door and key you make. Ill try though and tell you in a second if it works.


It still did not work, although I had a feeling this would be so as I did not change it to the entity and item thing until after it wasnt working originally. Anyone else? I have no idea whats going on and it is quite confusing, I just want to be able to make games. Any support or help is greatly appreceated! Thanks!
CURRENT CODE:
////////////////////////////
// Run when starting map
void OnStart()
{
AddUseItemCallback("OpenDoor", "key", "castle_1", "KeyOnDoor", true);
SetEntityPlayerInteractCallback("key", "ActivateMonster", true);
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{

}
void ActivateMonster(string &in asItem)
{
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "Idle");
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("castle_1", false, true);
PlaySoundAtEntity("", "unlock_door", "castle_1", 0, false);
RemoveItem("key");
}
I just double checked my code with someone else's code in their custom story that I have played and know works and it is pretty much the exact same. Is there a possibility that it is something wrong with something I did in the editor and not the coding? But then again, I dont know if that would make sense as even the grunt code will not work. I am completely clueless, its as if my computer refuses to read the file and is ignoring it. I get absolutely no errors but nothing happens. Did I miss a download or do I need something else? I am completely clueless. Please help!
EDIT: I can provide screenshots of leveleditor if needed


RE: Custom Story Script Problems - FlawlessHappiness - 07-15-2012

I don't know if it will work, but have you tried deleting your map.cache?
A lot of people do so, and then something works... I don't know if this is the right, but there must be something wrong since it ain't working


RE: Custom Story Script Problems - zergling50 - 07-15-2012

(07-15-2012, 04:55 PM)beecake Wrote: Show me a picture of the door you want to script unlocked, with the door settings too
The maximum size for a file it will let me upload is 500 kilobytes -_-
so sorry, I couldnt show you a picture unless you know of another way.

(07-15-2012, 05:01 PM)beecake Wrote: I don't know if it will work, but have you tried deleting your map.cache?
A lot of people do so, and then something works... I don't know if this is the right, but there must be something wrong since it ain't working

wheres the map cache?


RE: Custom Story Script Problems - FlawlessHappiness - 07-15-2012

My map.cache is in:
C:\Users\[USERNAME]\AppData\Local\VirtualStore\Program Files (x86)\Amnesia - The Dark Descent
\redist\custom_stories\[CUSTOMSTORY]\maps\

i don't know about the Steam version.

What i do when i post pictures is:
Go to the level editor where you want to post the picture>Press "PrtSc SysRq">Go to paint>Ctrl+v>
Crop the most important>Save>There you go Wink


RE: Custom Story Script Problems - Ongka - 07-15-2012

Or upload it to an imagehoster like http://www.imgur.com


RE: Custom Story Script Problems - zergling50 - 07-15-2012

(07-15-2012, 06:26 PM)beecake Wrote: My map.cache is in:
C:\Users\[USERNAME]\AppData\Local\VirtualStore\Program Files (x86)\Amnesia - The Dark Descent
\redist\custom_stories\[CUSTOMSTORY]\maps\

i don't know about the Steam version.

What i do when i post pictures is:
Go to the level editor where you want to post the picture>Press "PrtSc SysRq">Go to paint>Ctrl+v>
Crop the most important>Save>There you go Wink
If you are saying that it is in my custom story folder than I can assure you I see no such thing. This is all I have in my folder:
Test
-maps
--01.map
--Test.hps
-custom_story_settings.cfg
-extra_english.lang
-story.png
That is all of the files I have.
also with the picture, that is exactly what I did but it said t was still too big. 500 kilobytes is insanely small, my picture alone was 1.02 mb. Sorry for the inconveniences! but i appreciate the help!
So what do I do now, and am I missing something here with the map_cache?


RE: Custom Story Script Problems - Ongka - 07-15-2012

No, the map_cache saves some parts of your level in order to shorten the loading times. Sometimes static objects get messed up because of the cache. If this is the case, just delete the cache. If you don't have a cache this problem can't occur Wink


RE: Custom Story Script Problems - zergling50 - 07-15-2012

(07-15-2012, 06:36 PM)Ongka Wrote: Or upload it to an imagehoster like http://www.imgur.com
I tried uploading it to imgur (I have an account) and it also constantly says it failed to upload (reason it gave was because the file was over their 2mb limit) but my file is 1.02 mb. So I guess it just doesnt like my files.

(07-15-2012, 06:44 PM)Ongka Wrote: No, the map_cache saves some parts of your level in order to shorten the loading times. Sometimes static objects get messed up because of the cache. If this is the case, just delete the cache. If you don't have a cache this problem can't occur Wink
Then why is it practically ignoring my code? Its the exact same as everone elses that I cheked, but my computer doesnt seem to even execute it.