Frictional Games Forum (read-only)

Full Version: Static objects disappear / enemy deactivate
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
-When I playe for example walls in the level editor, sometimes when I save and play then the custom map, the walls are just not there, but the new door is there, so its something about the static objects. What should I do?

(I've replaced them etc.)

_____________________________________________________________

-I want that the enemy (servant_grunt_1) deactivates when I touch ScriptArea_10, how dies the script look like then? Can someone "write" it?

Cause THAT DOESN'T WORK:

Quote:void OnStart()
{
AddUseItemCallback("", "key_torture_chamber_1", "castle_arched01_1", "UsedKeyOnDoor", true);
AddEntityCollideCallback("Player", "ScriptArea_1", "schweine", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_2", "schweinehang", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_3", "klang", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_4", "staub", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_5", "engel", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_6", "falle", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_7", "enemyklang", true, 1);
AddEntityCollideCallback("Player" , "ScriptArea_8" , "wegpunkte" , true , 1);
AddEntityCollideCallback("Player", "ScriptArea_9", "klang2", true, 1);
AddUseItemCallback("", "key_torture_chamber_2", "mansion_1", "UsedKeyOnDoor2", true);
AddEntityCollideCallback("Player", "ScriptArea_10", "deaktivierung", true, 1);
}





void deaktivierung(string &in asItem, string &in asEntity)

{
SetEnemyDisabled("servant_grunt_1", true);

}









void UsedKeyOnDoor2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, false);
PlaySoundAtEntity("", "unlock_door.snt", "mansion_1", 0, false);
RemoveItem("key_torture_chamber_2");
AddDebugMessage("KeyOnDoor", false);
}









void klang2(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "scare_human_noices.snt", "Player", 0, false);



}









void wegpunkte(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_9", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_10", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_11", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_12", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_13", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_14", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_15", 0, "Idle");
}












void enemyklang(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "amb_idle_scratch.snt", "Player", 0, false);



}








void falle(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "lurker_hit_wood.snt", "Player", 0, false);
SetEntityActive("armour_nice_complete_1", true);
SetEntityActive("armour_nice_complete_2", true);


}



void engel(string &in asParent, string &in asChild, int alState)
{
StartPlayerLookAt("angel_statue_1", 15, 15, "");
PlaySoundAtEntity("", "react_sigh.snt", "Player", 0, false);
SetEntityActive("angel_statue_1", true);
GiveSanityDamage(2.0f, true);
AddTimer("opala",0.2f,"EnemyTimer");
CreateParticleSystemAtEntity("E1PS", "ps_ghost_release.pss", "particlearea4", true);

}











void staub(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "28_done03.snt", "Player", 0, false);
SetEntityActive("ParticleSystem_17", true);
SetEntityActive("ParticleSystem_19", true);
CreateParticleSystemAtEntity("E1PS", "ps_debris_tunnel.ps", "particlearea", true);
CreateParticleSystemAtEntity("E1PS", "ps_debris_tunnel.ps", "particlearea2", true);

}









void klang(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "scare_baby_cry.snt", "Player", 0, false);

}











void schweinehang(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
SetEntityActive("pig_corpse_hanging_1", true);
SetEntityActive("pig_corpse_hanging_2", true);
SetEntityActive("carcass_1", true);
SetEntityActive("carcass_2", true);
SetEntityActive("pig_corpse_hanging_3", true);
SetEntityActive("pig_corpse_hanging_4", true);
SetEntityActive("pig_corpse_hanging_5", true);
SetEntityActive("pig_corpse_hanging_6", true);
SetEntityActive("carcass_3", true);
CreateParticleSystemAtEntity("E1PS", "ps_cloud_thing01.ps", "particlearea3", true);

}




void schweine(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "scare_animal_squeal.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
SetEntityActive("pig_corpse_26", true);
SetEntityActive("pig_corpse_27", true);
SetEntityActive("pig_corpse_28", true);
SetEntityActive("pig_corpse_29", true);
}










