Frictional Games Forum (read-only)
Chair is flying past the player [Script help] - 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: Chair is flying past the player [Script help] (/thread-10511.html)



Chair is flying past the player [Script help] - Gamemakingdude - 09-29-2011

Hi, i am trying to make an event where an rather large chair flies past the chair and hits a door with an brute behind it. I have the chair the script area in the game but for some reason i dont know if its triggering the scripted area or making the chair move or fly. Here is my hpl code for the map.

PHP Code:
[code]////////////////////////////
// Run first time starting map
void OnStart()
{
    
//Add the Lantern and 10 Tinderboxes when in Debug mode, always good to have light!
    
if(ScriptDebugOn())
    {
        
GiveItemFromFile("lantern""lantern.ent");
 
        for(
int i=0;i<10;i++) GiveItemFromFile("tinderbox_"+i"tinderbox.ent");
    }
    
    
SetEntityPlayerInteractCallback("Key_1""HammerScare"true);
    
AddUseItemCallback("""Key_1""mansion_1""UsedKeyOnDoor"true);
    
AddEntityCollideCallback("Player","script_chairscare","ChairScare"false1);
    for (
int x 123x++) {
        
AddEnemyPatrolNode("servant_grunt_1""PathNodeArea_"+x0"");
        }
    
AddEntityCollideCallback("servant_grunt_1""ScriptArea_1""Reverse"false1);
}

void Reverse() {
    for (
int x 231x--) {
        
AddEnemyPatrolNode("servant_grunt_1""PathNodeArea_"+x0"");
        }
}
void UsedKeyOnDoor(string &in asItemstring &in asEntity)
{
    
SetSwingDoorLocked(asEntity,false,true);
    
PlaySoundAtEntity("","unlock_door"asEntity0false);
    
RemoveItem(asItem);
}

void HammerScare(string &in entitystring &in type)
{
  
AddPropForce("sledge_1"990000"world");
}

void ChairScare(string &in entitystring &in type)
{
  
SetEntityActive("chairscare",true);
  
AddPropImpulse("chairscare"00, -9990"world");
}
////////////////////////////
// Run when entering map
void OnEnter()
{
 
}
 
////////////////////////////
// Run when leaving map
void OnLeave()
{
 

[/code]

I hope i get a reply as soon as possible. Mean while ill continue with the rest of my map, with the anticipation that people will be scared shitless. Big Grin
Let me fix the code up.


RE: Chair is flying past the player [Script help] - Kyle - 09-29-2011

Change this:

ChairScare(string &in entity, string &in type)

To this:

ChairScare(string &in asParent, string &in asChild, int alState)

It should be like that because the callback was the type of collide callback.



RE: Chair is flying past the player [Script help] - Gamemakingdude - 09-29-2011

Perfect it works great thanks!