Home   Help Search Login Register  

Author Topic: Empty bullet cartridges everywhere!  (Read 4728 times)

0 Members and 1 Guest are viewing this topic.

OberstSponz

  • Guest
Empty bullet cartridges everywhere!
« on: 17 Sep 2003, 17:21:26 »
Hello all and thanks for reading this.

I have gained some experience with SP and MP scripting over the past year and now I am stuck with something simple that I can't figure out:

I wanted to script a scene where there are some bullet cartridges lying around to indicate that a firefight has taken place there. When firing a gun, the engine creates nice cartridges ejected from the weapon but they disappear when they hit the ground.

Is there any known object name out there that I could use to create some cartridges randomly lying around? I would use the normal createCam command for that, I guess.

Thanks for any ideas,
OberstSponz

OberstSponz

  • Guest
Re:Empty bullet cartridges everywhere!
« Reply #1 on: 17 Sep 2003, 19:36:14 »
Something to add:
Meanwhile I have read through the complete decodec config.bin and found the following: ejected cartridges are being created by "FxCartridge".

But that's a complete flying sequence, not a single object:
"FxCartridge" camCreate [_newx,_newy,10] works.

Hm, I furthermore found this definition of "FxCartridge" in cfgVehicles.hpp:

   class FxCartridge: ThingEffect
   {
      model = "nabojnice";
      displayName=$STR_DN_FX_CARTRIDGE;

      submerged = -0; // initial submersion, <0 inital delaty
      submergeSpeed = 0;
      timeToLive = 5; // always disappear after certain period of time

      disappearAtContact=true;
   };
   /**/

So, "nabojnice" is the name of the cartridge. But all attempts to camcreate or createvehicle an object called "nabojnice" resulted in nothing.

Hm...?

OberstSponz

Komuna

  • Guest
Re:Empty bullet cartridges everywhere!
« Reply #2 on: 18 Sep 2003, 13:11:12 »
Hmmm... No, you shall not create a vehicle called "nabojnice", but "FxCartridge".

Anyway, it may not work, as the FXCartridge is defined to be used only by the game... It happens because it's acces=protected (0). Then you have to create your own Addon, where all you have to do is switch the acces to 1 or 2 (private or public). The  "Private" one won't be available through the editor (only through the CamCreate/CreateVehicle coms) . The "Public" will be available in the listing, depending on which VehicleClass you choose.

OberstSponz

  • Guest
Re:Empty bullet cartridges everywhere!
« Reply #3 on: 18 Sep 2003, 15:47:58 »
Hi Komuna,

yes, as I wrote before:

"FxCartridge" camCreate [_newx,_newy,10] works.

It creates a cartridge, but it will just fall down (in this case from 10m high) and disappear. No chance to create one lying around on the floor, though.

ObertSponz

Kaliyuga

  • Guest
Re:Empty bullet cartridges everywhere!
« Reply #4 on: 18 Sep 2003, 21:42:41 »
There are empty AK47 clips that can just lie on the ground..

I know they are available via .WrpEdit  because near the firing range on my island I have a few empty clips lying about on the ground

I know what the .p3d name is... but don't really know how you would go about  camcreating them or anything

Unnamed

  • Guest
Re:Empty bullet cartridges everywhere!
« Reply #5 on: 18 Sep 2003, 22:21:38 »
I think Komuna was just confirming that you could only create objects using the class name "FxCartridge" and not the name of the actual object?

And I think he is correct in saying the only way you could add them in game, is by creating your own addon file.

I wish there was a better way of using simple addons like the one you describe, without having to create pbo's.

OberstSponz

  • Guest
Re:Empty bullet cartridges everywhere!
« Reply #6 on: 18 Sep 2003, 22:33:37 »
Yes, looks like this will only work with an addon. Basically not a big problem, but I have searched my socks off a bullet cartridge - no luck.

I know that Inquisitor has 2 custom shells in his fantastic INQ_WeaponPack. Maybe I can convince him to single out these two (pistol and rifle) shells as separate addons. Need to find out how to contact him.

I mean, shells lying around are scenic and really add to the athmosphere, I think. I could imagine adding an "addEvent ['fired',..." to create shells whenever the player fires and have the lying around in city combat, could be nice.

I also thought of ejecting bigger cartridges whenever a tank fires, those could be smoking for some time, too. I am a fan of these details.

OberstSponz

Komuna

  • Guest
Re:Empty bullet cartridges everywhere!
« Reply #7 on: 19 Sep 2003, 11:49:33 »
Every FX object is defined at the config.bin as temporary or just disapear when contacting the ground...
So, making an addon of your own is no big deal:



