Racingcreed
Junior Member
Posts: 39
Threads: 12
Joined: Dec 2012
Reputation:
3
|
Amnesia editor - Help with scripting // Keys??
I've recently started to learn the Amnesia editor, but one thing I can not understand at all is scripting keys to work. I've tried watching videos but they don't explain anything, they just show you in a way that only people who know what their doing will understand.
I've always tried looking on the wiki for script functions and such, but for someone like myself who has no scripting experience what so ever, it's less than helpful, in fact, it's annoying.
I simply want to know what I need to do, step by step, in order to make a key open a certain door. What file do I need to make, how? What do I have to name the key, where do I place files, what script's do I write, where..?
Very, very simple explanations would be hugely appreciated because I'm getting annoyed and would like to just focus on continuing learning.
Many thanks,
RC
Every artist dips his brush in his own soul, and paints his own nature into his pictures. - H.W.B
|
|
12-05-2012, 08:02 PM |
|
Rowzter
Junior Member
Posts: 44
Threads: 12
Joined: Oct 2012
Reputation:
3
|
RE: Amnesia editor - Help with scripting // Keys??
in your maps folder where i think u saved ur map is called maybe "Storage.map", Then there should be a hps file to it. Create a new textfile and name it "Storage.hps"
In this hps file you should add this:
void OnStart()
{
AddUseItemCallback("", "NAMEOFKEY", "NAMEOFDOOR", "NAMEOFFUNCTION", true);
}
void NAMEOFFUNCTION(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_door", asEntity, 0, false);
RemoveItem(asItem);
}
I hope i wrote it understandable.
|
|
12-05-2012, 08:38 PM |
|
Racingcreed
Junior Member
Posts: 39
Threads: 12
Joined: Dec 2012
Reputation:
3
|
RE: Amnesia editor - Help with scripting // Keys??
First of all, thanks for the response.
Secondly, a few things I'm unclear off..
In the command list you provided, what would I need to change? I simply want a door to open when a key is used on it, I'm not sure what options I would need to change, and to what to.
In addition to this, in my custom story, I have a key, and a door. The door I named to Door01 and set it to locked, the key I've named Key01. Is there any other options on either of these items which would need changing?
In the maps folder I have one file, called "Testlevel.hps", and my level name is "Testlevel". Do I still need to create a new file called "Storage.hps" or edit the existing one?
I'm sorry I've not familiar with the scripting, I really need it as clear as possible. Many thanks for helping! I really appreciate the help!
Every artist dips his brush in his own soul, and paints his own nature into his pictures. - H.W.B
|
|
12-05-2012, 08:50 PM |
|
The chaser
Posting Freak
Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation:
113
|
RE: Amnesia editor - Help with scripting // Keys??
(12-05-2012, 08:50 PM)Racingcreed Wrote: First of all, thanks for the response.
Secondly, a few things I'm unclear off..
In the command list you provided, what would I need to change? I simply want a door to open when a key is used on it, I'm not sure what options I would need to change, and to what to.
In addition to this, in my custom story, I have a key, and a door. The door I named to Door01 and set it to locked, the key I've named Key01. Is there any other options on either of these items which would need changing?
In the maps folder I have one file, called "Testlevel.hps", and my level name is "Testlevel". Do I still need to create a new file called "Storage.hps" or edit the existing one?
I'm sorry I've not familiar with the scripting, I really need it as clear as possible. Many thanks for helping! I really appreciate the help! Well, then:
{
AddUseItemCallback("", "Key01", "Door01", "FUNCTION", true);
}
void FUNCTION(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Door01", false, true);
PlaySoundAtEntity("", "unlock_door.snt", asEntity, 0, false);
RemoveItem("Key01");
}
THE OTHERWORLD (WIP)
Aculy iz dolan.
|
|
12-05-2012, 09:04 PM |
|
Racingcreed
Junior Member
Posts: 39
Threads: 12
Joined: Dec 2012
Reputation:
3
|
RE: Amnesia editor - Help with scripting // Keys??
So like this?
http://oi47.tinypic.com/16j0nzp.jpg
Is that right?
Edit: It works, thanks a lot for the help!
So if I wanted to add more keys to the game, I would just copy and paste those commands in the same .hps file, below it and it would work correctly?
Every artist dips his brush in his own soul, and paints his own nature into his pictures. - H.W.B
(This post was last modified: 12-05-2012, 09:12 PM by Racingcreed.)
|
|
12-05-2012, 09:09 PM |
|
Rowzter
Junior Member
Posts: 44
Threads: 12
Joined: Oct 2012
Reputation:
3
|
RE: Amnesia editor - Help with scripting // Keys??
Yep. But i didn't see a void OnStart(). well i worked so whatevah
yes you can add more keys but then the other callback func or this:
AddUseItemCallback("", "Key01", "Door01", "FUNCTION", true);
That should always be in the void OnStart or OnEnter.
Like this:
void OnEnter
{
AddUseItemCallback("", "Key01", "Door01", "FUNCTION", true);
AddUseItemCallback("", "Key01", "Door01", "FUNCTION", true);
AddUseItemCallback("", "Key01", "Door01", "FUNCTION", true);
AddUseItemCallback("", "Key01", "Door01", "FUNCTION", true);
}
But the func should have it own space
|
|
12-05-2012, 09:51 PM |
|
Racingcreed
Junior Member
Posts: 39
Threads: 12
Joined: Dec 2012
Reputation:
3
|
RE: Amnesia editor - Help with scripting // Keys??
Can I ask, is this correct?
In this example:
////////////////////////////
// Run when entering map
void OnEnter()
{
AddUseItemCallback("", "Key01", "Door01", "FUNCTION", true);
}
void FUNCTION(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Door01", false, true);
PlaySoundAtEntity("", "unlock_door.snt", asEntity, 0, false);
RemoveItem("Key01");
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
The adduseitemcallback is the list where you add the functions of a key. So for example, if I wanted to add additional key usages, I would add an additional line with different key names & doors?
The void FUNCTION line determines what the word "FUNCTION" does if used in the line with adduseitemcallback? And if I wanted a different result, I would add an addition set of scripts below with links to a different word to give the items a different set of coding meaning?
Is that right?
I have no idea what the bottom half means :/
Every artist dips his brush in his own soul, and paints his own nature into his pictures. - H.W.B
|
|
12-05-2012, 09:55 PM |
|
The chaser
Posting Freak
Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation:
113
|
RE: Amnesia editor - Help with scripting // Keys??
(12-05-2012, 09:09 PM)Racingcreed Wrote: So like this?
http://oi47.tinypic.com/16j0nzp.jpg
Is that right?
Edit: It works, thanks a lot for the help!
So if I wanted to add more keys to the game, I would just copy and paste those commands in the same .hps file, below it and it would work correctly? Yep. Just change the names and it's alright. It's like an alternative language, something like this in real life:
void OnAlways()
{
reaction();
}
void reaction ()
{
if (GetLocalVarInt("Dumbass") == 1) //There is a dumbass
{
SetMoveObjectState("Punch", 1.0f);
AddTimer("", 0.5, "Effects");
}
void Effects (string &in asTimer)
{
//Play sound effects, like dumbass screaming, hit, etc
}
THE OTHERWORLD (WIP)
Aculy iz dolan.
|
|
12-05-2012, 10:27 PM |
|
Racingcreed
Junior Member
Posts: 39
Threads: 12
Joined: Dec 2012
Reputation:
3
|
RE: Amnesia editor - Help with scripting // Keys??
Ok, many thanks for the help! Really appreciate it!
Every artist dips his brush in his own soul, and paints his own nature into his pictures. - H.W.B
|
|
12-05-2012, 11:57 PM |
|
|