Ravenskull
Junior Member
Posts: 18
Threads: 5
Joined: Nov 2011
Reputation:
0
|
attach script to another
Hey,
i have a problem and i hope you can help me. I want to attach one script in an hps to another but it doesn´t work. Do you may know the solution for my problem?
__________________________________________________________________________________________
void OnStart()
{
AddEntityCollideCallback("Player", "script_slam", "func_slam", true, 1);
}
void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("door_slam", true, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(15.0f, true);
}
{
AddUseItemCallback("", "key_1", "door_1", "open", true);
}
void open(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door_1", false, true);
PlaySoundAtEntity("", "unlock_door", "door_1", 0, false);
RemoveItem("key_1");
}
|
|
12-01-2011, 07:37 PM |
|
JMFStorm
Member
Posts: 205
Threads: 8
Joined: Aug 2011
Reputation:
28
|
RE: attach script to another
(12-01-2011, 07:37 PM)Ravenskull Wrote: void OnStart()
{
AddEntityCollideCallback("Player", "script_slam", "func_slam", true, 1);
}
void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("door_slam", true, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(15.0f, true);
} <-REMOVE
{ <-REMOVE
AddUseItemCallback("", "key_1", "door_1", "open", true); <-Shouldn't this be in the "void OnStart"?
}
void open(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door_1", false, true);
PlaySoundAtEntity("", "unlock_door", "door_1", 0, false);
RemoveItem("key_1");
} If this doesn't work there is still something wrong that I missed.
|
|
12-01-2011, 07:45 PM |
|
Ravenskull
Junior Member
Posts: 18
Threads: 5
Joined: Nov 2011
Reputation:
0
|
RE: attach script to another
Hi,
both should be "On Start". If i take your script with the two removed brackets the door key doesn´t work :/
(This post was last modified: 12-02-2011, 03:53 PM by Ravenskull.)
|
|
12-02-2011, 03:45 PM |
|
flamez3
Posting Freak
Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation:
57
|
RE: attach script to another
(12-02-2011, 03:45 PM)Ravenskull Wrote: Hi,
both should be "On Start". If i take your script witch the two removed brackets the door key doesn´t work :/ Does the error say what line is wrong with the script?
|
|
12-02-2011, 03:48 PM |
|
Ravenskull
Junior Member
Posts: 18
Threads: 5
Joined: Nov 2011
Reputation:
0
|
RE: attach script to another
Hey,
no there is no error if i try to start the game - ingame it simply sais that " can not use item on this object" if i try to use the key on the door.
______________________________________________________________________________________
This is my whole used modified sript with the removed brackets
void OnStart()
{
AddEntityCollideCallback("Player", "script_slam", "func_slam", true, 1);
}
void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("door_slam", true, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(15.0f, true);
AddUseItemCallback("", "key_1", "door_1", "open", true);
}
void open(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door_1", false, true);
PlaySoundAtEntity("", "unlock_door", "door_1", 0, false);
RemoveItem("key_1");
}
|
|
12-03-2011, 03:24 PM |
|
Khyrpa
Senior Member
Posts: 638
Threads: 10
Joined: Apr 2011
Reputation:
24
|
RE: attach script to another
The script seems ok on a quick glance. There is most likely some misnamed entity or something.
|
|
12-03-2011, 03:45 PM |
|
Ravenskull
Junior Member
Posts: 18
Threads: 5
Joined: Nov 2011
Reputation:
0
|
RE: attach script to another
I don´t think theres s.th. wrong with the entities, because the two scripts work fine on their own.
This is so f****** disappointing -.-
|
|
12-03-2011, 04:24 PM |
|
Statyk
Schrödinger's Mod
Posts: 4,390
Threads: 72
Joined: Sep 2011
Reputation:
241
|
RE: attach script to another
If I'm not mistaken, you have to make a global.hps
|
|
12-03-2011, 04:52 PM |
|
Ravenskull
Junior Member
Posts: 18
Threads: 5
Joined: Nov 2011
Reputation:
0
|
RE: attach script to another
what do you mean with "global.hps" ?
it´s \Amnesia - The Dark Descent\redist\maps\Trip\TripTrip.hps
Trip is the map folder and TripTrip is the name of the map and of the hps file
(This post was last modified: 12-03-2011, 06:59 PM by Ravenskull.)
|
|
12-03-2011, 06:59 PM |
|
Statyk
Schrödinger's Mod
Posts: 4,390
Threads: 72
Joined: Sep 2011
Reputation:
241
|
RE: attach script to another
(12-03-2011, 06:59 PM)Ravenskull Wrote: what do you mean with "global.hps" ?
it´s \Amnesia - The Dark Descent\redist\maps\Trip\TripTrip.hps
Trip is the map folder and TripTrip is the name of the map and of the hps file global.hps is a script file that allows scripts to be ran through multiple maps. A single mapname.hps can ONLY script what is it that map itself, it cannot carry over to other maps.
|
|
12-03-2011, 07:14 PM |
|
|