class CfgVehicles
{
class All {};
class Static:All {};
class (...) : Static
(...)
class FXCartridge: (...) {};
class OberstSponzCart : FXCartridge
{
disapearAtContact=0;
};
};

It should be something like this... Notice that the '(...)' represents classes that I couldn't specify cuz I don't have the CfgVehicles.hpp with me... ;D

Now, I belive you'll handle this easily. ;)


#!!!Edited!!!
If you want realistic shell dispertion, have a script which creates the cartridges at the nearest FXCartridge position, on every shot. The created carts should be attached at the FX ones, so that, at the placed where the Fx disapears the Addon cart remains!
« Last Edit: 19 Sep 2003, 11:54:07 by Komuna »

OberstSponz

  • Guest
SOLVED: Empty bullet cartridges everywhere!
« Reply #8 on: 19 Sep 2003, 17:18:38 »
Hi Komuna,

interesting approach... what I wonder about... if you re-define existing classes in your description.ext for example and give them different properties like "disappear... = 0", will they then override the system class properties??? Could be interesting to tweak some stuff.

Furthermore this technique would probably lead to millions of cartridges lying around very soon  :D

What I did was to decompile the INQWeapons addon, take the p3d objects for the rifle and pistol bullet and compiled them into a simple standalone addon each. I will not take credit for this addon as it is based on a model I didn't make but I think it's worth a look if anybody is interested.

I did add an eventhandler and after figuring out the formula to calculate the correct spot where to create them based on the view direction of the gunner, it results in a nice little feature. I haven't tested it extensively but I believe lag should be neglectable. In my little script, I added a timeout of 5 min before the shells will be deleted again.

If anybody is interested, drop me a mail and I can post the script and the addon;  vfsacc@yahoo.com

Best regards,
OberstSponz

I attached a picture, check it out.
« Last Edit: 19 Sep 2003, 17:26:53 by OberstSponz »

Komuna

  • Guest
Re:Empty bullet cartridges everywhere!
« Reply #9 on: 19 Sep 2003, 17:33:43 »
?? Actually i didn't modify the original class properties. All I did was adding a new class with different properties:

DisapearAtContact=false; (notice that false is 0)

and, as you say you delete them in your script, you could give the class the following prop, instead:

timeToLive=300;

OberstSponz

  • Guest
Re:Empty bullet cartridges everywhere!
« Reply #10 on: 19 Sep 2003, 17:39:40 »
Hi Komuna,

hm, but the class "FXCartridge" does exist already? The question was whether you can override system properties that easily by redefining the classes with different parameters? How would you do that? In other words, where would I have to put in this code to adjust the FXCartridge effect?

Cheers,
OberstSponz

OberstSponz

  • Guest
Re:Empty bullet cartridges everywhere!
« Reply #11 on: 19 Sep 2003, 17:41:45 »
... okok I think I got it. I write and addon simply "recycling" existing classes but with different parameters.
Thanks, also a very good suggestion!

OberstSponz

Komuna

  • Guest
Re:Empty bullet cartridges everywhere!
« Reply #12 on: 19 Sep 2003, 17:43:38 »
Well... How do you define your own soldier through the SoldierWB? You don't override! You just call the SoldierWB properties into your new class.

And if the FXCartridge exists it means that its class was specified at the default config.bin (at the \bin dir).

#Edit

Ahhhh... seems you already posted... and figured it out! ;) ^^^^
« Last Edit: 19 Sep 2003, 17:44:48 by Komuna »

OberstSponz

  • Guest
Re:Empty bullet cartridges everywhere!
« Reply #13 on: 19 Sep 2003, 17:48:27 »
Yes, thinking sometimes takes longer, I was only into straightforward scripting so far and my experience with addons is basically 0. I look forward to tweak more system properties!

Cheers,
OberstSponz

Offline MI_Fred

  • Members
  • *
  • AA
    • OFP Team Finlanders
Re:Empty bullet cartridges everywhere!
« Reply #14 on: 19 Sep 2003, 20:56:53 »
How about a


and

drop ["nabojnice", "", "SpaceObject", 0.2, 20, [0,0,0], [0,0,0], 0, 1.275, 1, 0, [200], [[0.5,0.5,0.5,1]], [0,0], 0, 0, "", "",_obj]

where

[200] is that ridiculous size that exaggerates the point that you can disregard any stoooopid addons!  ;D

You can also create these at when they come out of the gun, I've done the same with an exploding outhouse with poop.... ERm. Yes well you only need to calc the point of impact, then drop a hovering nabojnice, which will look nice.


 
There's gooks over there, there's mines over there, and watch out those goddamn monkeys talk, I'll bite ya.