(09-13-2011, 09:55 PM)MiaMasonSilentHill Wrote: I am new to scripting in amnesia, I enjoy it and I have a lot of imagination so I need to know a few things about scripting in .hps.
I know the basics such as, Giving Items From File and making a monster appear behind you when you pick up an item. I can't seem to get collides to work, I make the area and the item to make work, I do the scripting with collide callbacks. I don't understand what I put in the boxes on the level editor on the entity properties. Please help, I'd love to meet some like minded people on here!
Yours Sincerely
Mia Mason From Silent Hill
Collide Callbacks are probably one of the simplest things to do with HPL2.
void AddEntityCollideCallback(string& asParentName, string& asChildName, string& asFunction, bool abDeleteOnCollide, int alStates);
Calls a function when two entites collide.
Callback syntax: void MyFunc(string &in asParent, string &in asChild, int alState)
alState: 1 = enter, -1 = leave asParentName - internal name of main object
asChildName - internal name of object that collides with main object (asterix (*) NOT supported!)
asFunction - function to call
abDeleteOnCollide - determines whether the callback after it was called
alStates - 1 = only enter, -1 = only leave, 0 = both
Taken straight from the wiki.
For example, if you had
AddEntityCollideCallback("Player", "ScareArea", "Scare", true, 1);
When
Player collides with
ScareArea, the callback
Scare is called, and the callback removed.
Since the alState (the number at the end) is
1, the callback is only called when the player enters this area. The boolean value before it,
true, is a remove function. That means that the callback no longer exists once it is called.
Eg) Player walks into a room, and a noise is played. If it is set to
false, whenever the player enters the area, a sound is played. If it is set to
true, the sound will be played once, and not be repeated.
Hopefully that was clear enough.