Frictional Games Forum (read-only)
How to place several scripts in the .hps file - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: How to place several scripts in the .hps file (/thread-14281.html)



How to place several scripts in the .hps file - GoDiiXz - 03-27-2012

Hey!

I am making my first custom story and i was wondering how i could get several scripts in the .hps file

i have fixed it so i have several of keys and doors to unlock, and in the script it looks like the picture i added, now i wonder where and what i am supposed to put in it.

there are to few video tutorials of htis scripting and on, and i think video make it so much easy, as i don't understand any code or any of that Tongue Cool




RE: How to place several scripts in the .hps file - SilentStriker - 03-27-2012

This is how your script works.

Code:
void OnStart
{
AddUseItemCallback("", "NAMEOFKEY", "NAMEOFTHEDOOR", "NAMEOFFUNCTION", true);
}

void NAMEOFFUNCTION(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("NAMEOFDOOR", false, true);
PlaySoundAtEntity("", "NAMEOFSOUND", "NAMEOFDOOR", 0, false);
RemoveItem(asItem);
}

AddUseItemCallback is used to be able to use an item on the world for example a key on a door or a knife on a corpse or what ever.

SetSwingDoorLocked is used to unlock the door but to unlock it you need to check the Locked on the Door in the level editor.

PlaySoundAtEntity plays a sound at the entity of your choice, can be the player, a script area or just an entity.

RemoveItem removes the item or in this case, the key.

I would suggest you look at Elven and YourComputer's video tutorials Smile

Elven:
http://wiki.frictionalgames.com/hpl2/tutorials/scripting/article

YourComputer:
http://www.youtube.com/user/ThisIsYourComputer



RE: How to place several scripts in the .hps file - GoDiiXz - 03-27-2012

now i know how it works, but my problem as said, i do not know where i put in example: void AddEntityCollideCallback(string& asParentName, string& asChildName, string& asFunction, bool abDeleteOnCollide, int alStates);

but i do not know where to put this script as i already have the door/key script there, to say it short: where do i put this scirpt: void AddEntityCollideCallback(string& asParentName, string& asChildName, string& asFunction, bool abDeleteOnCollide, int alStates);
please reply me a picture that shows where, in notepad++ offcourse ;D



RE: How to place several scripts in the .hps file - SilentStriker - 03-27-2012

All callbacks are used inside the void OnStart and then the functions are outside it Smile



RE: How to place several scripts in the .hps file - GoDiiXz - 03-27-2012

oooh, now I THINK i get it

all kinds of callback goes in this section? (first picture)

and all the FUNCTIONS goes in this section o.o? (second picture)

Big Grin

http://imageshack.us/photo/my-images/152/script1x.jpg/ (First image)
http://imageshack.us/photo/my-images/819/script2m.jpg/ (second image)


RE: How to place several scripts in the .hps file - SilentStriker - 03-27-2012

Yes Smile When the callback calls a function you write the function outside the OnStart Smile

A function is for example the UsedKeyOnDoor Smile



RE: How to place several scripts in the .hps file - GoDiiXz - 03-27-2012

THANK YOU SOOOO MUCH FOR YA HELP Big Grin I AM SOOOOO HAPPEY NOW ^^^^^^^ APPRECIATE YA MAN ;D


RE: How to place several scripts in the .hps file - SilentStriker - 03-27-2012

Your Welcome Smile



RE: How to place several scripts in the .hps file - GoDiiXz - 03-27-2012

another thing, a script to get a area wich the player goes in and activates a monster wich is a hallucination


RE: How to place several scripts in the .hps file - SilentStriker - 03-27-2012

Script areas and monster are created in the Level editor remember to check hallucination in the settings of the monster then use the AddEntityCollideCallback and SetEntityActive.