Home   Help Search Login Register  

Author Topic: Help with RPG .cpp  (Read 1752 times)

0 Members and 1 Guest are viewing this topic.

Offline Whiskey27

  • Members
  • *
Help with RPG .cpp
« on: 05 Oct 2010, 22:43:44 »
Code: [Select]
#define true 1
#define false 0

#define private 0
#define protected 1
#define public 2

#define VSoft 0
#define VArmor 1
#define VAir 2

#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 ReadAndWrite 0
#define ReadAndCreate 1
#define ReadOnly 2
#define ReadOnlyVerified 3

#define LockNo 0
#define LockCadet 1
#define LockYes 2

class CfgPatches {
class w27_weapons {
units[] = {};
weapons[] = {"Rpg2"};
requiredVersion = 0.1;
requiredAddons[] = {"CAweapons"};
};
};

class CfgAmmo {
class Default;
class RocketCore;

class RocketBase : RocketCore
{
model = "\ca\weapons\AT1";
hit = 500;
indirectHit = 150;
indirectHitRange = 2;
soundHit[] = {"Ca\sounds\Weapons\explosions\explosion_large1", 44.6684, 1, 1800};
soundFly[] = {"Ca\sounds\Weapons\explosions\rocket_fly1", 0.1, 1.5, 400};
soundEngine[] = {"Ca\sounds\Weapons\explosions\noise", db-50, 1, 20};
supersonicCrackNear[] = {"Ca\sounds\Weapons\explosions\supersonic_crack_close", 1, 1, 150};
supersonicCrackFar[] = {"Ca\sounds\Weapons\explosions\supersonic_crack_50meters", 1, 1, 250};
maxSpeed = 840; // max speed on level road, km/h
initTime = 0;
thrustTime = 0.2;
thrust = 2000;
CraterEffects = "HERocketCrater";
explosionEffects = "HERocketExplosion";
muzzleEffect = "BIS_Effects_Rocket";
effectsMissile = "missile2";

};

class PG2 : RocketBase
{
typicalSpeed = 840;
airFriction = -0.005;
hit = 208;
indirectHit = 20;
indirectHitRange = 10;
model = "\w27\w27_pg2_rocket.p3d";
cost = 100;
initTime = 0;
thrust = 280;
thrustTime = 0.2;
maxSpeed = 840.4; // max speed on level road, km/h
timeToLive = 4.0;
fuseDistance = 2;
visibleFire = 28; // how much is visible when this weapon is fired
audibleFire = 16;
CraterEffects = "ATRocketCrater";
explosionEffects = "ATRocketExplosion";
effectsMissile = "missile2";
whistleDist = 4;
simulation="shotRocket";
};
};

class CfgMagazines {
class Default;

class CA_Magazine : Default {
scope = protected;
value = 1;
displayName = "";
model = "\ca\weapons\mag_univ.p3d";
picture = "";
modelSpecial = "";
useAction = false;
useActionTitle = "";
reloadAction = "ManActReloadMagazine";
ammo = "";
count = 30;
type = 256;
initSpeed = 900;
selectionFireAnim = "zasleh";
nameSound = "magazine";
maxLeadSpeed = 23; // max estimated speed km/h
};

class CA_LauncherMagazine : CA_Magazine {
model = "";
value = 5;
type = 2 * 256;
count = 1;
initSpeed = 5;
picture = "\CA\weapons\data\equip\m_M136_ca.paa";
nameSound = "handgrenade";
};

class PG2 : CA_LauncherMagazine {
model = "\w27\w27_pg2_rocket";
modelSpecial = "\w27\w27_rpg2_loaded";
displayName = PG2;
ammo = PG2;
picture = "";
descriptionShort = "PG2 Projectile";
};
};

