Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Making a breakable wall
Soverain Offline
Junior Member

Posts: 18
Threads: 5
Joined: Jul 2012
Reputation: 1
#1
Making a breakable wall

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?
(This post was last modified: 07-29-2012, 12:38 AM by Soverain.)
07-28-2012, 06:48 AM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#2
RE: Making a breakable wall

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.

Tutorials: From Noob to Pro
07-28-2012, 07:01 AM
Website Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#3
RE: Making a breakable wall

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!

I rate it 3 memes.
07-28-2012, 07:02 AM
Find
Soverain Offline
Junior Member

Posts: 18
Threads: 5
Joined: Jul 2012
Reputation: 1
#4
RE: Making a breakable wall

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);
07-28-2012, 07:26 AM
Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#5
RE: Making a breakable wall

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);
}

I rate it 3 memes.
07-28-2012, 07:29 AM
Find
Soverain Offline
Junior Member

Posts: 18
Threads: 5
Joined: Jul 2012
Reputation: 1
#6
RE: Making a breakable wall

aha thank you, i got the script to work.
07-28-2012, 07:35 AM
Find




Users browsing this thread: 2 Guest(s)