void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("castle_arched01_1", false, false);
PlaySoundAtEntity("", "unlock_door.snt", "castle_arched01_1", 0, false);
RemoveItem("key_torture_chamber_1");
AddDebugMessage("KeyOnDoor", false);
}




////Timers
void EnemyTimer(string &in asTimer)

{

if(asTimer == "opala")
{
StopPlayerLookAt();
AddTimer("Scare2",30.5f,"EnemyTimer");
}
}


Its hard for me with the script thing, cause I rarely understand english and script language even less.

Thx for helping!
If there are map_cache in yuor maps folder, delete 'em. For the monster, do this (your script fixed):

Code:
void OnStart()

{

AddUseItemCallback("", "key_torture_chamber_1", "castle_arched01_1", "UsedKeyOnDoor", true);

AddEntityCollideCallback("Player", "ScriptArea_1", "schweine", true, 1);

AddEntityCollideCallback("Player", "ScriptArea_2", "schweinehang", true, 1);

AddEntityCollideCallback("Player", "ScriptArea_3", "klang", true, 1);

AddEntityCollideCallback("Player", "ScriptArea_4", "staub", true, 1);

AddEntityCollideCallback("Player", "ScriptArea_5", "engel", true, 1);

AddEntityCollideCallback("Player", "ScriptArea_6", "falle", true, 1);

AddEntityCollideCallback("Player", "ScriptArea_7", "enemyklang", true, 1);

AddEntityCollideCallback("Player" , "ScriptArea_8" , "wegpunkte" , true , 1);

AddEntityCollideCallback("Player", "ScriptArea_9", "klang2", true, 1);

AddUseItemCallback("", "key_torture_chamber_2", "mansion_1", "UsedKeyOnDoor2", true);

AddEntityCollideCallback("Player", "ScriptArea_10", "deaktivierung", true, 1);

}











void deaktivierung(string &in asItem, string &in asEntity)



{

SetEntityActive("servant_grunt_1", false);



}

















void UsedKeyOnDoor2(string &in asItem, string &in asEntity)

{

    SetSwingDoorLocked("mansion_1", false, false);

    PlaySoundAtEntity("", "unlock_door.snt", "mansion_1", 0, false);

    RemoveItem("key_torture_chamber_2");

    AddDebugMessage("KeyOnDoor", false);

}



















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

{

    PlaySoundAtEntity("", "scare_human_noices.snt", "Player", 0, false);

    

    



}



















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

{

    SetEntityActive("servant_grunt_1", true);

    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 0, "Idle");

    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "Idle");

    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, "Idle");

    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "Idle");

    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, "Idle");

    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, "Idle");

    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0, "Idle");

    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0, "Idle");

    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_9", 0, "Idle");

    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_10", 0, "Idle");

    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_11", 0, "Idle");

    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_12", 0, "Idle");

    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_13", 0, "Idle");

    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_14", 0, "Idle");

    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_15", 0, "Idle");

}

























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

{

    PlaySoundAtEntity("", "amb_idle_scratch.snt", "Player", 0, false);

    

    



}

















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

{

    PlaySoundAtEntity("", "lurker_hit_wood.snt", "Player", 0, false);

    SetEntityActive("armour_nice_complete_1", true);

    SetEntityActive("armour_nice_complete_2", true);

    



}







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

{

    StartPlayerLookAt("angel_statue_1", 15, 15, "");

    PlaySoundAtEntity("", "react_sigh.snt", "Player", 0, false);

    SetEntityActive("angel_statue_1", true);

    GiveSanityDamage(2.0f, true);

    AddTimer("opala",0.2f,"EnemyTimer");

    CreateParticleSystemAtEntity("E1PS", "ps_ghost_release.pss", "particlearea4", true);



}























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

