Jagsrs28
Member
Posts: 101
Threads: 25
Joined: Jun 2012
Reputation:
0
|
What does that mean?
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
Special Custom Story for 2 special people!
|
|
06-23-2012, 04:02 PM |
|
Wrathborn771
Junior Member
Posts: 45
Threads: 10
Joined: Jun 2012
Reputation:
0
|
RE: What does that mean?
(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
(This post was last modified: 06-23-2012, 04:48 PM by Wrathborn771.)
|
|
06-23-2012, 04:47 PM |
|
Cruzore
Senior Member
Posts: 301
Threads: 2
Joined: Jun 2012
Reputation:
37
|
RE: What does that mean?
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/amn..._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.
(This post was last modified: 06-23-2012, 04:57 PM by Cruzore.)
|
|
06-23-2012, 04:56 PM |
|
Jagsrs28
Member
Posts: 101
Threads: 25
Joined: Jun 2012
Reputation:
0
|
RE: What does that mean?
(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/amn..._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????
Special Custom Story for 2 special people!
|
|
06-23-2012, 05:12 PM |
|
Cruzore
Senior Member
Posts: 301
Threads: 2
Joined: Jun 2012
Reputation:
37
|
RE: What does that mean?
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.
|
|
06-23-2012, 05:15 PM |
|
Jagsrs28
Member
Posts: 101
Threads: 25
Joined: Jun 2012
Reputation:
0
|
RE: What does that mean?
(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()
{
}
Special Custom Story for 2 special people!
|
|
06-23-2012, 06:46 PM |
|
Unearthlybrutal
Posting Freak
Posts: 775
Threads: 12
Joined: May 2011
Reputation:
26
|
RE: What does that mean?
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()
{
}
|
|
06-23-2012, 06:50 PM |
|
Cruzore
Senior Member
Posts: 301
Threads: 2
Joined: Jun 2012
Reputation:
37
|
RE: What does that mean?
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...
|
|
06-23-2012, 07:26 PM |
|
Adny
Posting Freak
Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation:
173
|
RE: What does that mean?
(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.
I rate it 3 memes.
|
|
06-23-2012, 08:36 PM |
|
MaZiCUT
Senior Member
Posts: 536
Threads: 31
Joined: Jun 2012
Reputation:
17
|
RE: What does that mean?
(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.
Hi.
|
|
06-23-2012, 08:37 PM |
|
|