Frictional Games Forum (read-only)
[SCRIPT] Func Callback Type - 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: [SCRIPT] Func Callback Type (/thread-54331.html)



Func Callback Type - Verkehr - 03-12-2018

Whenever I try to make the following:

Code:
SetEntityPlayerLookAtCallback("insanvision1", "insanvision1", true);

void insanvision1(string &in asEntity, int 1)
{
    GiveSanityDamage(30, true);
    SetEntityActive("spider1", true);
    AddTimer("", "1.5", "timer1");
}

it says that it expects a "," or ";" after the "1" in the void. I don't know how to combine it, it always confused me. How do I do it properly? This is the only bug I have.

Thanks in advance.


RE: Func Callback Type - TimProzz - 03-12-2018

Your problem in the int 1, the arguments of the function. You should use:
void insanvision1(string &in asEntity, int alState)

The you can use an if statement to get if the player is looking or not. So this script should work:

PHP Code:
SetEntityPlayerLookAtCallback("insanvision1""insanvision1"true); 

PHP Code:
void insanvision1(string &in asEntityint alState) {
   if(
alState == 1) { //Function returns 1 because player is looking. If 1 == 1 do the following:
         
GiveSanityDamage(30true);
         
SetEntityActive("spider1"true);
         
AddTimer("""1.5""timer1");
   }




RE: Func Callback Type - Verkehr - 03-12-2018

(03-12-2018, 10:10 PM)TimProzz Wrote: Your problem in the int 1, the arguments of the function. You should use:
void insanvision1(string &in asEntity, int alState)

The you can use an if statement to get if the player is looking or not. So this script should work:

PHP Code:
SetEntityPlayerLookAtCallback("insanvision1""insanvision1"true); 

PHP Code:
void insanvision1(string &in asEntityint alState) {
   if(
alState == 1) { //Function returns 1 because player is looking. If 1 == 1 do the following:
         
GiveSanityDamage(30true);
         
SetEntityActive("spider1"true);
         
AddTimer("""1.5""timer1");
   }


How CAN I mess up like this?! Thanks man.


RE: Func Callback Type - TimProzz - 03-13-2018

Also you used
PHP Code:
AddTimer("""1.5""timer1"); 

But the time ("1.5") should NOT be a string.

Use this.
PHP Code:
AddTimer(""1.5f"timer1"); 



RE: Func Callback Type - Verkehr - 03-13-2018

(03-13-2018, 10:45 AM)TimProzz Wrote: Also you used
PHP Code:
AddTimer("""1.5""timer1"); 

But the time ("1.5") should NOT be a string.

Use this.
PHP Code:
AddTimer(""1.5f"timer1"); 

Yeah, noticed it myself. It's fixed now, the script works.