Home   Help Search Login Register  

Author Topic: Empty bullet cartridges everywhere!  (Read 4513 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.

OberstSponz

  • Guest
Re:Empty bullet cartridges everywhere!
« Reply #15 on: 20 Sep 2003, 14:53:21 »
Hi MIFred,

way to go, this is what I have been originally looking for. Specially interesting as you can modify the size of the cartdridge that easily. This allows for different purposes like 7.62 cartridges as well as ones from tanks, still smoking after being ejected using another Drop-effect.
I like the cartridges I have been using so far as they are a little bit more shiny whereas the built-in nabojnice is kind of dull. And the resize function of the drop command is really interesting to avoid creating another addon!

Thanks for the idea!

OberstSponz

Offline MI_Fred

  • Members
  • *
  • AA
    • OFP Team Finlanders
Re:Empty bullet cartridges everywhere!
« Reply #16 on: 21 Sep 2003, 00:03:17 »
It only works in theory tho. I'm not too sure but can you check if the real cartridge coming out can be caught with nearestObject? Then it should also be going away from the shooter... hmm yes pretty basic fired eventhandler stuff... and when the cartridges height is less than 0 or it isNull, then you'd drop that one. Only thing is, it sticks out like that in a random angle even from concrete  :-X And with that lighting effect, not so pretty.
There's gooks over there, there's mines over there, and watch out those goddamn monkeys talk, I'll bite ya.

OberstSponz

  • Guest
Re:Empty bullet cartridges everywhere!
« Reply #17 on: 21 Sep 2003, 18:34:58 »
Funny that you mentioned that with the nearestObject. It's exactly what I tried to find out the objectname. However, it resulted in either the bullet itself or in something completely useless, but never in some secret "nabojnice" object.

I have figured out how to correctly determine the endposition of ejected shells depending on the direction of the player (hail to the sin() and cos() functions) and I am going to leave it like this, together with the shiny addons I made from INQ's weaponpack.

I have tried to redefine the properties of the existing shells, but guess what happens: they don't just lie around after hitting the floor but the shoot up into the skies like a rocket. You will still not see any shells, but occisionally you'll see one shooting up to heaven  ;D

OberstSponz

Offline Doolittle

  • Contributing Member
  • **
  • _this select 0
Re:Empty bullet cartridges everywhere!
« Reply #18 on: 22 Sep 2003, 17:20:59 »
DUDE THAT RULES, MI_Fred!  THANKS!

Doolittle

Komuna

  • Guest
Re:Empty bullet cartridges everywhere!
« Reply #19 on: 24 Sep 2003, 11:03:12 »
God Dammit! >:(  <----- Edit ---- Unacceptable abuse of authority in consequence of my ignorance. This way, I hereby condemn it and leave it clarified that it won't happen again.

NearestObject can't be used to detect the "nabojnice" object, unless it was loaded as a config defined object!!! U can't pic DROPped objects as if they were units. What you can really pic with NearestObject is the FXcartridge, which model is, indeed, the "nabojnice"!

So, why don't you detect the cartridge from a fired gun and, as it disapears on the group, you camCreate/VehicleCreate a redefined shell, lets say, the "OberstSponzCart", as I already told you!

And if it's not possible to pic the fired cartridge, then use your script to place the Addon in the right place!
« Last Edit: 25 Sep 2003, 13:24:29 by Komuna »

OberstSponz

  • Guest
Re:Empty bullet cartridges everywhere!
« Reply #20 on: 25 Sep 2003, 00:35:33 »
Komuna,

looks like you missed a good deal of the discussion somehow, so there is no need to curse here, really.
1. In the beginning nobody clarified that there is no cartridge object. Meanwhile it is understood that there is only a FXCartridge object (and that's an effect, not really a static effect) using the "nabojnice" model.

2. I have made 2 addons with the shiny shells from the INQ Weaponpack and I figured out the algorithm how to correctly place them relative to the gun after the shot. After the FXCartridge effect, they're just created.

3. >the "OberstSponzCart", as I already told you!
I thought I replied to that already. The problem with just adjusting the parameters was that then the shells have a problem with gravity and don't stay there oin the ground but bounce around like crazy.

This discussion included a process of discovering what's possible or not and what's the best way of realizing it and everybody including yourself contributed to it, so don't end it by shouting around, please.  8)

Komuna

  • Guest
Re:Empty bullet cartridges everywhere!
« Reply #21 on: 25 Sep 2003, 13:27:25 »
*Cough*

Well, you're completly right! (See edited post)

So, what are we missing to have this topic solved?

OberstSponz

  • Guest
Re:Empty bullet cartridges everywhere!
« Reply #22 on: 25 Sep 2003, 19:04:55 »
Well, basically we're happy customers  :)

I have offered to share the addons with anybody, but there was little interest (I still like them).

Hm, now I need to associate a drop sound with them. Any idea to point me in the right direction with this? I have two sounds available already but I am not sure how to go about playing them whenever this addon is created. Thanks for any input.

OberstSponz

KyleSarnik

  • Guest
Re:Empty bullet cartridges everywhere!
« Reply #23 on: 25 Sep 2003, 20:47:42 »
Hmm sounds cool. Is there any way to use the default "nabojnice" shells? I didnt really figure out if you could or not by reading the previous posts....

OberstSponz

  • Guest
Re:Empty bullet cartridges everywhere!
« Reply #24 on: 26 Sep 2003, 13:26:27 »
Yes, it's kind of confusing if you only read the messages.

So, what did we accomplish:
1. "Nabojnice" is not an object that can be used but only a 3d model used by an animation called "FXCartrdige"
2. Tweaking the settings to not let the "nabojnice" not disappear when it hits the ground results in crazy 0-gravity objects = not usable.
3. I have made 2 new addons using 3rd party shell models, these work fine.
4. I have implemented an eventhandler that places empty shells correctly whenever a player fires.
5. It looks nice, check out my attached picture in one of the above posts ;)

OberstSponz

Komuna

  • Guest
Re:Empty bullet cartridges everywhere!
« Reply #25 on: 26 Sep 2003, 15:35:21 »
2. Tweaking the settings to not let the "nabojnice" not disappear when it hits the ground results in crazy 0-gravity objects = not usable.

Indeed, I had reasons to be a litle angry.

Why don't you use the "nabojnice" model in a different class... lets say the same class as a table?

OberstSponz

  • Guest
Re:Empty bullet cartridges everywhere!
« Reply #26 on: 26 Sep 2003, 21:29:27 »
Komuna, well not really, further up I wrote already why:

"I like the cartridges I have been using so far as they are a little bit more shiny whereas the built-in nabojnice is kind of dull."

That's why I chose to stay with the INQ shells although you're right, I could have created the same addon using the "nabojnice" object.

OberstSponz

KyleSarnik

  • Guest
Re:Empty bullet cartridges everywhere!
« Reply #27 on: 27 Sep 2003, 22:32:57 »
Well this script/addon (whatever you wanna call it) could be very usefull for a cutscene in one of my missions. But since all of the weapons (JAM) use "nabojnice" shells and I would want it to look realistic.....