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


Custom Story Script Problems - zergling50 - 07-14-2012

Before I begin, I am moderately decent with java and have tried looking everywhere before bugging everyone with a question.
I am new to making Amnesia custom stories, and was able to make a room and a hallway no sweat. I was also able to do some simple scripting but I instantly ran into problems. At first I was trying to lock a door and have it be able to be opened by a key. I watched 3 tutorial videos on it and made everything exactly the way the showed me, yet whenever I tried the key on the door it said "cannot use this way!". I cant figure out what I did wrong. While I was trying to figure out the key lock thing, I decided to make a monster break down the door to the hallway and walk in, patrol a bit, and leave when you pick up the key. I also watched a tutorial on this and followed exactly what he said. The funny thing is, it worked the first time I did it, but the monster (who I wanted to not be there, then suddenly appear behind the door and break it down) was there the whole time and you could hear him behind the door so it was no big surprise. Once I picked up the key however, he broke down the door and everything worked. I realized I had forgot to save the level editor when I made him unactive, so I did that and launched it again. The monster never even showed up even after I picked up the key. The code is set up to make him appear yet he doesnt. I have no idea why some of my code wont work even though it works for other people, and am wondering if i am doing something wrong or if the videos are out of date. Heres the 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 item)
{
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolMode("servant_grunt_1", "PathNodeArea_1", 0, "Idle");
AddEnemyPatrolMode("servant_grunt_1", "PathNodeArea_2", 0, "Idle");
AddEnemyPatrolMode("servant_grunt_1", "PathNodeArea_3", 0, "Idle");
AddEnemyPatrolMode("servant_grunt_1", "PathNodeArea_4", 0, "Idle");
AddEnemyPatrolMode("servant_grunt_1", "PathNodeArea_5", 0, "Idle");
{
void KeyOnDoor(string &in item, string &in entity)
{
SetSwingDoorLocked(entity, false);
PlaySoundAtEntity("", "unlock_door", entity, 0, false);
RemoveItem(item);
}
Any help would be GREATLY appreciated. Thank you!
7/14/12 EDIT: I am still unable to figure out what is wrong. All the suggestions so far havent really changed much. Is there any more information I can provide that can help provide an answer? If anyone can help thatd be great. Thanks!


RE: Custom Story Script Problems - JMFStorm - 07-14-2012

void ActivateMonster(string &in asItem)
void KeyOnDoor(string &in asItem, string &in asEntity)


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

(07-14-2012, 08:29 PM)JMFStorm Wrote: void ActivateMonster(string &in asItem)
void KeyOnDoor(string &in asItem, string &in asEntity)

They were that originally, but some guy managed to do it with them like this so i just recently changed them to this to see if it would work. Still wouldnt work with them like as you showed above.


RE: Custom Story Script Problems - Your Computer - 07-14-2012

ActivateMonster was not properly closed, and it's string not String.


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

(07-14-2012, 09:18 PM)Your Computer Wrote: ActivateMonster was not properly closed, and it's string not String.
How do I properly close it? And what about the key code?
EDIT: OH My bad! just noticed what you meant. Thanks! ill test it and see if it works. Still not sure what to do about the key code though.

(07-14-2012, 10:13 PM)zergling50 Wrote:
(07-14-2012, 09:18 PM)Your Computer Wrote: ActivateMonster was not properly closed, and it's string not String.
How do I properly close it? And what about the key code?
EDIT: OH My bad! just noticed what you meant. Thanks! ill test it and see if it works. Still not sure what to do about the key code though.
I tested it after I properly closed it and made string lower case, but it still wont work. any other ideas? The Grunt still wont even spawn.

I just realized I put AddEnemyPatrolMode instead of AddEnemyPatrolNode, yet sadly this does nothing to change the problem. 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(entity, false);
PlaySoundAtEntity("", "unlock_door", entity, 0, false);
RemoveItem(item);
}


RE: Custom Story Script Problems - Your Computer - 07-15-2012

When you change parameter variable names, you also have to change the names within the function body to match the parameters.


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

(07-15-2012, 12:28 AM)Your Computer Wrote: When you change parameter variable names, you also have to change the names within the function body to match the parameters.

which paramater variable names do I have messed up?


RE: Custom Story Script Problems - Your Computer - 07-15-2012

(07-15-2012, 01:01 AM)zergling50 Wrote: which paramater variable names do I have messed up?

SetSwingDoorLocked(entity, false);
PlaySoundAtEntity("", "unlock_door", entity, 0, false);
RemoveItem(item);

You should have received the AngelScript output telling you this.


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

(07-15-2012, 01:49 AM)Your Computer Wrote:
(07-15-2012, 01:01 AM)zergling50 Wrote: which paramater variable names do I have messed up?

SetSwingDoorLocked(entity, false);
PlaySoundAtEntity("", "unlock_door", entity, 0, false);
RemoveItem(item);

You should have received the AngelScript output telling you this.
I dont know what AngelScript output is, ive never recieved any error messages( im doing coding in notepad)

(07-15-2012, 06:26 AM)zergling50 Wrote:
(07-15-2012, 01:49 AM)Your Computer Wrote:
(07-15-2012, 01:01 AM)zergling50 Wrote: which paramater variable names do I have messed up?

SetSwingDoorLocked(entity, false);
PlaySoundAtEntity("", "unlock_door", entity, 0, false);
RemoveItem(item);

You should have received the AngelScript output telling you this.
I dont know what AngelScript output is, ive never recieved any error messages( im doing coding in notepad)


I tried what you said and my code still wont work. 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(entity, false, true);
PlaySoundAtEntity("", "unlock_door", entity, 0, false);
RemoveItem(item);
}


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

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