Frictional Games Forum (read-only)
Entity Activate/Deactivate? - 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: Entity Activate/Deactivate? (/thread-21546.html)

Pages: 1 2


RE: Entity Activate/Deactivate? - Bonehead - 05-19-2013

Here's my entire script.

void OnStart()
{
SetEntityPlayerInteractCallback("key_tower_1", "ActivateMonster", true);
AddEntityCollideCallback("Player", "script_slam", "func_slam", true, 1);
SetEntityCallbackFunc("chemical_container_full_1", "OnPickup");
}


void OnEnter()
{

}

void OnLeave()
{
}

void ActivateMonster(string &in item)
{
SetEntityActive("servant_brute_1", true);
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_13", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_15", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_10", 0, "");
}

void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("door_2", true, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
}

void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("armour_nice_complete_8", true);
SetEntityActive("armour_nice_complete_7", true);
SetEntityActive("armour_nice_complete_6", false);
SetEntityActive("armour_nice_complete_5", false);
}


RE: Entity Activate/Deactivate? - Kullin - 05-19-2013

void OnStart()
{
SetEntityPlayerInteractCallback("key_tower_1", "ActivateMonster", true);
AddEntityCollideCallback("Player", "script_slam", "func_slam", true, 1);
SetEntityCallbackFunc("chemical_container_full_1", "OnPickup");
}


void OnEnter()
{

}

void OnLeave()
{
}

void ActivateMonster(string &in item)
{
SetEntityActive("servant_brute_1", true);
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_13", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_15", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_10", 0, "");
}

void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("door_2", true, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
}

void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("armour_nice_complete_8", true);
SetEntityActive("armour_nice_complete_7", true);
SetEntityActive("armour_nice_complete_6", false);
SetEntityActive("armour_nice_complete_5", false);
PlaySoundAtEntity("","impact_wood_heavy_low3.snt","armour_nice_complete_7", 0.1, true);
PlaySoundAtEntity("","impact_wood_heavy_low3.snt","armour_nice_complete_8", 0.1, true);
}

That should work with the sounds to.


RE: Entity Activate/Deactivate? - Bonehead - 05-19-2013

I'll give it a shot.

Didn't crash. no sound played though.


RE: Entity Activate/Deactivate? - PutraenusAlivius - 05-20-2013

Code:
void OnStart()
{
SetEntityPlayerInteractCallback("key_tower_1", "ActivateMonster", true);
AddEntityCollideCallback("Player", "script_slam", "func_slam", true, 1);
SetEntityCallbackFunc("chemical_container_full_1", "OnPickup");
}

void OnEnter()
{


}



void OnLeave()
{

}

void ActivateMonster(string &in asEntity) //You have the wrong callback syntax.
{

SetEntityActive("servant_brute_1", true);
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_13", 0.001f, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_15", 0.001f, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_4", 0.001f, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_10", 0.001f, "");
//I replaced 0 with 0.001f so that the monster won't stop at each PathNode.
}

void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("door_2", true, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare.snt", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
}

void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("armour_nice_complete_8", true);
SetEntityActive("armour_nice_complete_7", true);
SetEntityActive("armour_nice_complete_6", false);
SetEntityActive("armour_nice_complete_5", false);
PlaySoundAtEntity("","impact_wood_heavy_low.snt","armour_nice_complete_7", 0.1f, true);

PlaySoundAtEntity("","impact_wood_heavy_low.snt","armour_nice_complete_8", 0.1f, true);
}

Fixed.
Word of advice: When using sounds, at least check if they match or not.