Frictional Games Forum (read-only)
Scripting, need urgent help! - 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: Scripting, need urgent help! (/thread-9259.html)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13


RE: Scripting, need urgent help! - JenniferOrange - 07-24-2011

what about the key? Check and see if thats the same too. Did you remember to hit Enter after changing the name? Otherwise this might be a distance problem.. let me test it again and put the monster further away.
Tested it again and put the monster a lot further away.. it still worked. /:


RE: Scripting, need urgent help! - JetlinerX - 07-24-2011

The key? One second, let me get all this right:

void OnStart()
{
AddUseItemCallback("", "upstairskey_1", "leveltransferdoor_1", "UsedKeyOnDoor", true);
SetEntityCallbackFunc("upstairskey_1", "OnPickup");
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("leveltransferdoor_1", false, true);
PlaySoundAtEntity("", "unlock_door", "leveltransferdoor_1", 0, false);
RemoveItem("upstairskey_1");
}
void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("*monsters name in editor*", true);
ShowEnemyPlayerPosition("*same as above*");
}
void OnLeave ()
{

}

What are the other things I should change?


RE: Scripting, need urgent help! - JenniferOrange - 07-24-2011

Monster's name is correct. Everything else looks fine to me..

void OnStart()
{
AddUseItemCallback("", "upstairskey_1", "leveltransferdoor_1", "UsedKeyOnDoor", true);
SetEntityCallbackFunc("upstairskey_1", "OnPickup");
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("leveltransferdoor_1", false, true);
PlaySoundAtEntity("", "unlock_door", "leveltransferdoor_1", 0, false);
RemoveItem("upstairskey_1");
}
void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("*monsters name in editor*", true);
ShowEnemyPlayerPosition("*same as above*");
}

void OnEnter()
{

}


void OnLeave ()
{

}

Just be sure the key name matches as well. I have no idea what's going on, and the only way I could try and fix it for you is to open your map. Sad
(BTW- while waiting for your replies, I'm watching you play Snowed In on YouTube. You're very entertaining, hehe. But do I spy Toby Turner references in there? Wink *gimme gimme*)


RE: Scripting, need urgent help! - JetlinerX - 07-24-2011

I got the door break down on que working now! Big Grin

Now I am just struggling with trying to get the key from the cellar, to the foyer, and working... SO MANY FATAL ERRORS Sad

Yes, yes you do spot Toby Turner references, though they are totally accidental! XD

Glad you like the videos! I cant wait to do yours and Mr. C's when you guys are done!

What can you see wrong?
////////////////////////////
// Run when entering map
void OnEnter ()
{
AddUseItemCallback("", "mainkey_1", "maindoor_1", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("maindoor_1", false, true);
PlaySoundAtEntity("", "unlock_door", "maindoor_1", 0, false);
RemoveItem("mainkey_1");
}
{
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
}
SetSwingDoorLocked("upstairsdoor", false, true);
PlaySoundAtEntity("", "unlock_door", "upstairsdoor", 0, false);
RemoveItem("upstairskey");
}
///////////////////////////
//Run when leaving map
void OnLeave ()
{

}


RE: Scripting, need urgent help! - JenniferOrange - 07-24-2011

Fatal errors, oh dear. D: From what I know, if you pick up the key in the cellar, it will stay in your inventory when you go into the foyer. So, that being said..
You need to remove the 'using key' script from your cellar.hps and put it in your foyer.hps. As in..

void OnStart()
{
SetEntityCallbackFunc("upstairskey_1", "OnPickup");
}

void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("*monsters name in editor*", true);
ShowEnemyPlayerPosition("*same as above*");
}

void OnEnter()
{

}

void OnLeave ()
{

}

THAT should be in your cellar.hps. Everything I removed shoud go into your foyer.hps, because that's where the door is located.


