Frictional Games Forum (read-only)
Nothing happens - 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: Nothing happens (/thread-14287.html)

Pages: 1 2


Nothing happens - Saren - 03-27-2012

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()
{
}



RE: Nothing happens - ClayPigeon - 03-27-2012

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, "");        
        }    
    }
}



RE: Nothing happens - Saren - 03-27-2012

(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




RE: Nothing happens - SilentStriker - 03-27-2012

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.



RE: Nothing happens - ClayPigeon - 03-27-2012

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





RE: Nothing happens - Saren - 03-27-2012

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



RE: Nothing happens - ClayPigeon - 03-27-2012

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


RE: Nothing happens - Your Computer - 03-27-2012

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


RE: Nothing happens - Saren - 03-27-2012

(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





RE: Nothing happens - SilentStriker - 03-27-2012

(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