Frictional Games Forum (read-only)
What does that mean? - 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: What does that mean? (/thread-16435.html)

Pages: 1 2


What does that mean? - Jagsrs28 - 06-23-2012

So I am trying to get a door close behind me. I have this:


void SetSwingDoorLocked(string& asName, bool abLocked, bool abEffects);


Put into void OnEnter. I don't know how to fill that out. Could someone explain string& asName, bool abLocked, and bool abEffects mean? So I can actually get a door to slam shut behind the player when they walk into a room.




Thank You


RE: What does that mean? - Wrathborn771 - 06-23-2012

(06-23-2012, 04:02 PM)Jagsrs28 Wrote: So I am trying to get a door close behind me. I have this:


void SetSwingDoorLocked(string& asName, bool abLocked, bool abEffects);


Put into void OnEnter. I don't know how to fill that out. Could someone explain string& asName, bool abLocked, and bool abEffects mean? So I can actually get a door to slam shut behind the player when they walk into a room.




Thank You
I'm not a expert at scripting, but try with:

void OnEnter
{
void SetSwingDoorLocked("the name of the door", "your function, call it whatever you want", "you could choose from 0, -1 and 1. I think 1 is the best one to use");
}

Example:

void OnEnter ()
{
void SetSwingDoorLocked("door_1", "shut_door", 1);
}

Correct me if I'm wrong


RE: What does that mean? - Cruzore - 06-23-2012

You need even more than that, or the door closes right when you actually enter the map. Actually, that's even the wrong command. For first, I'll point you to a site on the wiki. It has every thing you need:
http://wiki.frictionalgames.com/hpl2/amnesia/script_functions
use ctrl + f to search for a command. search for setswingdoorclosed to see a explanation what asname, aslocked etc. means.
Now for the close behind you part:

place a script area at which point the door should close.

then, add this to OnStart():

AddEntityCollideCallback("Player", "yourscriptareanamehere", "CloseDoorFunc", true, 1);

Then, add this anywhere not inside a function:

void CloseDoorFunc(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorLocked("Doornamehere", true, true);
}

Maybe you can use some sounds for the slam, and some sanity drain.


RE: What does that mean? - Jagsrs28 - 06-23-2012

(06-23-2012, 04:56 PM)FastHunteR Wrote: You need even more than that, or the door closes right when you actually enter the map. Actually, that's even the wrong command. For first, I'll point you to a site on the wiki. It has every thing you need:
http://wiki.frictionalgames.com/hpl2/amnesia/script_functions
use ctrl + f to search for a command. search for setswingdoorclosed to see a explanation what asname, aslocked etc. means.
Now for the close behind you part:

place a script area at which point the door should close.

then, add this to OnStart():

AddEntityCollideCallback("Player", "yourscriptareanamehere", "CloseDoorFunc", true, 1);

Then, add this anywhere not inside a function:

void CloseDoorFunc(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorLocked("Doornamehere", true, true);
}

Maybe you can use some sounds for the slam, and some sanity drain.
I have this:


void OnStart()
{
ShowEnemyPlayerPosition("Grunty1");
AddUseItemCallback("", "Key_1", "castle_1", "KeyOnDoor", true);
}


AddEntityCollideCallback("Player", "ScriptArea_1", "CloseDoorFunc", true, 1);
void CloseDoorFunc(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorLocked("castle_1", true, true);
}


void KeyOnDoor(string &in item, string &in door)
{
SetSwingDoorLocked("castle_1", false, true);
PlaySoundAtEntity("", "unlock_door", "castle_1", 0, false);
RemoveItem("Key_1");
}

void OnEnter()
{

}

void OnLeave()
{







}

And it is giving me an error :S help please????


RE: What does that mean? - Cruzore - 06-23-2012

Well, I told ya to put this:
AddEntityCollideCallback("Player", "ScriptArea_1", "CloseDoorFunc", true, 1);
INTO OnStart(), not UNDER it.
With that I mean this:
void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "CloseDoorFunc", true, 1);
}
That should be it.


