Frictional Games Forum (read-only)
Jens! Could you reveal more HPL2 triggers? - 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: Jens! Could you reveal more HPL2 triggers? (/thread-15313.html)



Jens! Could you reveal more HPL2 triggers? - Cranky Old Man - 05-07-2012

On the wiki page for the script functions, Jens explained the types of interact callbacks as simply:
""OnPickup", "Break", "OnIgnite", etc"

That is a pretty important "etc", because you have left out what type of interactions can trigger scripts.
I tried to solve this myself, searching for the types online without results, and I tried fruitlessly wrestling with the Find command on Windows (which doesn't work). My best hope is that FG tells people what these interactions are, or where they are listed, or maybe we could get help from somebody with Unix or Grep installed who can search these files for us. Help!


RE: Jens! Could you reveal more HPL2 triggers? - Cranky Old Man - 05-07-2012

Edit:
This *additional* post was based on poor eyesight, so I removed its contents so that it wouldn't confuse anybody.


RE: Jens! Could you reveal more HPL2 triggers? - Homicide13 - 05-07-2012

o.o Hmm, it looks to me that the item that is being picked up is being set to the global string var, not the type.

But the "asType" parameter is just set to the type of interaction that the player had with the object - similar to the "alState" parameter from the AddEntityCollideCallback function. It's useful in some circumstances, if you want to do something like
PHP Code:
if(asType == "onIgnite") { /*Do stuff*/ 
and so you would be able to do certain things depending on what the player does with a certain object (in this case, if the player ignites the object, a certain action or set of actions are called).


RE: Jens! Could you reveal more HPL2 triggers? - Cranky Old Man - 05-07-2012

(05-07-2012, 06:33 AM)Homicide13 Wrote: o.o Hmm, it looks to me that the item that is being picked up is being set to the global string var, not the type.

Oh, you're right. While that's even weirder, then I guess that asType is just keeping track of exactly what happens to the entity.


Quote:But the "asType" parameter is just set to the type of interaction that the player had with the object - similar to the "alState" parameter from the AddEntityCollideCallback function. It's useful in some circumstances, if you want to do something like
PHP Code:
if(asType == "onIgnite") { /*Do stuff*/ 
and so you would be able to do certain things depending on what the player does with a certain object (in this case, if the player ignites the object, a certain action or set of actions are called).

Yes, but nowhere is it explained exactly what type of interaction triggers what type. We covered when picking it up, when it breaks, and when it's set on fire. Then there's this "etc".
What other things can you do to it that will register (and thus be able to influence a script)?


RE: Jens! Could you reveal more HPL2 triggers? - palistov - 05-07-2012

If you're in an experimental mood, you can try something like this to try and uncover possible interactions. Likelihood of actually finding one is probably very low though haha

PHP Code:
// string array of types to test
const string[] InteractionTypes = { "OnLook""OnLookAt""OnCollide""OnStateChange" };
void EntityCallbackFunc(string &in type)
{
    
bool found=false;
    
// if type matches something in our string array of tests, notify
    
for(int i=1;i<=InteractionTypes.length();i++){
    if(
type == InteractionTypes[i-1])
    {
    
found=true;
    
//debug message here or something
    
}}
    if(!
found// debug here to notify that SOMETHING happened, but our names were wrong



Now that I think of it......just make the callback function add a debug message reporting type. Then just play around with entities until you see a new message. Haha.

PHP Code:
void EntityCallbackFunc(string &in type)
{
AddDebugMessage(""+typefalse);




RE: Jens! Could you reveal more HPL2 triggers? - Cranky Old Man - 05-08-2012

(05-07-2012, 08:07 PM)palistov Wrote: If you're in an experimental mood, you can try something like this to try and uncover possible interactions. Likelihood of actually finding one is probably very low though haha

PHP Code:
// string array of types to test
const string[] InteractionTypes = { "OnLook""OnLookAt""OnCollide""OnStateChange" };
void EntityCallbackFunc(string &in type)
{
    
bool found=false;
    
// if type matches something in our string array of tests, notify
    
for(int i=1;i<=InteractionTypes.length();i++){
    if(
type == InteractionTypes[i-1])
    {
    
found=true;
    
//debug message here or something
    
}}
    if(!
found// debug here to notify that SOMETHING happened, but our names were wrong



Now that I think of it......just make the callback function add a debug message reporting type. Then just play around with entities until you see a new message. Haha.

PHP Code:
void EntityCallbackFunc(string &in type)
{
AddDebugMessage(""+typefalse);

Yes, thank you for helping me, but a more definite list would be best. This is a pretty important list, because every type can unlock a hidden feature on the engine.


RE: Jens! Could you reveal more HPL2 triggers? - palistov - 05-08-2012

There's OnDeath, for entities of the enemy type as opposed to OnBreak. That's the only one I can definitely say exists apart from the ones you've already listed.