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
Nothing happens
Saren Offline
Member

Posts: 196
Threads: 20
Joined: Jan 2012
Reputation: 1
#1
Nothing happens

Hey guys, so I wanted to try out the script where you pick up an item and a monster spawns.... yet it don't work even though I watched Your Computers tut on it... here's da script:
void OnStart()
{
SetEntityPlayerInteractCallback("Upperfloorkey", "ActivateMonster", true);
}


//Spawn Infected
void ActivateMonster(string &in item)
{
SetEntityActive("character_infected_1", true);
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_8", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_9", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_10", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_11", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_12", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_13", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_14", 0, "");
}
void Despawncharacter_infected_1(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("character_infected_1", false);
}

void OnLeave()
{
}

03-27-2012, 05:04 PM
Find
ClayPigeon Offline
Member

Posts: 214
Threads: 13
Joined: Mar 2012
Reputation: 8
#2
RE: Nothing happens

It should be a callback func, not an interaction func.

Here:

void OnStart()
{    
    SetEntityCallbackFunc("Upperfloorkey", "ActivateMonster");
}

void ActivateMonster(string &in asEntity, string &in type)
{    
    if(type == "OnPickup")    
    {        
        SetEntityActive("character_infected_1", true);        
        for(int i = 1; i < 15; i++)        
        {            
            AddEnemyPatrolNode("character_infected_1", "PathNodeArea_"+i", 0, "");        
        }    
    }
}
(This post was last modified: 03-27-2012, 05:19 PM by ClayPigeon.)
03-27-2012, 05:17 PM
Find
Saren Offline
Member

Posts: 196
Threads: 20
Joined: Jan 2012
Reputation: 1
#3
RE: Nothing happens

(03-27-2012, 05:17 PM)ClayPigeon Wrote: It should be a callback func, not an interaction func.

Here:

void OnStart()
{    
    SetEntityCallbackFunc("Upperfloorkey", "ActivateMonster");
}

void ActivateMonster(string &in asEntity, string &in type)
{    
    if(type == "OnPickup")    
    {        
        SetEntityActive("character_infected_1", true);        
        for(int i = 1; i < 15; i++)        
        {            
            AddEnemyPatrolNode("character_infected_1", "PathNodeArea_"+i", 0, "");        
        }    
    }
}
Thx man, Ima try that
EDIT: (1.1) No matching signatures to void OnEnter()
(30.1) unexpected end of file


(This post was last modified: 03-27-2012, 06:17 PM by Saren.)
03-27-2012, 06:06 PM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#4
RE: Nothing happens

It should actually work with the interactcallback but try Claypigeon's code

I found what's wrong with your code

it's (string &in item)

it's supposed to be (string &in asEntity)

and the despawn_character_infected doesn't go anywhere nothing calls that function.

(This post was last modified: 03-27-2012, 06:09 PM by SilentStriker.)
03-27-2012, 06:07 PM
Find
ClayPigeon Offline
Member

Posts: 214
Threads: 13
Joined: Mar 2012
Reputation: 8
#5
RE: Nothing happens

(03-27-2012, 06:07 PM)SilentStriker Wrote: It should actually work with the interactcallback but try Claypigeon's code

I found what's wrong with your code

it's (string &in item)

it's supposed to be (string &in asEntity)

and the despawn_character_infected doesn't go anywhere nothing calls that function.
I noticed that also but anyway I think PickUp will be a better way, but whatever floats your boat...


03-27-2012, 06:22 PM
Find
Saren Offline
Member

Posts: 196
Threads: 20
Joined: Jan 2012
Reputation: 1
#6
RE: Nothing happens

Yea.... made the script work but not the monster spawning business...

03-27-2012, 06:41 PM
Find
ClayPigeon Offline
Member

Posts: 214
Threads: 13
Joined: Mar 2012
Reputation: 8
#7
RE: Nothing happens

(03-27-2012, 06:41 PM)Saren Wrote: Yea.... made the script work but not the monster spawning business...
Isn't the spawning business all the script? What works besides it?
03-27-2012, 06:48 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#8
RE: Nothing happens

(03-27-2012, 06:07 PM)SilentStriker Wrote: I found what's wrong with your code

it's (string &in item)

it's supposed to be (string &in asEntity)

Parameter names are irrelevant. You could have something like this:

PHP Code: (Select All)
void Function(string &inint)
{


and the engine won't complain about missing parameter variables.

Tutorials: From Noob to Pro
(This post was last modified: 03-27-2012, 06:52 PM by Your Computer.)
03-27-2012, 06:52 PM
Website Find
Saren Offline
Member

Posts: 196
Threads: 20
Joined: Jan 2012
Reputation: 1
#9
RE: Nothing happens

(03-27-2012, 06:48 PM)ClayPigeon Wrote:
(03-27-2012, 06:41 PM)Saren Wrote: Yea.... made the script work but not the monster spawning business...
Isn't the spawning business all the script? What works besides it?
Well the key works and stuff, and there's no FATAL ERROR.... the monster just don't spawn



03-27-2012, 06:54 PM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#10
RE: Nothing happens

(03-27-2012, 06:52 PM)Your Computer Wrote:
(03-27-2012, 06:07 PM)SilentStriker Wrote: I found what's wrong with your code

it's (string &in item)

it's supposed to be (string &in asEntity)

Parameter names are irrelevant. You could have something like this:

PHP Code: (Select All)
void Function(string &inint)
{


and the engine won't complain about missing parameter variables.
Cool I just learn't something new Smile So when ever you use a callback you just write (string &in, int) and it should work? Smile



03-27-2012, 07:13 PM
Find




Users browsing this thread: 1 Guest(s)