class cfgWeapons {
class Default;
class LauncherCore;

class Launcher : LauncherCore {
cursorAim = "\ca\Weapons\Data\clear_empty";
cursor = "Rocket";
cursorSize = 1;
autoAimEnabled = false;
opticsDisablePeripherialVision = true;
magazines[] = {};
value = 10;
nameSound = "atlauncher";
magazineReloadTime = 12;
reloadTime = 0;
sound[] = {"\ca\Weapons\Data\Sound\at7_RocketLauncher_Shot1", db-40, 1, 1400};
initSpeed = 30;
canLock = LockNo;
reloadAction = "ManActReloadAT";
autoReload = false;
ffMagnitude = 0.1;
ffFrequency = 1;
ffCount = 1;
recoil = "LAWSingle";
aiRateOfFire = 10.0; // delay between shots at given distance
aiRateOfFireDistance = 500;
optics = false;
primary = false;
opticsZoomMin = 0.25;
opticsZoomMax = 1.0;
opticsZoomInit = 0.5;
distanceZoomMin = 1;
distanceZoomMax = 1;
minRange = 20;
minRangeProbab = 0.3;
midRange = 150;
midRangeProbab = 0.58;
maxRange = 500;
maxRangeProbab = 0.04;
type = 1;
simulation = weapon;
UiPicture = "\CA\weapons\data\Ico\i_at_CA.paa";
};

class RPG2 : Launcher {
scope = public;
initSpeed = 840;

displayName = RPG2;

model = "\w27\w27_rpg2_launcher";

handAnim[] = {"OFP2_ManSkeleton", "Ca\weapons\data\Anim\RPG7.rtm"};

modelOptics = "-";

magazines[] = {PG2};

dexterity = 2;
sound[] = {"\Ca\sounds\Weapons\rockets\RocketLauncher_Shot04_A", db20, 1, 1400};

drySound[] = {"\Ca\sounds\Weapons\rockets\dry", 0.0001, 1, 10};

reloadMagazineSound[] = {"\Ca\sounds\Weapons\rockets\flare_reload", 0.000316228, 1, 20};

soundFly[] = {"\Ca\sounds\Weapons\rockets\rocket_fly1", db40, 1.5, 700};

picture = "";

UiPicture = "\CA\weapons\data\Ico\i_at_CA.paa";

recoil = "launcherBase";

aiRateOfFire = 10.0;
aiRateOfFireDistance = 250;

minRange = 50;

midRange = 100;

maxRange = 199;

muzzleEnd = "konec hlavne";
muzzlePos = "usti hlavne";
opticsZoomInit = 0;
opticsZoomMax = 0;
opticsZoomMin = 0;

class Library {
libTextDesc = RPG2;

};
descriptionShort = RPG2;
};
};

Well this is my first post and I hope I'm not out of line, I have done a little searching but haven't really found an answer.  The base for my config was from the RPG-7 for arma2, but what I want to do with it is make it a primary slot weapon, without having the messed up animation issue.  With the way it is now, I get in game and it shows me holding the invisible weapon, with the RPG on my back, and even fires straight up into the air lol, and when not "out," instead of being on my back the weapon is held forward in the players hands.  Also I am having a problem with the rocket going very slow :/.  Any help would be appreciated. (Btw this has been my first model, uvwunwrap, texture, config shabang so please be gentle :) )

Offline Worldeater

  • Former Staff
  • ****
  • Suum cuique
Re: Help with RPG .cpp
« Reply #1 on: 06 Oct 2010, 06:52:11 »
Hello Whiskey27 and welcome to OFPEC! :)

Hmm, looks like you modified the Launcher class (type = 1). Doesn't this affect all weapons that inherit from it (like M136, Javelin, etc.)?

Another thing is the simulation property. Its value wants to be wrapped in double quotes. I also wonder why you put it in there at all? It's already set to "weapon" in the Default class. Since Launcher inherits from LauncherCore and LauncherCore inherits from Default you did not change anything here.

In general, wouldn't it be a lot easier to inherit from class RPG7V directly?


Note: There are more experienced guys than me when it comes to configs. ;)
try { return true; } finally { return false; }

Offline Whiskey27

  • Members
  • *
Re: Help with RPG .cpp
« Reply #2 on: 06 Oct 2010, 15:20:58 »
Ok I see what you mean by this, and the only reason I threw simulation in there was just to see if anything made it work with the primary slot. Thanks for the insight.