RE: What does that mean? - Jagsrs28 - 06-23-2012

(06-23-2012, 05:15 PM)FastHunteR Wrote: Well, I told ya to put this:
AddEntityCollideCallback("Player", "ScriptArea_1", "CloseDoorFunc", true, 1);
INTO OnStart(), not UNDER it.
With that I mean this:
void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "CloseDoorFunc", true, 1);
}
That should be it.
void OnStart()
{
ShowEnemyPlayerPosition("Grunty1");
AddUseItemCallback("", "Key_1", "castle_1", "KeyOnDoor", true);
}



{
AddEntityCollideCallback("Player", "ScriptArea_1", "CloseDoorFunc", true, 1);
}

void CloseDoorFunc(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorLocked("castle_1", true, true);
}


void KeyOnDoor(string &in item, string &in door)
{
SetSwingDoorLocked("castle_1", false, true);
PlaySoundAtEntity("", "unlock_door", "castle_1", 0, false);
RemoveItem("Key_1");
}

void OnEnter()
{

}

void OnLeave()
{







}


RE: What does that mean? - Unearthlybrutal - 06-23-2012

void OnStart()
{
ShowEnemyPlayerPosition("Grunty1");
AddUseItemCallback("", "Key_1", "castle_1", "KeyOnDoor", true);
AddEntityCollideCallback("Player", "ScriptArea_1", "CloseDoorFunc", true, 1);
}


void CloseDoorFunc(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorLocked("castle_1", true, true);
}

void KeyOnDoor(string &in item, string &in door)
{
SetSwingDoorLocked("castle_1", false, true);
PlaySoundAtEntity("", "unlock_door", "castle_1", 0, false);
RemoveItem("Key_1");
}

void OnEnter()
{

}

void OnLeave()
{
}


RE: What does that mean? - Cruzore - 06-23-2012

It's strange when someone needs their whole script file done by someone else, because they can't simply ctrl + x 1 line and paste it somewhere else...


RE: What does that mean? - Adny - 06-23-2012

(06-23-2012, 07:26 PM)FastHunteR Wrote: It's strange when someone needs their whole script file done by someone else, because they can't simply ctrl + x 1 line and paste it somewhere else...
Give a man a fish, you feed him for a day; teach a man to fish, you feed him for a lifetime. I think its rather easy to judge someone's knowledge of scripting based on the help they ask for, in this case I'd say the OP is rather new to the engine (no offense). If the people who try to help this person do nothing more than post a corrected version of the script without explaining what they did and how they got there, how is the person having the problem supposed to learn?

Simply saying "use this function" won't usually help someone who doesn't understand the basics of scripting. Not knowing what boolean, float, or integer values are, the organization of functions/callbacks, or even what a string is, is common for people new to the scripting.

I know this thread isn't the best example of it, but I find it does happen rather often.


RE: What does that mean? - MaZiCUT - 06-23-2012

(06-23-2012, 08:36 PM)andyrockin123 Wrote:
(06-23-2012, 07:26 PM)FastHunteR Wrote: It's strange when someone needs their whole script file done by someone else, because they can't simply ctrl + x 1 line and paste it somewhere else...
Give a man a fish, you feed him for a day; teach a man to fish, you feed him for a lifetime. I think its rather easy to judge someone's knowledge of scripting based on the help they ask for, in this case I'd say the OP is rather new to the engine (no offense). If the people who try to help this person do nothing more than post a corrected version of the script without explaining what they did and how they got there, how is the person having the problem supposed to learn?

Simply saying "use this function" won't usually help someone who doesn't understand the basics of scripting. Not knowing what boolean, float, or integer values are, the organization of functions/callbacks, or even what a string is, is common for people new to the scripting.

I know this thread isn't the best example of it, but I find it does happen rather often.
True that, when i helped him i explained everything in detail for him in a chat.