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


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Func Callback Type
Verkehr Offline
Member

Posts: 60
Threads: 13
Joined: Oct 2016
Reputation: 1
#1
Question  Func Callback Type

Whenever I try to make the following:

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.
03-12-2018, 08:05 PM
Find
TimProzz Offline
Junior Member

Posts: 23
Threads: 8
Joined: May 2016
Reputation: 0
#2
RE: Func Callback Type

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: (Select All)
SetEntityPlayerLookAtCallback("insanvision1""insanvision1"true); 

PHP Code: (Select All)
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");
   }


Mod I'm working on: Illusions of the Dead 2
ModDB Illusions of the Dead 2
03-12-2018, 10:10 PM
Find
Verkehr Offline
Member

Posts: 60
Threads: 13
Joined: Oct 2016
Reputation: 1
#3
RE: Func Callback Type

(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: (Select All)
SetEntityPlayerLookAtCallback("insanvision1""insanvision1"true); 

PHP Code: (Select All)
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.
03-12-2018, 10:25 PM
Find
TimProzz Offline
Junior Member

Posts: 23
Threads: 8
Joined: May 2016
Reputation: 0
#4
RE: Func Callback Type

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

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

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

Mod I'm working on: Illusions of the Dead 2
ModDB Illusions of the Dead 2
(This post was last modified: 03-13-2018, 10:48 AM by TimProzz.)
03-13-2018, 10:45 AM
Find
Verkehr Offline
Member

Posts: 60
Threads: 13
Joined: Oct 2016
Reputation: 1
#5
RE: Func Callback Type

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

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

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

Yeah, noticed it myself. It's fixed now, the script works.
03-13-2018, 12:21 PM
Find




Users browsing this thread: 1 Guest(s)