Home   Help Search Login Register  

Author Topic: Single-shot AT-4 (M136)  (Read 2172 times)

0 Members and 1 Guest are viewing this topic.

Offline Inkompetent

  • Members
  • *
Single-shot AT-4 (M136)
« on: 09 Aug 2007, 16:46:12 »
Hello there. I've been tinkering with the weapons files and so, trying to replace to replace the M136 in the game with one that can't be reloaded.

I've understood I have to replace the weapon with one that can't use any existing ammo from looking at the WGL mod for OFP, but I can't really manage to get the rest to work properly.

I've edited the CfgAmmo, CfgMagazines and CfgWeapons to change the weapon properties, but it's still mean to me...

Oh, and one little thing more I could need help with. Where is the stringtable with weapons? I have found a good bunch of stringtables, but none with weapons included, which baffles me since the CfgWeapons is referring to stringtable lines.

Anyone either know how I can fix my weapon-problem, or if there is any existing addon already doing what I want to do?

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re: Single-shot AT-4 (M136)
« Reply #1 on: 09 Aug 2007, 21:02:27 »
Stringtable for weapons will be in language.pbo........language\weapons\

Not sure that helps you at all because I suspect you might be talking about OFP.
This is of course the ArmA editing section.


Planck
I know a little about a lot, and a lot about a little.

Offline Inkompetent

  • Members
  • *
Re: Single-shot AT-4 (M136)
« Reply #2 on: 09 Aug 2007, 22:16:31 »
I'm talking about ArmA, but the only mod I know that changes the AT-4 to a single shot weapon is the WGL mod for OFP, thus I'm using it for reference, suspecting that the code ought to be near identical for OFP and ArmA in the config files.

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Re: Single-shot AT-4 (M136)
« Reply #3 on: 13 Aug 2007, 04:05:41 »
I was just thinking about this... You could script this by doing a fire event handler. Once its been fired its deleted from the player. To effect its dropped you create another one below the unit. It could then eventually disappear like a body remover script

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Single-shot AT-4 (M136)
« Reply #4 on: 27 Aug 2007, 11:30:44 »
If you delete the M136 launcher from inventory using a fired handler, then that is fine (I do it in SPON Scripts for ArmA). Although it might be nicer visually if you created another one on the ground, so that it didn't just look like it was disappearing, surely the player could just pick it up and use it, couldn't he? Oh, or do you mean you create a disabled one as Inkompetent originally asked for?
« Last Edit: 27 Aug 2007, 11:36:00 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Chris Young

  • Members
  • *
Re: Single-shot AT-4 (M136)
« Reply #5 on: 28 Aug 2007, 14:17:59 »
It was done by Operation Frenchpoint for our M-136 (named ABL in France) and our APILAS in our OFP packs. After firing, there is an anim with the guy dropping the launcher and a used launcher is created in front of the player. Maybe you can see how it's done. (I'm the the guy who wrote the script so I don't know more)
Chris Young - Operation Frenchpoint Partner

Offline Inkompetent

  • Members
  • *
Re: Single-shot AT-4 (M136)
« Reply #6 on: 19 Sep 2007, 14:00:19 »
Ohh, I'll have a look at Frenchpoint. Thanks for the advice. Now, when I finally have my computer back and I managed to write an event handler to exchange the weapon to one only using FakeMagazine as ammo and to drop the weapon.

However that script was called by an eventhandler specified for a character class. When I move that event handler to the M136 itself it won't fire correctly, but hopefully I can sort it out with your scripts.

Offline Inkompetent

  • Members
  • *
Re: Single-shot AT-4 (M136)
« Reply #7 on: 19 Sep 2007, 18:42:52 »
I can't really seem to find anything in the OFrP-stuff I got hold of, unfortunately...

Well, I can post my code here and maybe some of you guys can spot something obvious I should change. Here we go!

config.cpp
Code: [Select]
class CfgPatches
{
class Real_M136
{
units[] = {};
weapons[] = {"M136"};
requiredVersion = 0.1;
requiredAddons[] = {"CAWeapons","CAAir"};
};
};

class cfgWeapons
{
/*external*/ class Launcher;
class M136 : Launcher {
class Eventhandlers
{
fired = "_this execVM ""\Real_M136\Scripts\realm136.sqf""";
};
};

class M136Used : M136 {
displayName = "M136 Launcher (Used)";
magazines[] = {FakeMagazine};
};
};

realm136.sqf
Code: [Select]
_unit = _this select 0;
_weapon = _this select 2;
if ((_weapon in ["M136"]) && (local _unit)) then {
_weaponused = switch (_weapon) do {
case "M136":{"M136Used"};
};
sleep 0.5;
_unit removeWeapon _weapon;
_unit addWeapon _weaponused;
_unit selectWeapon _weaponused;
_unit action ["DROPWEAPON",_unit,_weaponused];
};

Can it be that the "_this select 0" points at the weapon instead of the player because the eventhandler is fired from the weapon class rather than a unit class?
« Last Edit: 19 Sep 2007, 23:37:28 by Inkompetent »

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Single-shot AT-4 (M136)
« Reply #8 on: 19 Sep 2007, 19:52:51 »
Please, add what you want to add to your last post as long as your last post is the last one of a thread instead of double posting.