Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need some brief help.
PurpelPumpkin Offline
Junior Member

Posts: 5
Threads: 1
Joined: Sep 2011
Reputation: 0
#1
Need some brief help.

Okay so I started Amnesia Map Making yesterday and I have a small section of rooms and such, and I can do that easily but I need some scripting help.

Right now I would need to understand how to start a coding section and end it, and I also need to know how to script to make one script area activate another, or rather have me picking up an item activate the script area.

I will probably need loads of help later on, so if any kind souls out there could act as a coach for me later to help me get all my scripting ideas and such work for me, would be great, thanks!

And thank you for reading.
09-03-2011, 09:34 AM
Find
rybray Offline
Junior Member

Posts: 31
Threads: 9
Joined: Aug 2011
Reputation: 1
#2
RE: Need some brief help.

http://wiki.frictionalgames.com/hpl2/amn..._functions

All script usually has

OnStart() for when you are loading the map
{
}

OnEnter() for when your character enters the map
{
}

OnLeave() for when you leave the map
{
}

Not all functions need go inside those brackets however. You can have a function in between them, but if the function does not reside in brackets you must put void before the function, like this

void SetEntityPlayerInteractCallback(string& asName, string& asCallback, bool abRemoveOnInteraction);

But a function like this will most likely be in OnStart, like this

OnStart()
{
SetEntityPlayerInteractCallback(string& asName, string& asCallback, bool abRemoveOnInteraction);
}

Which coincidentally is the script function you would use to have something happen when you pick up an item. Look at the link above and find out what you put in the (string& asName, string& asCallback, bool abRemoveOnInteraction) section.

Be careful at the string& asCallback part, the name you put here must match the function that occurs when you pick the key up. like....

OnStart()
{
SetEntityPlayerInteractCallback("key", "spawnmonster", true);
}

void spawnmonster(string &in asEntity)
{
What you want to happen.
}

Make sure to take a look at the link at the top of the post, if you haven't already.
09-03-2011, 02:57 PM
Find
PurpelPumpkin Offline
Junior Member

Posts: 5
Threads: 1
Joined: Sep 2011
Reputation: 0
#3
RE: Need some brief help.

(09-03-2011, 02:57 PM)rybray Wrote: http://wiki.frictionalgames.com/hpl2/amn..._functions

All script usually has

OnStart() for when you are loading the map
{
}

OnEnter() for when your character enters the map
{
}

OnLeave() for when you leave the map
{
}

Not all functions need go inside those brackets however. You can have a function in between them, but if the function does not reside in brackets you must put void before the function, like this

void SetEntityPlayerInteractCallback(string& asName, string& asCallback, bool abRemoveOnInteraction);

But a function like this will most likely be in OnStart, like this

OnStart()
{
SetEntityPlayerInteractCallback(string& asName, string& asCallback, bool abRemoveOnInteraction);
}

Which coincidentally is the script function you would use to have something happen when you pick up an item. Look at the link above and find out what you put in the (string& asName, string& asCallback, bool abRemoveOnInteraction) section.

Be careful at the string& asCallback part, the name you put here must match the function that occurs when you pick the key up. like....

OnStart()
{
SetEntityPlayerInteractCallback("key", "spawnmonster", true);
}

void spawnmonster(string &in asEntity)
{
What you want to happen.
}

Make sure to take a look at the link at the top of the post, if you haven't already.
So everything I want to be loaded when I start has to be in "void OnStart"?

Or do I have to make different sections for all the commands?
That's what I'm trying to understand, say, if I have another thing programmed before, and there is a } after it, do I just remove that and add things underneath the previous scripted thing and add the } after the next command?

09-03-2011, 04:20 PM
Find
PurpelPumpkin Offline
Junior Member

Posts: 5
Threads: 1
Joined: Sep 2011
Reputation: 0
#4
RE: Need some brief help.

(09-03-2011, 04:20 PM)PurpelPumpkin Wrote:
(09-03-2011, 02:57 PM)rybray Wrote: http://wiki.frictionalgames.com/hpl2/amn..._functions

