PDA

View Full Version : Script inside of config.cpp



wass24
Dec 20 2005, 15:34
How do you put a script in to the config file for an object? I have a sidewalk that turns sideways if something explodes on top of it and I want to give it a script that tells it to setdamage to 0 if damage is greater then 0. Can EventHandlers do this? I have never used them.

LoTekK
Dec 20 2005, 15:44
If it's turning sideways, you most likely have it subclassed incorrectly (it's probably something like "fence" or something along those lines). Might want to try a search; I know I've seen at least a couple of topics on these forums that cover this issue.

wass24
Dec 20 2005, 15:52
Honestly, I really don't know what to class my different object addons as. I usually just copy 99% of the config from another addon I did.

Is there a list of classes anywhere that would help me?
What class would someone use for a roadway?

hardrock
Dec 20 2005, 16:53
What you're searching for is not a script, but the config property
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">destrType=DestructNo;[/QUOTE]

It&#39;s the same on the churches, the object simply isn&#39;t deformed when destructed.

wass24
Dec 20 2005, 17:27
Here is my config file for my sidewalk. I know the classes are probably wrong for a sidewalk, but what should they be.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class CfgPatches
{
class sidewalk
{
units&#91;&#93; = {sidewalk};
weapons&#91;&#93; = {};
requiredVersion = 1.0;
};
};
class CfgVehicles
{
class All {};
class Static&#58; All {};
class Building&#58; Static {};
class NonStrategic&#58; Building {};
class TargetTraining&#58; NonStrategic {};
class TargetGrenade&#58; TargetTraining {};

class sidewalk&#58; TargetGrenade
{
model=&#34;&#92;sidewalk&#92;sidewalk&#34;;
destrType=DestructNo;
armor=20000;
scope=2;
displayName=&#34;sidewalk&#34;;
}[/QUOTE]

hardrock
Dec 20 2005, 17:30
It may be enough if you inherit from NonStrategic. If there are properties missing then, look in the original config.cpp (http://www.flashpoint1985.com/breathe) for the values of the classes directly inherited from NonStrategic.

wass24
Dec 20 2005, 19:10
I have gotten my sidewalk to not take damage, but now it stops vehicle traffic. I want to be able to drive on it. I pasted my config below.
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class CfgSurfaces
{
class Roadway {};
class Asfalt&#58; Roadway {};

class Sidewalk &#58; Asfalt
{
access = ReadOnly;
files=&#34;&#92;sidewalk&#92;sidewalk&#34;;
destrType=0;
rough=0.005;
dust=0.1;
soundEnviron = road;
armor=20000;
scope=2;
displayName=&#34;sidewalk&#34;;
}[/QUOTE]