OFPEC Forum

Addons & Mods Depot => OFP - Addons & Mods General => Topic started by: gimsom on 19 Nov 2004, 19:27:31

Title: Melee weapon
Post by: gimsom on 19 Nov 2004, 19:27:31
Im trying to make melee weapon but i dont know how to make that scripting. Many people have made axes, batons and katanas. Can someone help me with this.

Ive already got one script (below). Im not sure does it work. I need help how to make it working with my model?





#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


class CfgPatches
{
   class sword
   {
      units[] = { messersteche };
      weapons[] = { sword};
      requiredVersion = 1.40;
   };
};
class CfgWeapons
{
   class Default { };
   class MGun: Default { };
   class Riffle: MGun { };
   class M60: Riffle { };
   class lightsaber: M60
   {
      model="\sword\sword.p3d";
      displayName="sword";
      picture="HK";
      magazines[]={"strokegun"};
   };
};
class CfgVehicles
{
   class All { };
   class AllVehicles: All { };
   class Land: AllVehicles { };
   class Man: Land { };
   class Soldier: Man { };
   class SoldierWB: Soldier { };
   class messersteche: SoldierWB
   {
      displayName="Soldier (sword)";
      weapons[]={"sword","Throw","Put"};
      magazines[]={"strokegun"};      
   };
Title: Re:Melee weapon
Post by: Lean Bear on 23 Nov 2004, 20:40:07
OK. First, for the config to even work, you'll need another "};" (without quotations).

Also, the defines aren't necessary for this addon. (But by all means keep them, it doesn't really make a difference).

Also, using "strokegun" is really tacky. Why not make a new anim for it?

You also might want to include:

class CfgModels
{
   class Default{};
    class Weapon: Default{};
    class sword// or whatever the name is: Weapon{};
};

Apart from that, see how it works and reply if there are any problems and I'll help fix it.

ps. Be rest assured that I will be able to help you since "melee weapons" is my speciality.
Title: Re:Melee weapon
Post by: gimsom on 18 Dec 2004, 13:28:42
Ok, but could you be nice and write me that finsihed confiq. so i could just add that weapom for some unit? Im not making whole unit with sword. I would just like do that "addweapon" thing, not whole unit, just simple sword.

Thanks
Title: Re:Melee weapon
Post by: Lean Bear on 19 Dec 2004, 21:08:27
I'll give it a shot ;)
Title: Re:Melee weapon
Post by: MIG on 19 Dec 2004, 23:01:07
this close combat script uses the strokegun attack. It might help you.




Title: Re:Melee weapon
Post by: Lean Bear on 20 Dec 2004, 19:07:07
OK, this is basically all you need - very similar to you original one.

You will need OFP: Resistance to use this btw

If you'd like, you can send me the model, and I'll make an anim or two for you ;)

Contact me via a PM

class CfgPatches
{
  class Sword
   {
      units[] = {};
      weapons[] = {Sword};
      requiredVersion = 1.75;
   };
};

class CfgWeapons
{
   class Default { };
   class MGun: Default { };
   class Riffle: MGun { };
   class M60: Riffle { };

   class Sword: M60
   {
      model="\sword\sword.p3d";
      displayName="Sword";
      picture="YourPicHere";
      magazines[]={"SwordHit"};
   };
};

class CfgModels
{
   class Default{};
 Ã‚ Â Â class Weapon: Default{};
 Ã‚ Â Â class Sword: Weapon{};

};

class CfgAmmo
{
   class Default {};
   class StrokeFistHit: Default {};
   class StrokeGunHit: StrokeFistHit {};
   
   class SwordHit: StrokeGunHit
   {
         hit=20;indirectHit=2;indirectHitRange=0.5;
   };
};

class CfgNonAIVehicles
{
   class ProxyWeapon {};
   class ProxySword: ProxyWeapon {};

};