{

    PlaySoundAtEntity("", "28_done03.snt", "Player", 0, false);

    SetEntityActive("ParticleSystem_17", true);

    SetEntityActive("ParticleSystem_19", true);

    CreateParticleSystemAtEntity("E1PS", "ps_debris_tunnel.ps", "particlearea", true);

    CreateParticleSystemAtEntity("E1PS", "ps_debris_tunnel.ps", "particlearea2", true);



}



















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

{

    PlaySoundAtEntity("", "scare_baby_cry.snt", "Player", 0, false);

    

}























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

{

    PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);

    GiveSanityDamage(5.0f, true);

    SetEntityActive("pig_corpse_hanging_1", true);

    SetEntityActive("pig_corpse_hanging_2", true);

    SetEntityActive("carcass_1", true);

    SetEntityActive("carcass_2", true);

    SetEntityActive("pig_corpse_hanging_3", true);

    SetEntityActive("pig_corpse_hanging_4", true);

    SetEntityActive("pig_corpse_hanging_5", true);

    SetEntityActive("pig_corpse_hanging_6", true);

    SetEntityActive("carcass_3", true);

    CreateParticleSystemAtEntity("E1PS", "ps_cloud_thing01.ps", "particlearea3", true);



}









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

{

    PlaySoundAtEntity("", "scare_animal_squeal.snt", "Player", 0, false);

    GiveSanityDamage(5.0f, true);

    SetEntityActive("pig_corpse_26", true);

    SetEntityActive("pig_corpse_27", true);

    SetEntityActive("pig_corpse_28", true);

    SetEntityActive("pig_corpse_29", true);

}





















void UsedKeyOnDoor(string &in asItem, string &in asEntity)

{

SetSwingDoorLocked("castle_arched01_1", false, false);

PlaySoundAtEntity("", "unlock_door.snt", "castle_arched01_1", 0, false);

RemoveItem("key_torture_chamber_1");

AddDebugMessage("KeyOnDoor", false);

}









////Timers

void EnemyTimer(string &in asTimer)



{



if(asTimer == "opala")

{

    StopPlayerLookAt();

   AddTimer("Scare2",30.5f,"EnemyTimer");

}

}
Thank you for the static objects thing, now it works.

But that with the enemy. I have no error when I start the map, but the grunt is still there although I pass the script area. what did I wrong?


Quote:void OnStart()
{
AddUseItemCallback("", "key_torture_chamber_1", "castle_arched01_1", "UsedKeyOnDoor", true);
AddEntityCollideCallback("Player", "ScriptArea_1", "schweine", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_2", "schweinehang", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_3", "klang", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_4", "staub", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_5", "engel", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_6", "falle", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_7", "enemyklang", true, 1);
AddEntityCollideCallback("Player" , "ScriptArea_8" , "wegpunkte" , true , 1);
AddEntityCollideCallback("Player", "ScriptArea_9", "klang2", true, 1);
AddUseItemCallback("", "key_torture_chamber_2", "mansion_1", "UsedKeyOnDoor2", true);
AddEntityCollideCallback("Player", "ScriptArea_10", "deaktivierung", true, 1);
}





void deaktivierung(string &in asItem, string &in asEntity)

{
SetEntityActive("servant_grunt_1", false);

}




....
Quote:void AddEntityCollideCallback(string& asParentName, string& asChildName, string& asFunction, bool abDeleteOnCollide, int alStates);

Calls a function when two entites collide.
Callback syntax: void MyFunc(string &in asParent, string &in asChild, int alState)

try
Code:
void deaktivierung(string &in asParent, string &in asChild, int alState)
instead of
Code:
void deaktivierung(string &in asItem, string &in asEntity)

deaktivierung(string &in asItem, string &in asEntity) would be the callback if you use an item on an entity
Thank you so much guys. Finally it works with darkskys help.



May I ask you to add you in steam? It seems that you are an expert in scripting Tongue If I have another question I can ask there and dont have to spam the form. My name is
Quote:Click