Jump to content
Sign in to follow this  
Gunter Severloh

How do I move an item/weapon to a new slot in the gear?

Recommended Posts

Hey guys from my SLX project Im getting feedback on things in the new updated version.

Heres the situation,

I'll just quote from the thread to give you an idea on what im talking about and what the problem is:

from the Updated SLX thread:

supergruntsb78[/b];2035632]any way possible that the Bayonet is placed as an item ?

now it conflicts with the binocs / NVG

tested it with the ASC weapon mod as soon as i add an item (silencer or scope etc.) the bayonet is

tossed out of the player inventory into the weapon crate as i also have NVG and Binocs with me

my response:

Günter Severloh[/b];2035686]

Your using the COSLX version correct as only the ASC weapon mod is OA, as i have that mod in CoWarMod.

According to the file slx_melee_give.pbo which is the pbo that gives you the bayonet in SLX mod, the following is 1 code

?!("SLX_OKC3S_Bayonet_Knife_Item" in Magazines _unit):_unit addMagazine "SLX_OKC3S_Bayonet_Knife_Item";_unit addWeapon "SLX_OKC3S_Bayonet_Knife_Item"
goto "end"

of many I took from the script that runs the whole bayo system.

Apparently its already an item, except that it uses a magazine slot from what i can understand, i will have to look into this,

maybe ask a more scripting fluent folks I know on how to change this so that its moved to a different slot.

Test

I just tested what you were talking about, I use a mission I built for weapons and equipment testing and such, and I see what you mean,

