Frictional Games Forum (read-only)

Full Version: Nothing happens
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
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()
{
}
It should be a callback func, not an interaction func.

Here:

Code:
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, "");        
        }    
    }
}
(03-27-2012, 05:17 PM)ClayPigeon Wrote: [ -> ]It should be a callback func, not an interaction func.

Here:

Code:
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

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.
(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...


Yea.... made the script work but not the monster spawning business...
(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: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:
void Function(string &inint)
{


and the engine won't complain about missing parameter variables.
(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: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:
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


Pages: 1 2