Teraz jest Pt 29 mar, 2024 03:59


config.cpp do Su-25

Archiwum działów sekcji Operation Flashpoint
  • Autor
  • Wiadomość
Offline

gazownick

Szeregowy

Szeregowy

  • Posty: 12
  • Dołączył(a): Pn 31 lip, 2006 11:40

config.cpp do Su-25

PostSo 09 paź, 2010 23:01

Witam,

Chciałem zmienić reloadTime dla działka w Su-25, rozpakowałem więc .pbo i zacząłem edytować config. cpp. Kiedy skończyłem wyglądało to tak:


// some basic defines
#define TEast 0
#define TWest 1
#define TGuerrila 2
#define TCivilian 3
#define TSideUnknown 4
#define TEnemy 5
#define TFriendly 6
#define TLogic 7

#define true 1
#define false 0

// type scope
#define private 0
#define protected 1
#define public 2

class CfgPatches
{
class Su25
{
units[] = {Su25};
weapons[] = {};
requiredVersion = 1.07;
};
};

class CfgAmmo
{
class Default {};
class AT3: Default {};
class Hellfire: AT3 {};
class Maverick: Hellfire {};
class Ch29T : Maverick
{
model = \Su25\Ch_29T_shine;
};
};

class CfgWeapons
{
class Default {};
class LAWLauncher: Default {};
class CarlGustavLauncher : LAWLauncher {};
class AT3Launcher: CarlGustavLauncher {};
class HellfireLauncher: AT3Launcher {};
class MaverickLauncher: HellfireLauncher {};
class Ch29TLauncher: MaverickLauncher
{
ammo=Ch29T;
displayName=$STR_DN_CH29T;
displayNameMagazine=$STR_MN_CH29T;
shortNameMagazine=$STR_SN_CH29T;
count=6;
};

};


{
class Default{}
class MGun: Default{};
class MachineGun7_6: MGun{};
class MachineGun30 : MachineGun7_6 {};
class MachineGun30A10: MachineGun30 {};
class GsH302: MachineGun30A10

{
reloadtime=0.001
autofire = true
};
};


class CfgVehicles
{
class All {};
class AllVehicles: All {};
class Air: AllVehicles {};
class Plane: Air {};

class Su25: Plane
{
scope=public;
crew = SoldierEPilot;
picture=\su25\isu25;

side=TEast;
displayName=$STR_DN_SU25;
accuracy=0.30;

driverAction = ManActA10Pilot;

maxSpeed = 800;

armor=24;
cost=20000000;
model="\su25\su25";
weapons[]={Ch29TLauncher, Rocket57x64, GsH302};
magazines[]={Ch29TLauncher, Rocket57x64, MachineGun30A10};
fov=0.5;

type=VAir;
//threat[] VSoft, VArmor, VAir
threat[]={0.1, 1, 0.7};

class Reflectors
{
class Reflector
{
color[] = {0.9, 0.8, 0.8, 1.0};
ambient[] = {0.1, 0.1, 0.1, 1.0};
position = "L svetlo";
direction = "konec L svetla";
hitpoint = "L svetlo";
selection = "L svetlo";
size = 0.5;
brightness = 0.25;
};
};

class IndicatorAltRadar
{
// max for this indicator is 1000 feet (i.e. 304m)
// note: this is actualy Baro altitude (name is

wrong)
selection = "alt";
axis = "osa_alt";
angle = -340;
min = 0;
max = 1000;
};
class IndicatorAltRadar2
{
// max for this indicator is 1000 feet (i.e. 304m)
// note: this is actualy Baro altitude (name is

wrong)
selection = "alt2";
axis = "osa_alt2";
angle = -340;
min = 0;
max = 1000;
};
class IndicatorSpeed
{
selection = "mph";
axis = "osa_mph";
angle = -350;
min = 0;
max = 1000 / 3.6;
};
class IndicatorVertSpeed
{
selection = "vert_speed";
axis = "osa_vert_speed";
angle = -240;
min = -150;
max = 150;
};
class IndicatorVertSpeed2
{
selection = "vert_speed2";
axis = "osa_vert_speed2";
angle = -240;
min = -150;
max = 150;
};
};
};

class CfgNonAIVehicles
{
class ProxyWeapon {};
class ProxyCh_29T : ProxyWeapon {model = \Su25\Ch_29T; simulation =

"maverickweapon";}
};




Problem jest taki, że zrobiłem coś źle w class CfgWeapons-i po spakowaniu .pbo z powrotem przy odpalaniu OFP zwraca mi taki oto błąd (odnoszący się do cfgweapons):

'}' encountered instead of '='

Podejrzewam że zrobiłem coś źle ze składnią polecenia, ale co?

Pomóżcie proszę.
Szatan Szatan Szatan Szatan ol jeee....
Offline
Avatar użytkownika

Maverick

Generał

Generał

  • Posty: 772
  • Dołączył(a): Pn 30 kwi, 2007 12:12
  • Lokalizacja: Kutno

PostSo 09 paź, 2010 23:09

Kod: Zaznacz cały
{
reloadtime=0.001
autofire = true
};

Nie powinno być średnika po 0.001 ?
Obrazek
Obrazek


"Read about the history of the place that we live in and stop letting corporate news tell lies to your children." - Immortal Technique
Offline
Avatar użytkownika

madmax

Szeregowy

Szeregowy

  • Posty: 42
  • Dołączył(a): N 04 paź, 2009 18:37

PostN 10 paź, 2010 08:46

Co zrobiłeś źle?

Troche się znam na składni C++. A to jest bardzo podobne do tej składni.
Każda klasa (i nie tylko) ma dwa nawiasy {}:

