Fanstetic
Junior Member
Posts: 8
Threads: 2
Joined: Aug 2012
Reputation:
0
|
Help.. Again :)
Hello, I'm working on an amnesia custom story and I want to know how to make all 3 of these doors explode at once, theres no errors or anything but when i walk by they don't explode
the names of the doors are: Door smash 1, door smash 2, door smash 3. The area is called door_smash1
This is the scripting, the door slam DOES work, there is no problems there.
void OnStart()
{
AddEntityCollideCallback("Player", "script_slam 1", "func_slam", true, 1);
SetEntityPlayerInteractCallback("door smash 1, door smash 2, door smash 3", "func_slam", true);
}
void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("prison1", true, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false); PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
SetPropHealth("door smash 1, door smash 2, door smash 3", 0.0f);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
}
Please reply soon!!!! Thanks
|
|
08-31-2012, 12:08 AM |
|
Kazakarumariou
An angry man.
Posts: 283
Threads: 8
Joined: Jul 2012
Reputation:
14
|
RE: Help.. Again :)
Right off the bat
SetEntityPlayerInteractCallback("door smash 1, door smash 2, door smash 3", "func_slam", true);
Don't use various ones at once
Do this \/
SetEntityPlayerInteractCallback("door smash 1", "func_slam1", true);
SetEntityPlayerInteractCallback("door smash 2", "func_slam2", true);
SetEntityPlayerInteractCallback("door smash 3", "func_slam3", true);
(This post was last modified: 08-31-2012, 12:25 AM by Kazakarumariou.)
|
|
08-31-2012, 12:25 AM |
|
Fanstetic
Junior Member
Posts: 8
Threads: 2
Joined: Aug 2012
Reputation:
0
|
RE: Help.. Again :)
(08-31-2012, 12:25 AM)Harthex Wrote: Right off the bat
SetEntityPlayerInteractCallback("door smash 1, door smash 2, door smash 3", "func_slam", true);
Don't use various ones at once
Do this \/
SetEntityPlayerInteractCallback("door smash 1", "func_slam1", true);
SetEntityPlayerInteractCallback("door smash 2", "func_slam2", true);
SetEntityPlayerInteractCallback("door smash 3", "func_slam3", true); So like this.. (Still doesn't work, but it's a start)
void OnStart()
{
AddEntityCollideCallback("Player", "script_slam 1", "func_slam", true, 1);
SetEntityPlayerInteractCallback("door smash 1", "func_slam", true);
SetEntityPlayerInteractCallback("door smash 2", "func_slam", true);
SetEntityPlayerInteractCallback("door smash 3", "func_slam", true);
}
void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("prison1", true, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false); PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
SetPropHealth("door smash 1", 0.0f);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
SetPropHealth("door smash 2", 0.0f);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
SetPropHealth("door smash 1", 0.0f);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
}
|
|
08-31-2012, 12:32 AM |
|
Kazakarumariou
An angry man.
Posts: 283
Threads: 8
Joined: Jul 2012
Reputation:
14
|
RE: Help.. Again :)
That'll break all the doors if you touch only one. or reach the script area.
(This post was last modified: 08-31-2012, 12:33 AM by Kazakarumariou.)
|
|
08-31-2012, 12:32 AM |
|
Fanstetic
Junior Member
Posts: 8
Threads: 2
Joined: Aug 2012
Reputation:
0
|
RE: Help.. Again :)
(08-31-2012, 12:32 AM)Harthex Wrote: That'll break all the doors if you touch only one. or reach the script area. No, none of them break, not when i touch them or walk into the script area :/
(08-31-2012, 12:32 AM)Harthex Wrote: That'll break all the doors if you touch only one. or reach the script area. Oh i know the problem... but I don't know how to fix it, ok I want one script area to break the 3 doors, and the other script area to slam the door, so how do I have 2 different script areas?
(This post was last modified: 08-31-2012, 01:32 AM by Fanstetic.)
|
|
08-31-2012, 01:22 AM |
|
Kazakarumariou
An angry man.
Posts: 283
Threads: 8
Joined: Jul 2012
Reputation:
14
|
RE: Help.. Again :)
Oh hey, what's the name of the doors? Also you need a different thingy for the different callbacks.
I'd script up an example, but i got to go to work.
|
|
08-31-2012, 01:43 AM |
|
Fanstetic
Junior Member
Posts: 8
Threads: 2
Joined: Aug 2012
Reputation:
0
|
RE: Help.. Again :)
(08-31-2012, 01:43 AM)Harthex Wrote: Oh hey, what's the name of the doors? Also you need a different thingy for the different callbacks.
I'd script up an example, but i got to go to work. Door smash 1, door smash 2, door smash 3, and work? dude its 10:30 here haha, night shift?
|
|
08-31-2012, 02:25 AM |
|
Streetboat
Posting Freak
Posts: 1,099
Threads: 40
Joined: Mar 2011
Reputation:
56
|
RE: Help.. Again :)
(08-31-2012, 12:25 AM)Harthex Wrote: Right off the bat
SetEntityPlayerInteractCallback("door smash 1, door smash 2, door smash 3", "func_slam", true);
Don't use various ones at once
Do this \/
SetEntityPlayerInteractCallback("door smash 1", "func_slam1", true);
SetEntityPlayerInteractCallback("door smash 2", "func_slam2", true);
SetEntityPlayerInteractCallback("door smash 3", "func_slam3", true); This is true.
Also, if you're looking to save space, you can do it like this:
for(int i=1;i<=3;i++)SetEntityPlayerInteractCallback("door smash "+i, "func_slam"+i, true);
And it will achieve the same effect. This is very useful for scripts that call the same function on multiple entities at once, such as turning off all the lights in a room or so on. You can call it all on one line, instead of multiple lines.
(This post was last modified: 08-31-2012, 03:19 AM by Streetboat.)
|
|
08-31-2012, 03:19 AM |
|
FlawlessHappiness
Posting Freak
Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation:
171
|
RE: Help.. Again :)
Do not use spaces in something that is not displayed on the screen.
All names and stuff should be with this little thing _ instead.
Trying is the first step to success.
|
|
08-31-2012, 06:29 AM |
|
Fanstetic
Junior Member
Posts: 8
Threads: 2
Joined: Aug 2012
Reputation:
0
|
RE: Help.. Again :)
Ok, I'm going to re-word my question, i have 4 doors, one i want to slam which is in a different place then the other 3 doors, the door that slams has its own script area and everything, i just want to know how to make the other script area blow up the three doors, so theres one script area infront of the slamming door, (which works) and theres an area infront of the other 3 doors. I want to make it so the 3 doors explode by running through one script area, then walk through the door, walk through another script area and make that door slam shut. the script is..
void OnStart()
{
AddEntityCollideCallback("Player", "script_slam 1", "func_slam", true, 1);
SetEntityPlayerInteractCallback("door smash 1", "func_slam", true);
SetEntityPlayerInteractCallback("door smash 2", "func_slam", true);
SetEntityPlayerInteractCallback("door smash 3", "func_slam", true);
}
void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("prison1", true, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false); PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
SetPropHealth("door smash 1", 0.0f);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
SetPropHealth("door smash 2", 0.0f);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
SetPropHealth("door smash 3", 0.0f);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
}
|
|
08-31-2012, 07:22 AM |
|
|