Frictional Games Forum (read-only)
Collision not working - 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 (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Collision not working (/thread-5758.html)



Collision not working - nerdboyxxx - 12-16-2010

Hello again,

I've set it so that when the Player collides with an Area, it slams open the door and a monster runs past the door. However my Player fails to collide at all with the area and I cannot work out why.

The script for the level is below.

Code:
//=========================

void OnStart()

{
     SetPlayerActive(true);
     FadeOut(0);
     AddEntityCollideCallback("Player", "doorswingopen", "Door_Swing", true, 0);
     AddTimer("FadeBack", 3.5f, "Fade_Back");
     FadeIn(2);
     PlayMusic("asylum_main", true, 0.5f, 2.0f, 0, true);
}

void Door_Swing(string &in asParent, string &in asChild, string &in alState)

{
     AddDebugMessage("Music stops and door opens suddenly, monster runs past.", true);
     StopMusic(1.5f, 0);
     AddTimer("InfectedSpawn", 2.5f, "Infected_Spawn");    
{
     if(GetSwingDoorClosed("prisondoor_open") == true)
     AddTimer("prisondoor_open", 0.2f, "TimerCreakDoor");

}

}

void TimerCreakDoor(string &in asTimer)

{
     AddPropForce("prisondoor_open", 0, 0, 5, "World");
}

void Infected_Spawn(string &in asTimer)

{
     AddDebugMessage("monster spawns and runs past, disappears shortly after", true);
     SetEntityActive("Infected1", true);
     AddEnemyPatrolNode("Infected1", "infected_patrol_1", 0.0f, "character_infected_run.anm");
     AddEnemyPatrolNode("Infected1", "infected_patrol_2", 1.5f, "character_infected_run.anm");
     FadeEnemyToSmoke("Infected1", true);
     ClearEnemyPatrolNodes("Infected1");
}

//=========================

void OnEnter()

{

}

//=========================

void OnLeave()

{

}

If anyone could help me out I would really appreciate it Smile.


RE: Collision not working - Luis - 12-16-2010

Bad type for parameter alState, should be an int.

Code:
void Door_Swing(string &in asParent, string &in asChild, string &in alState)

===>

void Door_Swing(string &in asParent, string &in asChild, int alState)



RE: Collision not working - nerdboyxxx - 12-16-2010

(12-16-2010, 10:35 AM)Luis Wrote: Bad type for parameter alState, should be an int.

Code:
void Door_Swing(string &in asParent, string &in asChild, string &in alState)

===>

void Door_Swing(string &in asParent, string &in asChild, int alState)

Thank you very much, that fixed up all my problems Smile