the knife will not go anywhere but the nvg, or binoc spot, and if you have both nvg, and binocs then the knife (bayo is moved to the ammo box,

and this is just CoSLX alone with no mods, so it has nothing to do with the ASC weapon mod.

not a bug

This isn't a bug, more of just an adjustment needed in the script that places the item, i'm thinking maybe we can put the

bayo in the slots where the map, and radio go, think that would work?

Script in reference:

SLX_Give_Melee

[color="Green"];exit[/color]
_unit=_this select 0



~.1

[color="Green"];?isnil "SLX_MeleeShot":SLX_MeleeShot=["SLX_SlashHit","SLX_SlashHitLight","SLX_SlashHitMedium","SLX_SlashHitHeavy","SLX_SlashHitAnim","SLX_SlashHitLightAnim","SLX_SlashHitMediumAnim","SLX_SlashHitHeavyAnim"];
;?isnil "SLX_Melee":SLX_Melee = ["SLX_SlashHit","SLX_SlashHitLight","SLX_SlashHitMedium","SLX_SlashHitHeavy","SLX_SlashHitLightAnim","SLX_SlashHitMediumAnim","SLX_SlashHitHeavyAnim","SLX_BluntHit","SLX_BluntHitLight","SLX_BluntHitMedium","SLX_BluntHitHeavy","SLX_BluntHitLightAnim","SLX_BluntHitMediumAnim","SLX_BluntHitHeavyAnim"];[/color]


?("Man" CountType [_unit]==1):goto "man"
?(count (weapons _unit)<1)||(count (magazines _unit)<1):exit
?("Tank" CountType [_unit]==1)&&("M2StaticMG" CountType [_unit]<1):goto "Tank"

exit

#man
[color="Green"];SLX_Bayonets=["SLX_M9_Bayonet","SLX_OKC3S_Bayonet","SLX_AK74_Bayonet","SLX_AK47_Bayonet","BAS_FNFALScout_Bayonet"]
;_unit addEventHandler ["Fired",{if(format["%1",SLX_MeleeAnims]==format["%1","scalar bool array string 0xfcffffef"])then{SLX_MeleeAnims=[]};if!((_this select 0) in SLX_MeleeAnims)then{if(((_this select 1) in SLX_Melee)||((_this select 4) in SLX_Melee))then{_this exec "\SLX_Melee\SLX_Melee_Anim.sqs";};};}]
;_unit addEventHandler ["Fired",{if ((_this select 4) in ["SLX_SlashHit","SLX_SlashHitLight","SLX_SlashHitMedium","SLX_SlashHitHeavy","SLX_SlashHitAnim","SLX_SlashHitLightAnim","SLX_SlashHitMediumAnim","SLX_SlashHitHeavyAnim"]) then {_this exec "\SLX_Melee\SLX_Melee_Anim.sqs"}}]
;_unit addEventHandler ["Fired",{if(isnil "SLX_MeleeAnims")then{SLX_MeleeAnims=[]};if!((_this select 0) in SLX_MeleeAnims)then{if ((_this select 4) in SLX_Melee) then {_this exec "\SLX_Melee\SLX_Melee_Anim.sqs"}}}][/color]
?(count (weapons _unit)<1)||(count (magazines _unit)<1):exit
[color="Green"];?!("StrokeFist" in weapons _unit):_unit addMagazine "StrokeFist";_unit addWeapon "StrokeFist"[/color]

;if(isnil ""SLX_MeleeAnims"")then{SLX_MeleeAnims=[]};if(isnil ""SLX_Melee"")then{SLX_Melee=[""SLX_SlashHit"",""SLX_SlashHitLight"",""SLX_SlashHitMedium"",""SLX_SlashHitHeavy"",""SLX_SlashHitLightAnim"",""SLX_SlashHitMediumAnim"",""SLX_SlashHitHeavyAnim"",""SLX_BluntHit"",""SLX_BluntHitLight"",""SLX_BluntHitMedium"",""SLX_BluntHitHeavy"",""SLX_BluntHitLightAnim"",""SLX_BluntHitMediumAnim"",""SLX_BluntHitHeavyAnim""]};if!((_this select 0) in SLX_MeleeAnims)then{if ((_this select 4) in SLX_Melee) then {_this exec ""\SLX_Melee\SLX_Melee_Anim.sqs""}}

[color="Green"];causes crash when unit is trying to use binoculars ????
;?("Binocular" in weapons _unit):_weapon={Binocular};_weapons=(weapons _unit) - [_weapon] - [secondaryweapon _unit] - [primaryweapon _unit];{_unit removeWeapon _x} forEach _weapons;{_unit addWeapon _x} forEach _weapons;_unit selectWeapon primaryWeapon _unit;[/color]

?(side _unit in [WEST]):goto "west"
?(side _unit in [EAST]):goto "east"
?(side _unit in [resistance,Civilian]):goto "res"
exit

#west
[color="Green"];?!("SLX_M9_Bayonet_Knife_Item" in weapons _unit)&&(("HK" in weapons _unit)||("M16" in weapons _unit)||("SLX_M16_M9" in weapons _unit)||("M21" in weapons _unit)):
;?!("SLX_M9_Bayonet_Knife_Item" in weapons _unit):_unit addMagazine "SLX_M9_Bayonet_Knife_Item";_unit addWeapon "SLX_M9_Bayonet_Knife_Item"
;?!("SLX_OKC3S_Bayonet_Knife_Item" in weapons _unit):_unit addMagazine "SLX_OKC3S_Bayonet_Knife_Item";_unit addWeapon "SLX_OKC3S_Bayonet_Knife_Item"
;?!("SLX_OKC3S_Bayonet_Knife_Item" in weapons _unit):_magazines=magazines _unit;_weapons=weapons _unit;removeAllWeapons _unit;_unit addMagazine "SLX_OKC3S_Bayonet_Knife_Item";_unit addWeapon "SLX_OKC3S_Bayonet_Knife_Item";{_unit addMagazine _x} foreach _magazines;{_unit addWeapon _x} foreach _weapons;[/color]

?!("SLX_OKC3S_Bayonet_Knife_Item" in Magazines _unit):_unit addMagazine "SLX_OKC3S_Bayonet_Knife_Item";_unit addWeapon "SLX_OKC3S_Bayonet_Knife_Item"
goto "end"

#res
[color="Green"];?(!("SLX_AK74_Bayonet_Knife_Item" in weapons _unit))&&(("AK47CZ" in weapons _unit)||("AK47" in weapons _unit)||("AK74" in weapons _unit)||("SLX_AK74_AK74_Bayonet" in weapons _unit)||("SLX_AK47_AK47_Bayonet" in weapons _unit)):
;?(!("SLX_AK74_Bayonet_Knife_Item" in weapons _unit)):_unit addMagazine "SLX_AK74_Bayonet_Knife_Item";_unit addWeapon "SLX_AK74_Bayonet_Knife_Item"
[/color]
#east
[color="Green"];?(!("SLX_Shovel_East_Item" in weapons _unit))&&((typeof _unit=={SoldierEB})||(typeof _unit=={SoldierEMG})||("SoldierELAW" CountType [_unit]>0)||("SoldierEMiner" CountType [_unit]>0)||("SoldierESaboteur" CountType [_unit]>0)||("OfficerE" CountType [_unit]>0)||("SoldierEMedic" CountType [_unit]>0)||("SoldierEG" CountType [_unit]>0))||(("AK74" in weapons _unit)||("SLX_AK74_AK74_Bayonet" in weapons _unit)):_unit addMagazine "SLX_Shovel_East_Item";_unit addWeapon "SLX_Shovel_East_Item"
; ?(!("SLX_AK74_Bayonet_Knife_Item" in weapons _unit)):_unit addMagazine "SLX_AK74_Bayonet_Knife_Item";_unit addWeapon "SLX_AK74_Bayonet_Knife_Item"
;?(!("SLX_Shovel_East_Item" in weapons _unit)&&((typeof _unit!="OfficerE"))):_unit addMagazine "SLX_Shovel_East_Item";_unit addWeapon "SLX_Shovel_East_Item"
;?!("SLX_Shovel_East_Item" in weapons _unit)&&((typeof _unit) in ["SoldierEB","SoldierEMG","SoldierEAT","SoldierEG","SquadLeaderE","TeamLeaderE","SoldierEAA"]):_magazines=magazines _unit;_weapons=weapons _unit;removeAllWeapons _unit;_unit addMagazine "SLX_Shovel_East_Item";_unit addWeapon "SLX_Shovel_East_Item";{_unit addMagazine _x} foreach _magazines;{_unit addWeapon _x} foreach _weapons;[/color]

?!("SLX_AK74_Bayonet_Knife_Item" in Magazines _unit):_unit addMagazine "SLX_AK74_Bayonet_Knife_Item";_unit addWeapon "SLX_AK74_Bayonet_Knife_Item"

[color="Green"]; ?!("SLX_Shovel_East_Item" in weapons _unit)&&((typeof _unit) in ["SoldierEB","SoldierEMG","SoldierEAT","SoldierEG","SquadLeaderE","TeamLeaderE","SoldierEAA"]):_unit addMagazine "SLX_Shovel_East_Item";_unit addWeapon "SLX_Shovel_East_Item"[/color]
goto "end"

#end
; ~.1
[color="Green"];_unit selectWeapon (primaryweapon _unit)[/color]
exit

#Tank
[color="Green"];_unit addMagazineCargo ["SLX_Axe_Anim",1]
;_unit addWeaponCargo ["SLX_Axe_Anim",1]
;_unit addMagazineCargo ["SLX_ShovelBase",1]
;_unit addWeaponCargo ["SLX_ShovelStroke",1][/color]

exit

The green color parts of the script is how it really is in the actual script.

Question

So my question is how do I change it so that the bayo is moved to the slot where the

map and compass, and other stuff are at down at the bottom when you look at your gear or open an ammo box?

Share this post


Link to post
Share on other sites

I admit I did not read all the code you posted, but, It may be as simple as going to the config and changing the type property to 131072 to make it show up in the small items slots.

 type = 131072;

type is described more here:

http://community.bistudio.com/wiki/CfgWeapons_Config_Reference#Types

If all the bayonets derive from a base clase, then it would be best to make the change there.

Share this post


Link to post
Share on other sites

Ah that makes sense, i will give a try with at least west in the script.

thanks.

---------- Post added at 06:22 PM ---------- Previous post was at 05:52 PM ----------

I spoke to soon, i looked at the script again and theres nothing there to change the type

also that link you posted, made me relize being the title of that wiki

CfgWeapons Config Reference

that the answer lies not in the script/s itself but in the cfg.

So looking at the melee give cfg, there nothing there in reference to changing "type" type being the slot.

However there was one more file I had overlooked which was the other SLX file that is the melee system file is slx_melee.pbo, I had opened that pbo and found the cfg with the type in there.

from the lines I found this is what it says:

what i bolded needs to be changed from what Im understanding

according to the type being this number 4096

according to the cfg wiki its this slot:

Weapon: BinocularSlot 4096/4 same or NVG, LD,etc

so if i change the number you had listed seen here:

Mag: SmallItems 131072/4 (Arma 2) map, compass, small items (derived from ItemCore)

then the knife/bayo should move to the slots where the map, compass is :icon_biggrin:

class SLX_Sword_Item: SLX_Sword
{
 initSpeed = 4;
 [b]Type = 4096;[/b]
 magazines[] = {"this"};
 modes[] = {"Single"};
 dispersion = 0.5;
 multiplier = 1;
 burst = 10;
 sound[] = {"\SLX_Melee\sound\SLX_QuickSwing.wss",0.002,1};
 soundContinuous = 1;
 ffCount = 1;
 optics = 0;
 recoil = "empty";
 autoFire = 1;
 aiRateOfFire = 0.1;
 aiRateOfFireDistance = 2.2;
 useAction = 0;
 useActionTitle = "";
};
class SLX_Machete: SLX_MeleeWeapon
{
 picture = "\SLX_Melee\Machete\SLX_i_Machete.paa";
 displayName = "Machete";
 displayNameMagazine = "Machete Sheath";
 shortNameMagazine = "Machete Sheath";
 magazines[] = {"this"};
 modes[] = {"Single"};
 multiplier = 1;
 burst = 5;
 dispersion = 0.2;
 sound[] = {"\SLX_Melee\sound\SLX_Slash.wss",0.002,1};
 soundContinuous = 1;
 ffCount = 1;
 optics = 0;
 recoil = "SLX_Swing";
 autoFire = 1;
 aiRateOfFire = 0.7;
 aiRateOfFireDistance = 2.2;
 useAction = 0;
 useActionTitle = "";
};
class SLX_Machete_Anim: SLX_Machete
{
 displayName = "Machete (A)";
 magazines[] = {"this"};
 modes[] = {"Single"};
 multiplier = 1;
 burst = 5;
 dispersion = 0.1;
 sound[] = {"\SLX_Melee\sound\SLX_Slash.wss",0.002,1};
 soundContinuous = 1;
 ffCount = 1;
 optics = 0;
 recoil = "empty";
 autoFire = 1;
 aiRateOfFire = 0.7;
 aiRateOfFireDistance = 2.2;
 useAction = 0;
 useActionTitle = "";
};
class SLX_Machete_Item: SLX_Machete
{
 displayName = "Machete (I)";
 initSpeed = 30;
 [b]Type = 4096;[/b]
 magazines[] = {"this"};
 modes[] = {"Single"};
};
class SLX_OKC3S_Bayonet_Knife: SLX_MeleeWeapon
{
 picture = "\SLX_Melee\OKC3S\SLX_i_OKC3S.paa";
 displayName = "OKC3S Bayonet Knife";
 displayNameMagazine = "Knife Sheath";
 shortNameMagazine = "Knife Sheath";
 magazines[] = {"this"};
 modes[] = {"Single"};
 multiplier = 1;
 burst = 5;
 dispersion = 0.2;
 sound[] = {"\SLX_Melee\sound\SLX_Slash.wss",0.002,1};
 soundContinuous = 1;
 ffCount = 1;
 optics = 0;
 recoil = "SLX_Swing";
 autoFire = 1;
 aiRateOfFire = 0.7;
 aiRateOfFireDistance = 2.2;
 useAction = 0;
 useActionTitle = "";
};
class SLX_OKC3S_Bayonet_Knife_Stab: SLX_OKC3S_Bayonet_Knife
{
 displayName = "OKC3S Bayonet Knife";
 displayNameMagazine = "Knife Sheath";
 shortNameMagazine = "Knife Sheath";
 magazines[] = {"this"};
 modes[] = {"Single"};
 multiplier = 1;
 burst = 4;
 dispersion = 0.2;
 sound[] = {"\SLX_Melee\sound\SLX_Slash.wss",0.002,1};
 soundContinuous = 1;
 ffCount = 1;
 optics = 0;
 recoil = "SLX_Stab";
 autoFire = 1;
 aiRateOfFire = 0.7;
 aiRateOfFireDistance = 2.2;
 useAction = 0;
 useActionTitle = "";
};
class SLX_OKC3S_Bayonet_Knife_Under: SLX_OKC3S_Bayonet_Knife
{
 displayName = "OKC3S Bayonet Knife";
 displayNameMagazine = "Knife Sheath";
 shortNameMagazine = "Knife Sheath";
 magazines[] = {"this"};
 modes[] = {"Single"};
 multiplier = 1;
 burst = 5;
 dispersion = 0.2;
 sound[] = {"\SLX_Melee\sound\SLX_Slash.wss",0.002,1};
 soundContinuous = 1;
 ffCount = 1;
 optics = 0;
 recoil = "SLX_Swing";
 autoFire = 1;
 aiRateOfFire = 0.7;
 aiRateOfFireDistance = 2.2;
 useAction = 0;
 useActionTitle = "";
};
class SLX_OKC3S_Bayonet_Knife_Anim: SLX_OKC3S_Bayonet_Knife
{
 magazines[] = {"this"};
 modes[] = {"Single"};
 multiplier = 1;
 burst = 5;
 dispersion = 0.1;
 sound[] = {"\SLX_Melee\sound\SLX_Slash.wss",0.002,1};
 soundContinuous = 1;
 ffCount = 1;
 optics = 0;
 recoil = "empty";
 autoFire = 1;
 aiRateOfFire = 0.7;
 aiRateOfFireDistance = 2.2;
 useAction = 0;
 useActionTitle = "";
};
class SLX_OKC3S_Bayonet_Knife_Item: SLX_OKC3S_Bayonet_Knife
{
 displayName = "OKC3S Bayonet Knife Sheath (I)";
 initSpeed = 50;
[b] Type = 4096;[/b]
 magazines[] = {"this"};
 modes[] = {"Single"};
 ammo = "SLX_SlashHitLightAnim";
};
class SLX_M9_Bayonet_Knife: SLX_MeleeWeapon
{
 picture = "\SLX_Melee\M9\SLX_i_M9.paa";
 displayName = "M9 Bayonet Knife";
 displayNameMagazine = "Knife Sheath";
 shortNameMagazine = "Knife Sheath";
 magazines[] = {"this"};
 modes[] = {"Single"};
 multiplier = 1;
 burst = 5;
 dispersion = 0.2;
 sound[] = {"\SLX_Melee\sound\SLX_Slash.wss",0.002,1};
 soundContinuous = 1;
 ffCount = 1;
 optics = 0;
 recoil = "SLX_Swing";
 autoFire = 1;
 aiRateOfFire = 0.7;
 aiRateOfFireDistance = 2.2;
 useAction = 0;
 useActionTitle = "";
};
class SLX_M9_Bayonet_Knife_Stab: SLX_M9_Bayonet_Knife
{
 displayName = "M9 Bayonet Knife";
 displayNameMagazine = "Knife Sheath";
 shortNameMagazine = "Knife Sheath";
 magazines[] = {"this"};
 modes[] = {"Single"};
 multiplier = 1;
 burst = 4;
 dispersion = 0.2;
 sound[] = {"\SLX_Melee\sound\SLX_Slash.wss",0.002,1};
 soundContinuous = 1;
 ffCount = 1;
 optics = 0;
 recoil = "SLX_Stab";
 autoFire = 1;
 aiRateOfFire = 0.7;
 aiRateOfFireDistance = 2.2;
 useAction = 0;
 useActionTitle = "";
};
class SLX_M9_Bayonet_Knife_Under: SLX_M9_Bayonet_Knife
{
 displayName = "M9 Bayonet Knife";
 displayNameMagazine = "Knife Sheath";
 shortNameMagazine = "Knife Sheath";
 magazines[] = {"this"};
 modes[] = {"Single"};
 multiplier = 1;
 burst = 5;
 dispersion = 0.2;
 sound[] = {"\SLX_Melee\sound\SLX_Slash.wss",0.002,1};
 soundContinuous = 1;
 ffCount = 1;
 optics = 0;
 recoil = "SLX_Swing";
 autoFire = 1;
 aiRateOfFire = 0.7;
 aiRateOfFireDistance = 2.2;
 useAction = 0;
 useActionTitle = "";
};
class SLX_M9_Bayonet_Knife_Anim: SLX_M9_Bayonet_Knife
{
 magazines[] = {"this"};
 modes[] = {"Single"};
 multiplier = 1;
 burst = 5;
 dispersion = 0.1;
 sound[] = {"\SLX_Melee\sound\SLX_Slash.wss",0.002,1};
 soundContinuous = 1;
 ffCount = 1;
 optics = 0;
 recoil = "empty";
 autoFire = 1;
 aiRateOfFire = 0.7;
 aiRateOfFireDistance = 2.2;
 useAction = 0;
 useActionTitle = "";
};
class SLX_M9_Bayonet_Knife_Item: SLX_M9_Bayonet_Knife
{
 displayName = "M9 Bayonet Knife (I)";
 initSpeed = 30;
[b]  Type = 4096;[/b]
 magazines[] = {"this"};
 modes[] = {"Single"};
};
class SLX_AK74_Bayonet_Knife_Item: SLX_OKC3S_Bayonet_Knife_Item
{
 picture = "\SLX_Melee\AK74Bayo\SLX_i_ak74bayonet.paa";
 displayName = "AK74 Bayonet Knife (I)";
 displayNameMagazine = "Knife Sheath";
 shortNameMagazine = "Knife Sheath";
[b]  Type = 4096;[/b]
 magazines[] = {"this"};
 modes[] = {"Single"};
 dispersion = 0.4;
 multiplier = 1;
 burst = 10;
 sound[] = {"\SLX_Melee\sound\SLX_QuickSwing.wss",0.002,1};
 soundContinuous = 1;
 ffCount = 1;
 optics = 0;
 recoil = "empty";
 autoFire = 1;
 aiRateOfFire = 0.1;
 aiRateOfFireDistance = 2.1;
 useAction = 0;
 useActionTitle = "";

I'm going to change the number in the cfg and see how it turns out ingame.

Share this post


Link to post
Share on other sites

dont know much but would you change the magazine unit to a diff gear item unit?

?!("SLX_AK74_Bayonet_Knife_Item" in Magazines _unit):_unit addMagazine "SLX_AK74_Bayonet_Knife_Item";_unit addWeapon "SLX_AK74_Bayonet_Knife_Item"

Share this post


Link to post
Share on other sites

No.

I got it to work.

At first I only changed a few lines like about half of the cfg and thought that was it, went ingame and got a few errors saying

this and this is missing and this cant load, I was like WTF.

So i went back looked at the cfg again and and this time the whole cfg and found a few more lines, changed those,

recompiled the pbo, and then tried it ingame, and it worked and with no errors!!!

So i go into the ammo box and get the binocs, and wallah and I have the knife, binocs, and nvgs,

and the knife is in the slot down by the map, and compass and other items.

whats really cool is that now and unlike before the animation to do a knife slash actually works!

so your character actually does a knife slash, and animation of slashing.

Problem though is when he does that there is no knife in his hand but binoculars FPDR dout!!!!

Lol so...this is the next challenge how to get the knife to show instead of the binoculars?

i suppose that would hurt if you got whopped over the head with a pair of binocs, lol but its not realistic if you got a knife in your gear.

==============================

I cant post the whole cfg as its to big, and the forum for posting limits you to 5000 characters and what i have here is like 10,000 with the cfg,

so I'll just post a link to download the cfg.

Download

slx_melee config:

http://dl.dropbox.com/u/42601124/slx_melee%20config.zip

Share this post


Link to post
Share on other sites

Afaik the type set only the slot position, the get weapon animation is linked to another parameter in the cfgweapons.

But however, the animation can only set once per "value".

I have to look which name this parameter have (value, numberor so ? :rolleyes:) because the internet from work is a little restrictive to the keyword "weapon" to have the chance to peek for it.

Share this post


Link to post
Share on other sites

Hey lester thanks for your reply, my current problem is :

how to get the knife to show instead of the binoculars?

I have the knife in the slot I want in the player's gear, but when your ingame and you switch to the knife or bayo

it is called and you attack and your player character does a knife slash, there is no knife in his hand.

Whats in his hand is a pair of binoculars, how do we get the knife to show instead of the binoculars?

What I'm pondering is that somehow the knife script and or configs are still linked to the binocular/nvg slot,

and its loading the binoculars instead of the knife, so I'm thinking that somewhere I have to change another

item to be used instead of the binoculars.

---------- Post added at 08:10 AM ---------- Previous post was at 06:41 AM ----------

Another observation and question I would like to ask

In the CFG, I'll list the coding in question:

class SLX_OKC3S_Bayonet: CA_Magazine
{
 scopeWeapon = 0;
 scopeMagazine = 2;
 valueMagazine = 5;
 [b][color="Green"]Type =131072;[/color][/b]
[b][color="Blue"]  magazineType = 256;[/color][/b]
 autoReload = 0;
 flash = "";
 flashSize = 0;
 dexterity = 8;
 maxLeadSpeed = 100;
 drySound[] = {"",0,1};
 reloadMagazineSound[] = {"",0,1};
 count = 100000;
 initSpeed = 30;
 distanceZoomMin = 0;
 distanceZoomMax = 0;
 displayName = "OKC3S Bayonet";
 displayNameMagazine = "OKC3S Bayonet";
 shortNameMagazine = "OKC3S Bayonet";
 picture = "\SLX_Melee\OKC3S\SLX_i_OKC3S.paa";
 reloadAction = "manactreloadmortar";
 magazines[] = {"this"};
 modes[] = {"this"};
 muzzles[] = {"this"};
 dispersion = 0.2;
 multiplier = 1;
 burst = 1;
 sound[] = {"",0.002,1};
 soundContinuous = 1;
 ffCount = 1;
 optics = 0;
 recoil = "SLX_Bayonet_Stab";
 autoFire = 1;
 aiRateOfFire = 0.1;
 aiRateOfFireDistance = 2.3;
 useAction = 0;
 useActionTitle = "";
};

In the green is the type, this is where the bayonet is moved to with the number next to it being 131072,

that number corresponds to the slot for where the map, compass, and other misc items in the player gear.

Now, the code in blue magazineType = 256; 256 is the slot position for the magazines being where the main gun

clips are located in the gear, what i need to know is, is that correct? does not the magazine type need to be in

the same slot as the item in terms of where the bayo is located which is the 131072 number?

Understand what im getting at? Im trying to determine the cause of why the binoculars only show when you have

the knife selected as your weapon and you use the weapon and instead of the knife showing as in my previous post

the binoculars do, i cant seem to find anything to change in the CFG that corresponds to this issue.

Any have any ideas, or know what/where to change? is it in the CFG, or somewhere else?

Share this post


Link to post
Share on other sites

Sorry I have not been more responsive but real life keeps getting in the way. I began reviewing the configs last night but as you know there is a lot to review. My first thought on why the binos show in the hand is because there is no .p3d model defined/declared for the knife/bayonet and it somepoint it just inherits the bino model. There may also be a conflict in tha the knife may be a weapon and a magazine so both CfgWeapons and CfgMagazines needs to be reviewed.

In the short term, try to track up through the config tree (to include parent classes) where the first instance of a model for the knife is and see what it says.

I will try to take a look here in a couple of hours

--Edit--

On further review, we need to verify that there actually is a model for the knives...there is one defined in CfgWeapons, but I don't know what it actually looks like.

Edited by Loyalguard

Share this post


Link to post
Share on other sites

Hey LoyalGuard, np man, I got the same goign on some times RL gets in the way.

Anyways, I can post a link to the actual SLX_melee file as it has p3d files in there, the knife shows in the gear,

but as said when you choose the weapon not from gear but when in combat, and you do a strike just binocs show, lol rather funny but it breaks immersion.

I'll look for the first instance. I'm still learning about all this stuff, if I have something to associate codes, and scripts too, i can learn this stuff fast.

Download

Here is the Slx_melee.pbo

http://dl.dropbox.com/u/42601124/slx_melee.pbo.zip

Share this post


Link to post
Share on other sites

Thanks for the link...I wil go through it tonight.

I exlored the config some more during lunch and I cannot see any real conflicts but the one tricky part is that the knives have both CfgWeapons and CfgMagazines classes and are often named the same. I wonder if one is used for bayonet use (on a rifle) and one for knife-fighting use.

Share this post


Link to post
Share on other sites
I wonder if one is used for bayonet use (on a rifle) and one for knife-fighting use.

I think both used as a knife in hand, as there is no attach to rifle type command or even script, or action ingame to suggest you can attach to a rifle,

that would be pretty cool though.

I know the knife works i killed a dude np ingame with it, AI of course.

Here is the first entries for the bayo, and knife, first one being at the top:

 class SLX_OKC3S_Bayonet_Knife: SLX_MeleeWeapon
{
 picture = "\SLX_Melee\OKC3S\SLX_i_OKC3S.paa";
 displayName = "OKC3S Bayonet Knife";
 displayNameMagazine = "Knife Sheath";
 shortNameMagazine = "Knife Sheath";
 magazines[] = {"this"};
 modes[] = {"Single"};
 multiplier = 1;
 burst = 5;
 dispersion = 0.2;
 sound[] = {"\SLX_Melee\sound\SLX_Slash.wss",0.002,1};
 soundContinuous = 1;
 ffCount = 1;
 optics = 0;
 recoil = "SLX_Swing";
 autoFire = 1;
 aiRateOfFire = 0.7;
 aiRateOfFireDistance = 2.2;
 useAction = 0;
 useActionTitle = "";
};
class SLX_OKC3S_Bayonet_Knife_Stab: SLX_OKC3S_Bayonet_Knife
{
 displayName = "OKC3S Bayonet Knife";
 displayNameMagazine = "Knife Sheath";
 shortNameMagazine = "Knife Sheath";
 magazines[] = {"this"};
 modes[] = {"Single"};
 multiplier = 1;
 burst = 4;
 dispersion = 0.2;
 sound[] = {"\SLX_Melee\sound\SLX_Slash.wss",0.002,1};
 soundContinuous = 1;
 ffCount = 1;
 optics = 0;
 recoil = "SLX_Stab";
 autoFire = 1;
 aiRateOfFire = 0.7;
 aiRateOfFireDistance = 2.2;
 useAction = 0;
 useActionTitle = "";
};
class SLX_OKC3S_Bayonet_Knife_Under: SLX_OKC3S_Bayonet_Knife
{
 displayName = "OKC3S Bayonet Knife";
 displayNameMagazine = "Knife Sheath";
 shortNameMagazine = "Knife Sheath";
 magazines[] = {"this"};
 modes[] = {"Single"};
 multiplier = 1;
 burst = 5;
 dispersion = 0.2;
 sound[] = {"\SLX_Melee\sound\SLX_Slash.wss",0.002,1};
 soundContinuous = 1;
 ffCount = 1;
 optics = 0;
 recoil = "SLX_Swing";
 autoFire = 1;
 aiRateOfFire = 0.7;
 aiRateOfFireDistance = 2.2;
 useAction = 0;
 useActionTitle = "";
};
class SLX_OKC3S_Bayonet_Knife_Anim: SLX_OKC3S_Bayonet_Knife
{
 magazines[] = {"this"};
 modes[] = {"Single"};
 multiplier = 1;
 burst = 5;
 dispersion = 0.1;
 sound[] = {"\SLX_Melee\sound\SLX_Slash.wss",0.002,1};
 soundContinuous = 1;
 ffCount = 1;
 optics = 0;
 recoil = "empty";
 autoFire = 1;
 aiRateOfFire = 0.7;
 aiRateOfFireDistance = 2.2;
 useAction = 0;
 useActionTitle = "";
};
class SLX_OKC3S_Bayonet_Knife_Item: SLX_OKC3S_Bayonet_Knife
{
 displayName = "OKC3S Bayonet Knife Sheath (I)";
 initSpeed = 50;
 Type = 131072;
 magazines[] = {"this"};
 modes[] = {"Single"};
 ammo = "SLX_SlashHitLightAnim";
};
class SLX_M9_Bayonet_Knife: SLX_MeleeWeapon
{
 picture = "\SLX_Melee\M9\SLX_i_M9.paa";
 displayName = "M9 Bayonet Knife";
 displayNameMagazine = "Knife Sheath";
 shortNameMagazine = "Knife Sheath";
 magazines[] = {"this"};
 modes[] = {"Single"};
 multiplier = 1;
 burst = 5;
 dispersion = 0.2;
 sound[] = {"\SLX_Melee\sound\SLX_Slash.wss",0.002,1};
 soundContinuous = 1;
 ffCount = 1;
 optics = 0;
 recoil = "SLX_Swing";
 autoFire = 1;
 aiRateOfFire = 0.7;
 aiRateOfFireDistance = 2.2;
 useAction = 0;
 useActionTitle = "";
};
class SLX_M9_Bayonet_Knife_Stab: SLX_M9_Bayonet_Knife
{
 displayName = "M9 Bayonet Knife";
 displayNameMagazine = "Knife Sheath";
 shortNameMagazine = "Knife Sheath";
 magazines[] = {"this"};
 modes[] = {"Single"};
 multiplier = 1;
 burst = 4;
 dispersion = 0.2;
 sound[] = {"\SLX_Melee\sound\SLX_Slash.wss",0.002,1};
 soundContinuous = 1;
 ffCount = 1;
 optics = 0;
 recoil = "SLX_Stab";
 autoFire = 1;
 aiRateOfFire = 0.7;
 aiRateOfFireDistance = 2.2;
 useAction = 0;
 useActionTitle = "";
};
class SLX_M9_Bayonet_Knife_Under: SLX_M9_Bayonet_Knife
{
 displayName = "M9 Bayonet Knife";
 displayNameMagazine = "Knife Sheath";
 shortNameMagazine = "Knife Sheath";
 magazines[] = {"this"};
 modes[] = {"Single"};
 multiplier = 1;
 burst = 5;
 dispersion = 0.2;
 sound[] = {"\SLX_Melee\sound\SLX_Slash.wss",0.002,1};
 soundContinuous = 1;
 ffCount = 1;
 optics = 0;
 recoil = "SLX_Swing";
 autoFire = 1;
 aiRateOfFire = 0.7;
 aiRateOfFireDistance = 2.2;
 useAction = 0;
 useActionTitle = "";
};
class SLX_M9_Bayonet_Knife_Anim: SLX_M9_Bayonet_Knife
{
 magazines[] = {"this"};
 modes[] = {"Single"};
 multiplier = 1;
 burst = 5;
 dispersion = 0.1;
 sound[] = {"\SLX_Melee\sound\SLX_Slash.wss",0.002,1};
 soundContinuous = 1;
 ffCount = 1;
 optics = 0;
 recoil = "empty";
 autoFire = 1;
 aiRateOfFire = 0.7;
 aiRateOfFireDistance = 2.2;
 useAction = 0;
 useActionTitle = "";
};
class SLX_M9_Bayonet_Knife_Item: SLX_M9_Bayonet_Knife
{
 displayName = "M9 Bayonet Knife (I)";
 initSpeed = 30;
 Type = 131072;
 magazines[] = {"this"};
 modes[] = {"Single"};
};
class SLX_AK74_Bayonet_Knife_Item: SLX_OKC3S_Bayonet_Knife_Item
{
 picture = "\SLX_Melee\AK74Bayo\SLX_i_ak74bayonet.paa";
 displayName = "AK74 Bayonet Knife (I)";
 displayNameMagazine = "Knife Sheath";
 shortNameMagazine = "Knife Sheath";
 Type = 131072;
 magazines[] = {"this"};
 modes[] = {"Single"};
 dispersion = 0.4;
 multiplier = 1;
 burst = 10;
 sound[] = {"\SLX_Melee\sound\SLX_QuickSwing.wss",0.002,1};
 soundContinuous = 1;
 ffCount = 1;
 optics = 0;
 recoil = "empty";
 autoFire = 1;
 aiRateOfFire = 0.1;
 aiRateOfFireDistance = 2.1;
 useAction = 0;
 useActionTitle = "";
};

Share this post


Link to post
Share on other sites

I checked out the models and they look or (that is they look like knives and not binos). I also traced inheritance in the configs and it looked ok there too.

I started looking through meleeanim.sqf and there is a weird block of code about removing and adding binos and I wonder if that is the culprit. Does the unit have a knife in hand before slashing and then binos or binos the whole time?

Share this post


Link to post
Share on other sites

Sorry for the late reply, (work)

Does the unit have a knife in hand before slashing and then binos or binos the whole time?

No, when ingame youll have your main rifle, and then while holding the main rifle, you can use the knife,

you just switch to it, then when you hit fire, your player character does the knife slash animation but... its the binoculars from start to finish,

the knife does not show up at all, only in the gear do you see the knife.

Share this post


Link to post
Share on other sites
there is a weird block of code about removing and adding binos and I wonder if that is the culprit.

Sounds like it would be the one, but if its doing that why would it add the binoculars instead of the knife.

Did you figure it out if that was indeed the problem?

Share this post


Link to post
Share on other sites

Sorry for the late response...I have time to try to tackle it this weekend.

--Edit Update--

I just spent about two hours trying different things out without any real success. Here are some highlights:

1. The code I mentioned above in meleeanim.sqf gives a player bino and/or nvgs if they don't have them when they "fire" the knife. It you remove the code and remove binos and nvgs from the player, it does not give them the items nor do the binos appear in the players hands...BUT...nothing appears in the player's hand...it just looks like a stroke/punch.

2. The configs are confusing because there are knife mags and knife weapons...all with the same names...this could be causing conflicts because I don't think you are supposed to give a wep and a magazine the same class name. The configs are also confusing because there are a lot similar classes (knife, knife_under, knife_anim, knife_item, etc.). It is hard to sort each out so I might strip everything except the most basic and see what happens. I also need to temporarit move melee_give because it preloads the unit with a knive and mag and I need to be able to control each better.

Edited by Loyalguard
Update

Share this post


Link to post
Share on other sites

Hi Loyalguard np man, I been getting in late myself, dam work.

It you remove the code and remove binos and nvgs from the player, it does not give them the items nor

do the binos appear in the players hands...BUT...nothing appears in the player's hand...it just looks like a stroke/punch.

Interesting.

I'm wondering if instead of the binos, or nvgs as listed add the classnames for the knife instead,

as it seems that the script gives the binos without a problem, or would that conflict with meleegive script?

Share this post


Link to post
Share on other sites

I can try that but it should be happening anyway because after the bino/nvg code it tells the unit to select the knife so it should happen by default.

I will play with it some more tonight.

The other weird part is that code that adds binos/NVGs in meleeanim.sqf. If you start off without binos (or NVGs) and use the knife you will get them both automatically and you have all three even though there are two slots in the gear dialog.

Edited by Loyalguard

Share this post


Link to post
Share on other sites

So I have tried what seems like every combination of weapon/slot type and scripting combination without luck. If the knife is not type 4096 then binos or NVG show up in the unit's hand and if there are none then an empty hand. I might try some of the other variant knife classes but I have a feeling the results will be the same. This is only a guess, but I think the problem might be the animation itself. Perhaps it will only work with slot 4096 weapons. I know very little about animations so I am afraid I cannot be of any assistance there.

Share this post


Link to post
Share on other sites

Hmm,

Im wondering and its just a theory, not sure if its possible but, is it possible that since the binos are being used

that when it adds the binos to switch the binos for the knife image, so that when it calls for binos when using

the knife you get the knife instead, get what im saying?

Share this post


Link to post
Share on other sites

So Loyalguard,

Any ideas or have you discovered anything on this issue, I looked at it for a bit but its rather beyond me I mean i have ideas but I'm still a noob at this scripting.

Someone has to know what to do, all we want to do is get the knife to show in the hand instead of the binoculars.

Share this post


Link to post
Share on other sites

I was able to spend a little time this weekend and I will try some more over the next few days. What I am doing is stripping down the configs and the primary script to simplify, identify the problem areas, and adjust. If there is a config/scripting solution I think I can find it....if it is a .rtm limitation then we may be stuck. I hope to have some progress for you soon.

Share this post


Link to post
Share on other sites

Sounds good, anything I can do?

Theres got to be other people that would know what the problem may be, i mean the problem is rather simple the binoculars showup

in the hand of your character instead of the knife easy enough, but the real issue is why does the knife not show and the binos do instead.

Classname conflict, or config being told to run binos instead because originally its based off of the position of where the knife was

initially which in the binocular slot in your gear, which now we have solved is now in the slots where your compass, and map is ect,.

Share this post


Link to post
Share on other sites

That is exactly why I am "temporarily" removing all of the classes except for thos directly related to the SLX_OKC3S_Bayonet for both the weapon itself and the magazines to make sure there are no conflicts and then I can focus on a solution. It is a little tricky because the inheritance tree is a little (unintentionally) obfuscated because of name derivations and similarilty between so many of the classes.

Share this post


Link to post
Share on other sites

I see.

the inheritance tree is a little (unintentionally) obfuscated because of name derivations and similarilty between so many of the classes.

You should see the CPP, the class tree is very big, as the kife isn't the only thing workign for this.

This file can be doing more stuff, i mean the game should have more then just the knife. I dont think Solus was done with this file.

heres the readme just for SLX Melee alone!:

i had edited to make better readable but maybe in this there can provide some possible answers to some things we are having trouble figuring out.

SLX Melee Weapons

Version 1.01

This pack contains a basic melee weapon system and includes examples of traditional and improvised hand-to-hand weapons.

Weapons:

Punch/rifle butt, takes no slots:

Hand-to-Hand (Always shown in menu)

Hand-to-Hand (Hidden until all other weapons are empty)

Hand-to-Hand level 2 (more powerful magazine)

Hand-to-Hand level 3 (one hit kill magazine)

Pistol slot weapons with recoil and animation types:

Readily availabe:

Machete

Axe

OKC3S Bayonet Knife with stabbing(player only), slashing, and underhand grip types

M9 Bayonet Knife (same features as OKC3S)

Folding entrenching tool (Gerber tri-fold spade)

Wood entrenching tool (Spetsnaz shovel)

2x4

Baseball bat

Shovel

*Sledgehammer

*Pipe

*Pool cue

*Hammer

*Crowbar

*Monkey wrench

*Sickle

*Golf club

*Pickaxe

Improvised/Home made:

Heavy chain with padlock

2x4 with nails

Baseball bat with nails

Cross

Stop sign

*Scrap metal sword

*Toaster flail with nails and barbed wire

*Street signs(various)

Traditional:

Ninja sword

Nunchaku

*Japanese sword

*Claymore

*Mace

*Flail

*War hammer

*Khukuri

Pistol slot weapons with stabbing recoil type only:

*Broken bottle

*Screwdriver

*Shiv

Primary slot weapons:

Ninja sword

Pitchfork

Rake

Cross

2x4

Chair

Staff

Tonfa

Shovel

*Spear(knife on stick+extra spear for throwing)

Item slot Quick Slash weapons:

OKC3S Bayonet Knife

M9 Bayonet Knife

Ninja Sword

Secondary slot Quick Slash weapons:

Ninja Sword

Cross

2x4

*Claymore

*indicates planned status

Primary and pistol slot weapons with recoil do not use scripts and can be picked up and used by any unit.

Pistol slot weapons without recoil are for use with units using the fired event handler animation script only.

Using melee weapons:

To attack, just select the weapon and press the fire button while close to the target! The weapons hit from near the tip on sharp weapons or the largest/heaviest part on blunt weapons, so try and aim that part to where you want to hit.

Recoil based, primary/secondary/item slot, and hand-to-hand melee weapons:

These ones only have one attack, to use them just keep pressing the fire button!

Animated melee weapons:

The biggest feature of the pack is the pistol slot weapons that use a script to play an animation. The default attack, without turning or moving will swing the weapon in a random direction so you can stand still and flail at your target! You can also control the direction you swing in by either turning in the direction you want to swing while stationary, or by moving in the direction you want to swing in. The more you turn to the side the steeper the angle, from a diagonal swing from the top, to a horizontal swing, and then a diagonal swing from below.

Directional swings while moving:

Forward: Vertically straight down from over your head.

Right-forward: Diagonally from top left to bottom right.

Left-forward: Diagonally from top right to bottom left.

Right: Horizontally from left to right.

Left: Horizontally from right to left.

Right-back: Diagonally from bottom right to top left.

Left-back: Diagonally from bottom left to top right.

Back: Stab forward.

You will also take a step in the direction you attack in and you can only attack while standing.

Basic use in missions:

The units provided under the "SLX Melee" class in the editor have everything nessissary to get started right away with their loadout. You can place the provided units in the editor or you can set up your own units. To equip other units with pistol slot weapons that use recoil you can simply use "this addMagazine {Weapon_Class_Name}; this addWeapon {Weapon_Class_Name}" in their init field or in a script. For primary slot weapons use the class name with "Melee" on the end for the weapon and "Base" for the magazine. Example: Weapon: {SLX_SwordMelee} Magazine: {SLX_SwordBase}

To use animations:

Give the unit the weapon class name with "_Anim" on the end(example: SLX_Sword becomes SLX_Sword_Anim), then give the unit a fired event handler with the weapon names in the array:

this addEventHandler [{Fired},{if (format[{%1},SLX_MeleeAnims]==format[{%1},{scalar bool array string 0xfcffffef}]) then {SLX_MeleeAnims=[]}; if !((_this select 0) in SLX_MeleeAnims) then {if ((_this select 1) in [{WEAPON_NAME_1},{WEAPON_NAME_2},{ETC}]) then {_this exec {\SLX_Melee\SLX_Melee_Anim.sqs};};};}]

Don't forget to put all the weapon names you want the unit to use in this part "((_this select 1) in [{Weapon_Name_1},{etc}])". Or you can replace the array with a global variable with all weapon names you want to use, then define it in init.sqs or somewhere. Ex: "((_this select 1) in SLX_MyMeleeList)" then in init.sqs "SLX_MyMeleeList = [{weaponName1},{etc}]"

Here's a default init line with all included melee weapons in the array:

this addEventHandler ["Fired",{if (format["%1",SLX_MeleeAnims]==format["%1","scalar bool array string 0xfcffffef"]) then {SLX_MeleeAnims=[]}; if !((_this select 0) in SLX_MeleeAnims) then {if ((_this select 1) in ["SLX_Sword_Anim","SLX_Sword_Back","SLX_Sword_Item","SLX_Machete_Anim","SLX_Machete_Item","SLX_Knife_Anim","SLX_Knife_Item","SLX_M9_Bayonet_Anim","SLX_M9_Bayonet_Item","SLX_Axe_Anim","SLX_2x4_Anim","SLX_2x4_Back","SLX_2x4Nails_Anim","SLX_Bat_Anim","SLX_BatNails_Anim","SLX_Shovel_East_Anim","SLX_Shovel_East_Item","SLX_Spade_Anim","SLX_Spade_Item","SLX_Chain_Anim","SLX_Nunchaku_Anim","SLX_Cross_Anim","SLX_Cross_Back","SLX_SignStop_Anim","SLX_Shovel_Anim"]) then {_this exec "\SLX_Melee\SLX_Melee_Anim.sqs";};};}]

Weapon Class names:

Pistol slot weapons:

Hand-to-Hand:

SLX_Melee

SLX_Melee2

SLX_Melee3

SLX_MeleeHide

Ninja Sword

SLX_Sword

SLX_Sword_Anim

SLX_Sword_Back

SLX_Sword_Item

Machete

SLX_Machete

SLX_Machete_Anim

SLX_Machete_Item

OKC3S Bayonet Knife

SLX_Knife

SLX_Knife_Stab

SLX_Knife_Under

SLX_Knife_Anim

SLX_Knife_Item

M9 Bayonet Knife

SLX_M9_Bayonet

SLX_M9_Bayonet_Stab

SLX_M9_Bayonet_Under

SLX_M9_Bayonet_Anim

SLX_M9_Bayonet_Item

SLX_Axe

SLX_Axe_Anim

SLX_2x4

SLX_2x4_Anim

SLX_2x4_Back

SLX_2x4Nails

SLX_2x4Nails_Anim

Baseball Bat

SLX_Bat

SLX_Bat_Anim

SLX_BatNails

SLX_BatNails_Anim

SLX_Shovel_East

SLX_Shovel_East_Anim

SLX_Shovel_East_Item

SLX_Spade

SLX_Spade_Anim

SLX_Spade_Item

SLX_Chain

SLX_Chain_Anim

SLX_Nunchaku

SLX_Nunchaku_Anim

SLX_Cross

SLX_Cross_Anim

SLX_Cross_Back

SLX_SignStop

SLX_SignStop_Anim

SLX_Shovel

SLX_Shovel_Anim

Primary slot weapons:

SLX_SwordBase

SLX_SwordStroke

SLX_ShovelBase

SLX_ShovelStroke

SLX_PitchforkBase

SLX_PitchforkStroke

SLX_RakeBase

SLX_RakeStroke

SLX_2x4Base

SLX_2x4Stroke

SLX_StaffBase

SLX_StaffStroke

SLX_TonfaBase

SLX_TonfaStroke

SLX_ChairBase

SLX_ChairStroke

SLX_CrossBase

SLX_CrossStroke

How it works:

Scripted animation melee weapons:

Basically, they are a pistol with a very low muzzle velocity that fires a burst of bullets while playing a swinging animation. The first bullet of the burst starts the script that plays the swinging animation.

This results in an arc of bullets along the path that the melee weapon swings through, hitting anything in their way and dealing damage to every part of the target it touches. If the bullets don't hit anything then they fall to the ground due to gravity and the time that the bullets live(unless SLX_MeleeExpensive = 1).

The fired event handler animation script must be attached to any unit that is going to use the animated melee weapons(by starting out with it or picking it up) or else there will be no animation for the unit when using the weapon and the unit will just stand there when attacking.

Recoil based melee weapons:

To get around having to attach an event handler to each unit for animations there are pistol slot weapons that use recoil to simulate an attack animation with the weapon. The recoil based melee weapons can be used by any unit without any scripts or extra configuration. The recoil weapons can also be used with the event handler script so that the unit can have animations with it while others without the event handler can still pickup and use the weapon correctly. However, units using the animations with recoil weapons still suffer a little recoil from the first shot.

Primary slot weapons:

Weapons that fire the "StrokeGun" shot type, and play the corresponting animation automatically. Uses no script. After the animation is done the single shot is detonated in the direction the unit is facing, level with the center of the unit, at the weapon's attacking range(usually about 1 meter from the ground and about 1-2 meters from the unit).

Hand-to-Hand weapons:

The Hand-to-Hand weapons work like the primary slot melee weapons. The unhidden Hand-to-Hand weapon can be selected at any time to do a melee attack with any rifle. The hidden Hand-to-Hand weapon can only be used when the unit is completely out of ammunition for all weapons. When the unit has both rifle slung and pistol holstered and uses the Hand-to-Hand mode then the "StrokeFist" shot is fired which is similar to "StrokeGun" but with the "StrokeFist" punch animation. The Hand-to-Hand weapons have several types of magazines for different strength attacks.

AI units:

AI units should be able to use all melee weapons somewhat effectively against other AI units, although against players they are too slow, but that could be improved if you increased the AI unit's turning ammount in their config similar to what the included unit's have. With animtions they sometimes appear to just flail around, but other times they look ok. With recoil weapons they sometimes hit targets a little out of their range without actually touching them due to the bullets flying too far.

Also AI's sometimes get stuck too far or too close to their targets and don't attack due to the way OFP handles range targeting. The weapons have been configured to avoid these situations as much as possible but they still sometimes happen.

AI squad leaders don't like to engage automatically, so a squad with 1 east AI unit and a squad with 1 west AI unit facing each other will not attack each other unless they are within attacking range.

If you give them some squad mates the other AI's will attack each other until only the leaders are left who will not attack each other. This is due to limitations of OFP squad AI, but you could fix it with a script if it's a problem for you, just make them move close together and they should fight.

Notes:

All melee weapons require magazines. Only primary slot weapons and the Hand-to-Hand weapons have infinite use, pistol slot weapons have a finite amount of use(10,000 strikes). Units without pistol slots(pre-Resistance) cannot equip pistol slot weapons. Melee animation script not tested in MP. Hand-to-Hand, recoil based, and primary slot melee weapons should work in MP.

Known bugs:

Melee weapons create a small flash and shoot smoke out when used by most units, unfortunately this is unavoidable due to the way the melee weapons are implemented. It can be corrected by removing smoke effects from the unit though, but the flash cannot be removed. See how it is set up for the included units in the config.cpp.

"Bullet" effects and hitting units too far away: Dust shooting up from holes in ground where the "bullets" hit. Can be mostly fixed by setting SLX_MeleeExpensive = 1 in init.sqs.

AI units aim into the air:

The AI units aim too high because the melee weapons are basically a gun with a very low muzzle velocity, so the AI is trying to compensate for the bullet drop by aiming up. This is unfortunately unavoidable for most units but can be fixed at the cost of the unit not being able to aim very high. See how it is set up for the included units in the config.cpp.

Quick Item/Secondary Slash anims:

Looks bad in third person with the rifle immediately flying to the slung position. This is a compromise between the quick slash being able to be used while holding a rifle or pistol or no weapon. It would be too difficult/complex/slow/inaccurate to detect what was being held at the time the quick slash was used, so the animation had to be similar to the slung rifle anim, the pistol anim, and the rifle anim. If the rifle was in another position then it would fly there when the quick slash was used from the pistol or no weapon anims which wouldn't look good either.

Change log:

1.0 @ 14-11-06 Initial release

1.01 @ 19-11-06

Changes:

Remove test tracer effects.

Make binoculars be the active item after using a melee item. Thanks KyleSarnik!

1.02 @ 12-13-06

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×