Frictional Games Forum (read-only)
Making a breakable wall - 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: Making a breakable wall (/thread-17309.html)



Making a breakable wall - Soverain - 07-28-2012

Okay, so I am fairly new to this scripting and level editing stuff but I want to learn and make complex levels. If I understand correctly I need this line of script void SetPropHealth(string& asName, float afHealth); in order to have the wall to be broken. The wall I want is the "mansionbase_secret_passage_1" how would I go about making this wall get broken when an object is thrown at it?


Would it be SetPropHealth( Thenameofwall, (not sure what float means, is it the one with integers or decimals) and a number for health?


RE: Making a breakable wall - Your Computer - 07-28-2012

The wall itself is designed to break when an object is thrown at it. There's no need to script anything for it to break.


RE: Making a breakable wall - Adny - 07-28-2012

To do this, create a small script_area, size it the approximate size of the wall you want to break, then place it in front of the wall. The key to placing it is to do so in a way so that if an object (i.e. a barrel) is thrown at the wall, it will hit the script_area first; you do not want the script_area to be so far out as to break the wall at an unrealistic distance. After doing so, you can use this script, replacing all necessary information (i.e. the name of the item, function, script area and wall).

void OnStart()
{
AddEntityCollideCallback("NAME_OF_OBJECT", "NAME_OF_SCRIPT_AREA", "FUNC", true, 0);
}

void FUNC(string &in asParent, string &in asChild, int alState)
{
SetPropHealth("NAME_OF_WALL", 0.0f);
}

Hope that helped!


RE: Making a breakable wall - Soverain - 07-28-2012

Hmm...I'm not sure if my other scripts are messing it up but i get an error "," or ";" upon trying to load my map


////////////////////////////
// Run when entering map
void OnStart()
{
AddEntityCollideCallback("Player","start","monster",true,1);
AddEntityCollideCallback("grunt","stop","monsterend",true,1);

AddEntityCollideCallback("armor", "wallbreak", "FUNC", true, 0);
}

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

void FUNC(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("grunt",true);
AddEnemyPatrolNode("grunt","node",0,"");

SetPropHealth("breakwall", 0.0f);

}

void monsterend(string & asParent, string &in asChild, int alState)
{
SetEntityActive("grunt",false);


RE: Making a breakable wall - Adny - 07-28-2012

Things look a little jumbled up; I revised it:


////////////////////////////
// Run when entering map
void OnStart()
{
AddEntityCollideCallback("Player", "start", "monster", true, 1);
AddEntityCollideCallback("grunt", "stop", "monsterend", true, 1);
AddEntityCollideCallback("armor", "wallbreak", "FUNC", true, 0);
}

void monster(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("grunt", true);
AddEnemyPatrolNode("grunt", "node", 0, "");
}

void FUNC(string &in asParent, string &in asChild, int alState)
{
SetPropHealth("breakwall", 0.0f);
}

void monsterend(string & asParent, string &in asChild, int alState)
{
SetEntityActive("grunt", false);
}


RE: Making a breakable wall - Soverain - 07-28-2012

aha thank you, i got the script to work.