Let me see what your fatal errors say, along with your entire .hps file, including the OnStart() portion so I can see what it's getting mad at. I have a feeling it may be because of the repeating UsedKeyOnDoor function.
////////////////////////////
// Run when entering map
void OnEnter ()
{
AddUseItemCallback("", "mainkey_1", "maindoor_1", "KeyOnDoor", true);
AddUseItemCallback("", "upstairskey", "upstairsdoor", "KeyOnDoor2", true);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("maindoor_1", false, true);
PlaySoundAtEntity("", "unlock_door", "maindoor_1", 0, false);
RemoveItem("mainkey_1");
}
{
void KeyOnDoor2(string &in asItem, string &in asEntity)
}
SetSwingDoorLocked("upstairsdoor", false, true);
PlaySoundAtEntity("", "unlock_door", "upstairsdoor", 0, false);
RemoveItem("upstairskey");
}
///////////////////////////
//Run when leaving map
void OnLeave ()
{

}

Everything I bolded is what I changed. Keys are sensitive, and using many in one map is always a pain in the butt. Smile You can't repeat functions or AngelScript will get pissed. xD
Ooh, whoops. Found another error. xD I see your void KeyOnDoor2 function has brackets around it.. that's a no-no! void is just there, it never means anything, therefore it doesn't need any brackets.

////////////////////////////
// Run when entering map
void OnEnter ()
{
AddUseItemCallback("", "mainkey_1", "maindoor_1", "KeyOnDoor", true);
AddUseItemCallback("", "upstairskey", "upstairsdoor", "KeyOnDoor2", true);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("maindoor_1", false, true);
PlaySoundAtEntity("", "unlock_door", "maindoor_1", 0, false);
RemoveItem("mainkey_1");
}

void KeyOnDoor2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("upstairsdoor", false, true);
PlaySoundAtEntity("", "unlock_door", "upstairsdoor", 0, false);
RemoveItem("upstairskey");
}
///////////////////////////
//Run when leaving map
void OnLeave ()
{

}

That should work. Smile


RE: Scripting, need urgent help! - JetlinerX - 07-24-2011

Okay! AWESOME! Sooooo...

This:
////////////////////////////
// Run when entering map
void OnEnter ()
{
AddUseItemCallback("", "mainkey_1", "maindoor_1", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("maindoor_1", false, true);
PlaySoundAtEntity("", "unlock_door", "maindoor_1", 0, false);
RemoveItem("mainkey_1");
}
///////////////////////////
//Run when leaving map
void OnLeave ()
{

}

Should say what? The code that is already there, CAN NOT BE CHANGED! Thats for another door that I got right the first time. How do I add another door to unlock in here? It usually tells me you already have a code with that name retard! So just edit this script and paste it back how it should look and I will see if I can see what you did! LOL!


RE: Scripting, need urgent help! - JenniferOrange - 07-24-2011

////////////////////////////
// Run when entering map
void OnEnter ()
{
AddUseItemCallback("", "mainkey_1", "maindoor_1", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("maindoor_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "maindoor_1", 0, false);
RemoveItem("mainkey_1");
}
///////////////////////////
//Run when leaving map
void OnLeave ()
{

}

Adding the .snt is the only thing I would change in that script, otherwise that's fine. Is this your cellar script or your foyer script?


RE: Scripting, need urgent help! - JetlinerX - 07-24-2011

1. Whats the SNT do? Because it works without it too.

2. Thats the foyer, but I need to know how to add the unlock for the upstairs door on that too. The current code is just for a door in the very begging.


RE: Scripting, need urgent help! - JenniferOrange - 07-24-2011

And to add another key to that script, it depends, are you talking unlocking a normal swing door or unlocking a level door?
.snt isn't necessary, it's just the sound extension. You don't have to add it, it makes no difference, but I like to sometimes.


RE: Scripting, need urgent help! - JetlinerX - 07-24-2011

Its a level transfer, its the one at the top of the stairs. Its unlocked by the key in the cellar... I just need to know how to add another unlock script in that page of code without fatal errors.