Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 4 Vote(s) - 3.25 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Jens! Could you reveal more HPL2 triggers?
Cranky Old Man Offline
Posting Freak

Posts: 986
Threads: 20
Joined: Apr 2012
Reputation: 38
#1
Jens! Could you reveal more HPL2 triggers?

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!

Noob scripting tutorial: From Noob to Pro

05-07-2012, 04:53 AM
Find
Cranky Old Man Offline
Posting Freak

Posts: 986
Threads: 20
Joined: Apr 2012
Reputation: 38
#2
RE: Jens! Could you reveal more HPL2 triggers?

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

Noob scripting tutorial: From Noob to Pro

(This post was last modified: 05-07-2012, 06:55 AM by Cranky Old Man.)
05-07-2012, 06:08 AM
Find
Homicide13 Offline
Senior Member

Posts: 323
Threads: 41
Joined: Nov 2010
Reputation: 14
#3
RE: Jens! Could you reveal more HPL2 triggers?

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: (Select All)
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).

(This post was last modified: 05-07-2012, 06:34 AM by Homicide13.)
05-07-2012, 06:33 AM
Find
Cranky Old Man Offline
Posting Freak

Posts: 986
Threads: 20
Joined: Apr 2012
Reputation: 38
#4
RE: Jens! Could you reveal more HPL2 triggers?

(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: (Select All)
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)?

Noob scripting tutorial: From Noob to Pro

05-07-2012, 06:50 AM
Find
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#5
RE: Jens! Could you reveal more HPL2 triggers?

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: (Select All)
// 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: (Select All)
void EntityCallbackFunc(string &in type)
{
AddDebugMessage(""+typefalse);


(This post was last modified: 05-07-2012, 08:15 PM by palistov.)
05-07-2012, 08:07 PM
Find
Cranky Old Man Offline
Posting Freak

Posts: 986
Threads: 20
Joined: Apr 2012
Reputation: 38
#6
RE: Jens! Could you reveal more HPL2 triggers?

(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: (Select All)
// 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: (Select All)
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.

Noob scripting tutorial: From Noob to Pro

05-08-2012, 12:48 AM
Find
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#7
RE: Jens! Could you reveal more HPL2 triggers?

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.

05-08-2012, 01:30 AM
Find




Users browsing this thread: 1 Guest(s)