bmgarcangel 0 Posted July 13, 2004 Hey So i'm working on yet again another static machine gun and i need some major help in getting Cartridges to eject to the right of the gun each time you fire it. I'll been asking around and so far i haven't had any luck. I know its possible of course because BAS has already done it with there choppers as everybody already knows. I'm personelly not that good at addon script so....can someone please help me? ~Bmg Share this post Link to post Share on other sites
colonel_klink 0 Posted July 13, 2004 Hi bmgarcangel I'm working on that problem at the moment for the guns on the PT boat. I'm using the drop command. When I get it working properly I'll post it here or on the multigun thread. Cheers Klink Share this post Link to post Share on other sites
Scud 0 Posted July 14, 2004 I tried the drop command but it got abit messy on me (ended up with 1000 empties on the ground) so I switch to animation and settexture. Here is what I used on vickers. It probably sounds complicated but its not. I am no script wiz for sure but it seems to work. First put 3 empty shells animated on diff arcs and angles. I do this do get random effect and not same shell coming out at same angle all the time. start by EH fired command script runs thru once. Fire 1 shot get 1 shell, keep finger on trigger and shells keep coming. As shells eject from gun they fly for quarter second (can be adjusted) then I hide them and return they to gun. Bullets feed into gun in simular but more simple fashion. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">; Vickers eject cartridge sqs by Scud _vehicle = _this select 0 _ejectbullet = (random 3) _b1 = 0 _b2 = 0 _b3 = 0 ? _ejectbullet <= 1 : goto "B1" ? _ejectbullet <= 2 : goto "B2" ? _ejectbullet <= 3 : goto "B3" #B1 _vehicle setobjecttexture [1,"\vickers\303.pac"] _vehicle animate ["ani_bullet1",1]; _b1 = 1 goto "ejectBullets" #B2 _vehicle setobjecttexture [2,"\vickers\303.pac"] _vehicle animate ["ani_bullet2",1]; _b2 = 1 goto "ejectBullets" #B3 _vehicle setobjecttexture [3,"\vickers\303.pac"] _vehicle animate ["ani_bullet3",1]; _b3 = 1 goto "ejectBullets" #ejectBullets ~.25 ?(_vehicle animationPhase "ani_bullet1" ) == 1 : goto "hide1" ?(_vehicle animationPhase "ani_bullet2" ) == 1 : goto "hide2" ?(_vehicle animationPhase "ani_bullet3" ) == 1 : goto "hide3" exit #hide1 _vehicle setobjecttexture [1,""] _vehicle animate ["ani_bullet1",0]; exit #hide2 _vehicle setobjecttexture [2,""] _vehicle animate ["ani_bullet2",0]; exit #hide3 _vehicle setobjecttexture [3,""] _vehicle animate ["ani_bullet3",0]; exit Share this post Link to post Share on other sites
bmgarcangel 0 Posted July 14, 2004 oh no...now i'm really confused...i have to admit i'm really bad at addon scripts because i've never worked with them before so i might need help to get this to work.... Now first of all, so i create like a couple shell casings and put them like on one side of the gun and then give them a certian name like c1, c2, c3, c4, c5, etc.,etc.,etc........then with the script it will make them eject and go back after a while? ~Bmg Share this post Link to post Share on other sites
colonel_klink 0 Posted July 14, 2004 I used a similar method using just hidden selection on several invisible cartridges which worked well. The method scud mentions above is probably the best, as the drop method is too hit and miss getting it to look right. Also for some reason the doip objects don't show up in front of any other objects that have paa textures. Not sure about pac. Share this post Link to post Share on other sites
bmgarcangel 0 Posted July 14, 2004 Ya i figured But the only thing is though guys i just need help to get it to work if you guys can help me with it. Like i said i've never done addon scripting and such.... ~Bmg Share this post Link to post Share on other sites
bmgarcangel 0 Posted July 15, 2004 Ok scud this is what i did. In the vehiclecfg area i messed around with a pk machien gun so i can test this out...i added this anyhow to the config: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class bgPKmg: M2StaticMGE { class reflectors {}; displayName="PK machine gun (Standing)"; picture="m2"; model="\Vis_mg\pkmg.p3d"; cost=15000; weapons[]={"mpk"}; magazines[]={"mpk"}; side=0; camouflage=3; gunnerCanSee=31; threat[]={1,0.900000,0.100000}; crew="SoldierEB"; armor=60; armorStructural=20.000000; icon="kulomet.paa"; class eventhandlers { fired = _this exec {\Vis_mg\ShellEject.sqs}; }; }; At least I added the eventhandler. Now, after that i used that one trigger you gave me and then i put it in the folder and shit. Then i went into o2 lite and created three shells inside the gun, then i pressed ctrl + H to hide them and i named each one Bullet1, Bullet2, or Bullet3........then i went in game and nothing is flying out...help! ~Bmg Share this post Link to post Share on other sites
Scud 0 Posted July 16, 2004 Post your guns cpp. Also have you set up the animation for the bullets 1,2 & 3? That is in cpp and axis points in memory lod in O2. Share this post Link to post Share on other sites
bmgarcangel 0 Posted July 16, 2004 This is my CPP. Currently only one gun, the Pkmg, is using the event handler...basically i'm using it to test it out to get it working before i move on to the other guns.... <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">// 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 #define WeaponNoSlot 0// dummy weapons #define WeaponSlotPrimary 1// primary weapons #define WeaponSlotSecondary 16// secondary weapons #define WeaponSlotItem 256// items #define WeaponSlotBinocular 4096// binocular #define WeaponHardMounted 65536 #define CanSeeRadar 1 #define CanSeeRye 2 #define CanSeeOptics 4 #define CanSeeEar 8 #define CanSeeCompass 16 #define CanSeeAll 31 class CfgPatches { class BGPKmg { units[] = {BGPKmg,BGM2mg}; requiredVersion = 1.91; }; }; class CfgModels { class Default{}; class Weapon: Default{}; class  pkmga : Weapon { sections[]= {zasleh}; }; class pkmg : Weapon{}; class m2p : Weapon{}; class m60m : Weapon{}; }; class CfgAmmo { class Default {}; class BulletSingle : Default {}; class m60mAmmo: BulletSingle { hit=10;indirectHit=0.1;indirectHitRange=0.1; minRange=20;minRangeProbab=0.80; midRange=500;midRangeProbab=0.95; maxRange=3000;maxRangeProbab=0.05; cost=30; }; class mpkAmmo: BulletSingle { hit=21;indirectHit=0.08;indirectHitRange=0.1; minRange=0.2; minRangeProbab=0.80; midRange=500; midRangeProbab=0.95; maxRange=3000; maxRangeProbab=0.05; cost=200; }; }; class CfgWeapons { class Default{}; class MGun: Default{}; class MachineGun7_6: MGun{}; class MachineGun12_7: MachineGun7_6{}; class Browning: MachineGun12_7{}; class mpk: Browning { ammo=mpkAmmo; displayName="PK"; displayNameMagazine="PK"; shortNameMagazine="PK"; visibleFire=14; audibleFire=24; visibleFireTime=2; cartridge="FxCartridge"; count=650; sound[]={"Weapons\AK74full",db10,1};          soundContinuous=0; initSpeed=4900; aiRateOfFire=0.001; // delay between shots at given distance aiRateOfFireDistance=1000; // at shorter distance delay goes lineary to zero }; class m60m: Browning {  ammo=m60mAmmo;  displayName="M60";  displayNameMagazine="M60";  shortNameMagazine="M60";  count=100;  sound[]={"Weapons\M60mgun",3.162278,1};  reloadSound[]={"Weapons2\M60full",db10,1};  MagazineReloadTime=6;           soundContinuous=0;  maxLeadSpeed=865; aiRateOfFire=0.001; // delay between shots at given distance aiRateOfFireDistance=1000; // at shorter distance delay goes lineary to zero }; }; class CfgVehicles { class All{}; class AllVehicles:All{}; class Land: AllVehicles{}; class LandVehicle: Land{}; class Tank: LandVehicle{};  class APC: Tank{}; class M113:APC{}; class M2StaticMG: M113{}; class M2StaticMGE: M2StaticMG{}; class bgPKmg: M2StaticMGE {  class reflectors {};  displayName="PK machine gun (Standing)";           picture="m2";           model="\Vis_mg\pkmg.p3d";  cost=15000;  weapons[]={"mpk"};  magazines[]={"mpk"};       side=0;  camouflage=3;  gunnerCanSee=31;  threat[]={1,0.900000,0.100000};  crew="SoldierEB";  armor=60;  armorStructural=20.000000;  icon="kulomet.paa";  class eventhandlers    {      fired = _this exec {\Vis_mg\ShellEject.sqs};   }; }; class m2p: M2StaticMG {  displayName="M2 (Gunner Prone)";          picture="im113";          model="\Vis_mg\m2p.p3d";  cost=15000;  class reflectors {};  weapons[]={"Browning"};  magazines[]={"Browning","Browning","Browning"};      side=1;  crew="HYK_USsolGLWL85";  armor=60;  armorStructural=20.000000;  icon="kulomet.paa";  gunnerAction="ManActm2pGunner";  gunnerInAction="ManActm2pGunner";  class Turret { gunAxis = "OsaHlavne"; turretAxis = "OsaVeze"; soundServo[]={Vehicles\gun_elevate2,db-30,1.0}; gunBeg = "usti hlavne"; gunEnd = "konec hlavne"; body = "OtocVez"; gun = "OtocHlaven"; minElev=-30; maxElev=+20; minTurn=-45; maxTurn=+45; }; }; class m60m: M2StaticMG {  displayName="M60 Machine Gun (Prone)";          picture="im113";          model="\vis_mg\m60m.p3d";  cost=15000;  class reflectors {};  weapons[]={"m60m"};  magazines[]={"m60m","m60m","m60m","m60m"};      side=1;  crew="HYK_USsolGLWL85";  armor=60;  armorStructural=20.000000;  icon="kulomet.paa";  gunnerAction="ManActm60mGunner";  gunnerInAction="ManActm60mGunner";  modelOptics="optika_M60_MG";  class Turret { gunAxis = "osahlavne"; turretAxis = "osaveze"; soundServo[]={Vehicles\gun_elevate2,db-30,1.0}; gunBeg = "usti hlavne"; gunEnd = "konec hlavne"; body = "OtocVez"; gun = "OtocHlaven"; minElev=-30; maxElev=+30; minTurn=-60; maxTurn=+60; }; }; }; class CfgNonAIVehicles { class ProxyWeapon{}; class Proxytpillbox: ProxyWeapon{}; class Proxym60m: ProxyWeapon{}; }; class CfgVehicleActions { bgPKmgGunner="ManActM2Gunner"; m2pGunner="LyingToBinocLying"; m60mGunner="Crouch"; }; Share this post Link to post Share on other sites
bmgarcangel 0 Posted July 16, 2004 @Scud: Honestly mate, i don't know what to do with the bullet part and stuff about o2 lite....i dont know where to put anything, keep in mind this is new stuff for me! ~Bmg Share this post Link to post Share on other sites
Scud 0 Posted July 16, 2004 hmmm... what are you like at texturing? Might do a trade. Share this post Link to post Share on other sites
BraTTy 0 Posted July 16, 2004 Bmgarcangel sent me a distress pm to help here.Did you get anywheres yet? I actually typed out something last night and then hit the pgup key (dont ya hate that) But from what I see you still need: -Setup the animations in O2 and config.cpp for 3 shell objects -Enter the selections within cfgmodels and cfgvehicles as hidden selections Trenchfeet uses the drop command I believe on his planes and it looks nice,Scud says he tried that but had thousands of shells laying around.But you can set the time to live. Either method would be ok Share this post Link to post Share on other sites
scousejedi 0 Posted July 16, 2004 To set up the animations in O2 you need 3 things 1. A selection in your model - something like bullet1 2. In your memory LOD you need 2 points - make them a selection called axis_bullet1 3. An angle - best thing to do for you would be looking at Col Klinks wheels / canopy animation tutorial but its you deciding how far the selection will move 'about' the axis. This angle will be used in the config later. The bullet starts at point 1 (we will call this phase 0), next we want to move the bullet a little so it looks like its flying out of your gun - we can only rotate selections and when we set up the animation in the config will will have to define some things... Here is something from an config that Bratty might find familiar this is a subset of Class Animations <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> class hitch { type=rotation; animperiod=.00001; selection=legs_shut; axis=osa_hitch; angle0=0; angle1=-1.5; angle2=0; }; Note the class hitch - this is the name that you use to make the animation work in scripts and eventhandlers type = always rotation but a long radius (20m+) makes a horizontal movement animperiod= number of seconds it takes to go from start to finish selection = this is the one you set up in your res LODs - this is just the selection name axis = these are the 2 points set up in the memory LOD - just put the name of the selection in the memory LOD here angle0 = this is how much the selection is different from the position in O2, leave it at 0 angle1 = this angle that the selection is moved through but its not in degrees its in radians (1 deg = (1 * PI)/180) angle2 = leave at 0 ........... Now you are having problems with visibilty in game - you don't hide selections in O2 to hide them in game. Heres another bit of a config.. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> statement="this animate [""hitch"", 0]; this setObjectTexture [0,""\I44_xxxx\xxxx_001.paa""]; this setObjectTexture [1,""""]"; Now this is from an addAction within the config so its not the same as in a script but... this animate ["hitch",0] tells OFP to look at the animation defined as 'hitch' and return it from whatever phase its in now ( it could be anywhere from 0 to 1 eg 0.5 and its only moved half the angle) for example we could do this animate ["hitch",0] this animate ["hitch",0.75] which would move hitch back to the position its in in O2 and then move it to 3/4 of its total allowed movement. .... Now the hide and unhide bit comes next.. this setObjectTexture [1,""] tells OFP to find the second selection defined in cfgModels and remove its textures. this setObjectTexture [0,""] tells OFP to find the first selection in cfgModels and apply textures from xxxx_001.paa to it. Thats how you make stuff appear and disappear. Heres the cfgModels judt so you can see that <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> class CfgModels { class Default{}; class Vehicle: Default{}; class xxxx: Vehicle { sectionsInherit="Vehicle"; sections[]={"legs_open","legs_shut"}; }; }; This should give you something to get your teeth into Share this post Link to post Share on other sites
Scud 0 Posted July 16, 2004 Hi Bratty, what was that all about? Last thing he said to me was he's posting it to me. Share this post Link to post Share on other sites
oyman 0 Posted July 16, 2004 Hi Bratty, what was that all about?Last thing he said to me was he's posting it to me. geez this is turning into a soap-opera anyway so if i do what scousejedi said i should get a shell ejection effect thing Share this post Link to post Share on other sites
bmgarcangel 0 Posted July 16, 2004 hey Sorry scud, i emailed him before you replied to me last night because i thought you were ignoring me or something, i was just growing really desperate to try and understand this and even now i'm confused...i'm a slow learning folks  I'm sending the email now, i guess last night it failed!?! **EDITED** Hey thanks for that file scud...gonna check it out now mate! ~Bmg Share this post Link to post Share on other sites
bmgarcangel 0 Posted July 17, 2004 its still a little confusing to get it working....i've tried several approaches already and the bullets either go out really fast or they go around and around the gun for some odd reason....it interesting..... ~Bmg Share this post Link to post Share on other sites
Trenchfeet 0 Posted July 19, 2004 i just want to but in and say GREAT IDEA Scud i was just recently working on a static gun and the drop effect is no good because the casing will always come out of 1 spot. When the gun turs out of position i found it was then badly missed placed. Share this post Link to post Share on other sites
Scud 0 Posted July 19, 2004 I made up a little help word file for this topic, should be up at OFPBase soon. Share this post Link to post Share on other sites
Footmunch 0 Posted July 19, 2004 i just want to but in and say GREAT IDEA Scud  i was just recently working on a static gun and the drop effect is no good because the casing will always come out of 1 spot. When the gun turs out of position i found it was then badly missed placed. Trench - If you attach the drop command to the gun object (the last value in the drop array, IIRC), then the drop point should turn with the gun. Also, you can add a little randomness to the eject point and the speed, to give it more 'reality'. Share this post Link to post Share on other sites
bmgarcangel 0 Posted July 19, 2004 Whoa...how do you do that footmunch? How do you get the drop command to work? Not saying that i'll use it at all because Scud is going to help me some more on getting the cartridge stuff to work, but how is your way done anyhow? ~Bmg Share this post Link to post Share on other sites
Footmunch 0 Posted July 19, 2004 Here's a piece of code used to create two 'gunsmoke' anims on a plane with wing-mounted guns: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _plane = (object selected from array passed from FiredEH) #Smoke ;Have to adjust the firing point relative to the speed of the plane _ypos = (speed _plane /100) - 1 ; One on the left _pos1 = [3.4, _ypos, -1.1] ; One on the right _pos2 = [-3.4, _ypos, -1.1] ;Colour array - white smoke that fades to 0 alpha _col = [[1,1,1,.4],[1,1,1,.7],[1,1,1,0]] ;Launch 15 cloudlet pairs _count = 15 #Loop ;Random lifetime _lifetime = .07 + (random 10 / 100) ;And velocity _vel = [10-random 20,10-random 20,10-random 20] ;Drop the smoke on the left - smoke grows from size 0.1 up to 1.6 then down to 0.5 again drop["cl_basic","","Billboard",1,_lifetime,_pos1,_vel,3,1,1,0,[.1,1.6,.5],_col,[0,.3,1],5,5,"","",_plane] drop["cl_basic","","Billboard",1,_lifetime,_pos2,_vel,3,1,1,0,[.1,1.6,.5],_col,[0,.3,1],5,5,"","",_plane] _count = _count -1 ?(_count > 0): goto "Loop" The setting of _plane in the last drop entry means that the velocity and position are relative to the centre of the plane, rather than to 'absolute' co-ordinates. To do cartridges, you'd replace "cl_basic" with a cartridge model; "Billboard" with "SpaceObject"; adjust the weight and 'rubbing' params; and so on. Share this post Link to post Share on other sites
Scud 0 Posted July 19, 2004 bmgarcangel you have an err in cpp you have this class Animations    { class ani_bullet1     {       type="rotation";       animPeriod=0.4;       selection="bullet1";       axis="osa bullet1";       angle0=0;       angle1=-1.57;     }; class ani_bullet2     {       type="rotation";       animPeriod=0.4;       selection="bullet1";       axis="osa bullet1";       angle0=0;       angle1=-1.57;     }; class ani_bullet3     {       type="rotation";       animPeriod=0.4;       selection="bullet1";       axis="osa bullet1";       angle0=0;       angle1=-1.57;     }; }; instead of this class Animations    { class ani_bullet1     {       type="rotation";       animPeriod=0.4;       selection="bullet1";       axis="osa bullet1";       angle0=0;       angle1=-1.57;     }; class ani_bullet2     {       type="rotation";       animPeriod=0.4;       selection="bullet2";       axis="osa bullet2";       angle0=0;       angle1=-1.57;     }; class ani_bullet3     {       type="rotation";       animPeriod=0.4;       selection="bullet3";       axis="osa bullet3";       angle0=0;       angle1=-1.57;     }; }; notice the selection="bullet2"; axis="osa bullet2"; and selection="bullet3";       axis="osa bullet3"; Share this post Link to post Share on other sites
bmgarcangel 0 Posted July 20, 2004 I don't get what you're sayin...it looks the same to me and i opened it up...the config...and it looks the same as the so called "fixed' version that you posted....i dont get it mate ~Bmg Share this post Link to post Share on other sites