class myclass
{ // klamra otwierająca kod klasy

}; // klamra zamykająca kod klasy


a najlepiej pisac to tak:

class myclass1
{

/* spacje */ class myclass2
/* spacje */ {
/* spacje */ /* spacje */ recoil = 0.02;
/* spacje */ };


/* spacje */ reload = 0.5;
};


a nie tak:

class myclass1
{
class myclass2
recoil = 0.02;
};
reload = 0.5;
};
};


Widać teraz , że w pierwszym przypadku klamry są po dwie dla kazdej struktury.
A w drugim przypadku ciężko coś zauważyć. Tak samo jest z tym configiem.
weż sobie w edytorze wszystko ładnie pogrupuj i błąd ci wyjdzie, a jest.
Kłania się styl pisania kodu - bardzo ważna rzecz :cisza:
Ostatnio edytowano N 10 paź, 2010 09:19 przez madmax, łącznie edytowano 1 raz
hmm....
Offline
Avatar użytkownika

madmax

Szeregowy

Szeregowy

  • Posty: 42
  • Dołączył(a): N 04 paź, 2009 18:37

PostN 10 paź, 2010 09:07

teraz powinno byc dobrze:

// some basic defines
#define TEast 0
#define TWest 1
#define TGuerrila 2
#define TCivilian 3
#define TSideUnknown 4
#define TEnemy 5
#define TFriendly 6
#define TLogic 7

#define true 1
#define false 0

// type scope
#define private 0
#define protected 1
#define public 2

class CfgPatches
{
class Su25
{
units[] = {Su25};
weapons[] = {};
requiredVersion = 1.07;
};
};


class CfgAmmo
{
class Default {};
class AT3: Default {};
class Hellfire: AT3 {};
class Maverick: Hellfire {};
class Ch29T : Maverick
{
model = \Su25\Ch_29T_shine;
};
};


class CfgWeapons
{
class Default {};
class LAWLauncher: Default {};
class CarlGustavLauncher : LAWLauncher {};
class AT3Launcher: CarlGustavLauncher {};
class HellfireLauncher: AT3Launcher {};
class MaverickLauncher: HellfireLauncher {};
class Ch29TLauncher: MaverickLauncher
{
ammo=Ch29T;
displayName=$STR_DN_CH29T;
displayNameMagazine=$STR_MN_CH29T;
shortNameMagazine=$STR_SN_CH29T;
count=6;
};
};


// ************** tu czegoś brakowało
// powinno być class cfgWeapons
class cfgWeapons
{
class Default{}
class MGun: Default{};
class MachineGun7_6: MGun{};
class MachineGun30 : MachineGun7_6 {};
class MachineGun30A10: MachineGun30 {};
class GsH302: MachineGun30A10
{
reloadtime=0.001
autofire = true
};
};


class CfgVehicles
{
class All {};
class AllVehicles: All {};
class Air: AllVehicles {};
class Plane: Air {};

class Su25: Plane
{
scope=public;
crew = SoldierEPilot;
picture=\su25\isu25;
side=TEast;
displayName=$STR_DN_SU25;
accuracy=0.30;
driverAction = ManActA10Pilot;
maxSpeed = 800;
armor=24;
cost=20000000;
model="\su25\su25";
weapons[]={Ch29TLauncher, Rocket57x64, GsH302};
magazines[]={Ch29TLauncher, Rocket57x64, MachineGun30A10};
fov=0.5;
type=VAir;
//threat[] VSoft, VArmor, VAir
threat[]={0.1, 1, 0.7};

class Reflectors
{
class Reflector
{
color[] = {0.9, 0.8, 0.8, 1.0};
ambient[] = {0.1, 0.1, 0.1, 1.0};
position = "L svetlo";
direction = "konec L svetla";
hitpoint = "L svetlo";
selection = "L svetlo";
size = 0.5;
brightness = 0.25;
};
};


class IndicatorAltRadar
{
// max for this indicator is 1000 feet (i.e. 304m)
// note: this is actualy Baro altitude (name is wrong)
selection = "alt";
axis = "osa_alt";
angle = -340;
min = 0;
max = 1000;
};


class IndicatorAltRadar2
{
// max for this indicator is 1000 feet (i.e. 304m)
// note: this is actualy Baro altitude (name is wrong)
selection = "alt2";
axis = "osa_alt2";
angle = -340;
min = 0;
max = 1000;
};


class IndicatorSpeed
{
selection = "mph";
axis = "osa_mph";
angle = -350;
min = 0;
max = 1000 / 3.6;
};


class IndicatorVertSpeed
{
selection = "vert_speed";
axis = "osa_vert_speed";
angle = -240;
min = -150;
max = 150;
};


class IndicatorVertSpeed2
{
selection = "vert_speed2";
axis = "osa_vert_speed2";
angle = -240;
min = -150;
max = 150;
};
};
};


class CfgNonAIVehicles
{
class ProxyWeapon {};
class ProxyCh_29T : ProxyWeapon
{
model = \Su25\Ch_29T;
simulation = "maverickweapon";
};
};


A jeszcze w ramach nauki dla co niektórych:

jeśli jest napisane:

class myclass : ATLauncher {};

to oznacza, że nowo definiowana klasa 'myclass' dziedziczy wszystkie pola i metody (funkcje, procedury) po klasie ATLauncher - to są podstawy języka C++ zorientowanego obiektowo, bez tej wiedzy, cięzko będzie cokolwiek rozumieć :twisted:
hmm....

Powrót do Operation Flashpoint

Kto przegląda forum

Użytkownicy przeglądający ten dział: Brak zidentyfikowanych użytkowników i 5 gości

cron