Frictional Games Forum (read-only)

Full Version: What does that mean?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
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
(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
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.
(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????
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)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()
{







}
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()
{
}
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)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.
(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.
Pages: 1 2