Frictional Games Forum (read-only)

Full Version: Small script help please.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I've been scripting for a while, and have no idea whats wrong. Am I a making a simple mistake here, and just over looking it because I am tired, or is there something wrong here? Here is my code, all areas, are named correctly.

Code:
void OnEnter ()
{
        AddEntityCollideCallback("Player", "DoorsScare", "HallwayScare", true, 1);
}
void HallwayScare(string &in asParent, string &in asChild, int alState)
{
        PlaySoundAtEntity("", "lurker_hit_Wood", "Player", 0, false);
        CreateParticleSystemAtEntity("", "ps_dust_impact", "DoorEffect1", false);    
        CreateParticleSystemAtEntity("", "ps_door_damage_wood", "DoorEffect1", false);
        CreateParticleSystemAtEntity("", "ps_dust_impact", "DoorEffect5", false);    
        CreateParticleSystemAtEntity("", "ps_door_damage_wood", "DoorEffect5", false);
        AddTimer("", 1, "Doors2");
}
void Doors2(string &in asTimer)
{
        PlaySoundAtEntity("", "lurker_hit_Wood", "Player", 0, false);
        CreateParticleSystemAtEntity("", "ps_dust_impact", "DoorEffect2", false);    
        CreateParticleSystemAtEntity("", "ps_door_damage_wood", "DoorEffect2", false);
        CreateParticleSystemAtEntity("", "ps_dust_impact", "DoorEffect6", false);
        CreateParticleSystemAtEntity("", "ps_door_damage_wood", "DoorEffect6", false);
        AddTimer("", 1, "Doors3");
}
void Doors3(string &in asTimer)
{
        PlaySoundAtEntity("", "lurker_hit_Wood", "Player", 0, false);
        CreateParticleSystemAtEntity("", "ps_dust_impact", "DoorEffect3", false);    
        CreateParticleSystemAtEntity("", "ps_door_damage_wood", "DoorEffect3", false);
        CreateParticleSystemAtEntity("", "ps_dust_impact", "DoorEffect7", false);
        CreateParticleSystemAtEntity("", "ps_door_damage_wood", "DoorEffect7", false);
}
void OnLeave ()
{
}
What is the error you are getting?
No error, the script just isn't triggering.
What is your map name, aswell as your .hps file name.
map08.map
map08.hps

NOTE: We also have a 2 maps named map08a and map08b, could that be interfering?
Are you in developer mode? If you are turn debug messages on and add this to the script:

AddDebugMessage("Itworks", true);
I just added it to the first part of the script (below the first timer) and I dont see anything changed. I havent ever used debug messages, so what do I do?

Here is the script:
Code:
void OnEnter ()
{
        AddEntityCollideCallback("Player", "DoorsScare", "HallwayScare", true, 1);
}
void HallwayScare(string &in asParent, string &in asChild, int alState)
{
        PlaySoundAtEntity("", "lurker_hit_Wood", "Player", 0, false);
        CreateParticleSystemAtEntity("", "ps_dust_impact", "DoorEffect1", false);    
        CreateParticleSystemAtEntity("", "ps_door_damage_wood", "DoorEffect1", false);
        CreateParticleSystemAtEntity("", "ps_dust_impact", "DoorEffect5", false);    
        CreateParticleSystemAtEntity("", "ps_door_damage_wood", "DoorEffect5", false);
        AddTimer("", 1, "Doors2");
        AddDebugMessage("Itworks", true);
}
void Doors2(string &in asTimer)
{
        PlaySoundAtEntity("", "lurker_hit_Wood", "Player", 0, false);
        CreateParticleSystemAtEntity("", "ps_dust_impact", "DoorEffect2", false);    
        CreateParticleSystemAtEntity("", "ps_door_damage_wood", "DoorEffect2", false);
        CreateParticleSystemAtEntity("", "ps_dust_impact", "DoorEffect6", false);
        CreateParticleSystemAtEntity("", "ps_door_damage_wood", "DoorEffect6", false);
        AddTimer("", 1, "Doors3");
}
void Doors3(string &in asTimer)
{
        PlaySoundAtEntity("", "lurker_hit_Wood", "Player", 0, false);
        CreateParticleSystemAtEntity("", "ps_dust_impact", "DoorEffect3", false);    
        CreateParticleSystemAtEntity("", "ps_door_damage_wood", "DoorEffect3", false);
        CreateParticleSystemAtEntity("", "ps_dust_impact", "DoorEffect7", false);
        CreateParticleSystemAtEntity("", "ps_door_damage_wood", "DoorEffect7", false);
}
void OnLeave ()
{
}
Are you in developer mode? It will come in as a message in the left corner, this means that the script is working; but the events you set up aren't. The only thing I can see wrong with the script is that you don't have a void

OnStart()
{

}

anywhere in the script. Maybe shifting AddEntityCollideCallback("Player", "DoorsScare", "HallwayScare", true, 1); into the void OnStart() block and delete the void OnEnter?
Flamez-
Sorry for wasting your time, for some reason I just restarted my Amnesia and it worked. Really sorry, not really sure what I was doing wrong but thanks for your help, and I will be giving you + feedback for your time. Thanks again, and have a good evening.
Never mind, wish I could delete posts Tongue