All script usually has

OnStart() for when you are loading the map
{
}

OnEnter() for when your character enters the map
{
}

OnLeave() for when you leave the map
{
}

Not all functions need go inside those brackets however. You can have a function in between them, but if the function does not reside in brackets you must put void before the function, like this

void SetEntityPlayerInteractCallback(string& asName, string& asCallback, bool abRemoveOnInteraction);

But a function like this will most likely be in OnStart, like this

OnStart()
{
SetEntityPlayerInteractCallback(string& asName, string& asCallback, bool abRemoveOnInteraction);
}

Which coincidentally is the script function you would use to have something happen when you pick up an item. Look at the link above and find out what you put in the (string& asName, string& asCallback, bool abRemoveOnInteraction) section.

Be careful at the string& asCallback part, the name you put here must match the function that occurs when you pick the key up. like....

OnStart()
{
SetEntityPlayerInteractCallback("key", "spawnmonster", true);
}

void spawnmonster(string &in asEntity)
{
What you want to happen.
}

Make sure to take a look at the link at the top of the post, if you haven't already.
So everything I want to be loaded when I start has to be in "void OnStart"?

Or do I have to make different sections for all the commands?
That's what I'm trying to understand, say, if I have another thing programmed before, and there is a } after it, do I just remove that and add things underneath the previous scripted thing and add the } after the next command?


My script file looks like this currently:

void OnStart()
{
AddEntityCollideCallback("Player", "PlayerCollide", "MonsterFunction", true, 1);
}
void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "");
}<--- Do I remove this and keep adding or do I keep adding directly after it? Or, am I completely off track?

09-03-2011, 11:32 PM
Find
Selyp Offline
Member

Posts: 210
Threads: 19
Joined: Feb 2011
Reputation: 7
#5
RE: Need some brief help.

The ending bracket would be the end of that specific function. Any other functions you add would go under it, and you would start over. For example, say you had another AddEntityCollideCallback in your OnStart section it would look like this.

void OnStart()
{
AddEntityCollideCallback("Player", "PlayerCollide", "MonsterFunction", true, 1);
AddEntityCollideCallback ("Player", "PlayerCollide2", "MonsterFunction2", true, 1);
}
void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "");
}

void MonsterFunction2 (string &in asParent, string &in asChild, int alState)
{
Whatever you want to happen here
}


Atlantia - An Amnesia: The Dark Descent Full Conversion Mod
09-04-2011, 12:38 AM
Find
PurpelPumpkin Offline
Junior Member

Posts: 5
Threads: 1
Joined: Sep 2011
Reputation: 0
#6
RE: Need some brief help.

(09-04-2011, 12:38 AM)Selyp Wrote: The ending bracket would be the end of that specific function. Any other functions you add would go under it, and you would start over. For example, say you had another AddEntityCollideCallback in your OnStart section it would look like this.

void OnStart()
{
AddEntityCollideCallback("Player", "PlayerCollide", "MonsterFunction", true, 1);
AddEntityCollideCallback ("Player", "PlayerCollide2", "MonsterFunction2", true, 1);
}
void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "");
}

void MonsterFunction2 (string &in asParent, string &in asChild, int alState)
{
Whatever you want to happen here
}

Oh, ok great thanks! Big Grin Although, I have a final request since I'm a noob that's just starting with this kind of thing, is if anyone would want or is able to help while I'm doing it, here's my skype: upp.ner


Okay, I've changed my mind, I want this to happen, you pick up lantern and that makes the door slam shut, and then the next time you touch the door a monster spawns, anyone that can help me?

(This post was last modified: 09-04-2011, 10:27 AM by PurpelPumpkin.)
09-04-2011, 10:06 AM
Find
PurpelPumpkin Offline
Junior Member

Posts: 5
Threads: 1
Joined: Sep 2011
Reputation: 0
#7
RE: Need some brief help.

Problem solved, found someone who helped me, or he found me to be exact, this threat is not longer needed, thanks for all your help.
09-04-2011, 12:50 PM
Find




Users browsing this thread: 1 Guest(s)