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

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.

Indeed! I am actualy making my changes in the config.cpp. I am am replacing it with a simplified version for the knife by using helijunkies config viewer to dump just the parent classes needed for the one knife. Once I figure out what I need to change for that, we can apply the changes throughout and then look for conflicts (or it works right off the bat!).

The other thing to realize about the readme is that I think it is from the OFP version so it is could be dated or incomplete so I would take anything in there with a grain of salt. From looking at the configs, models, etc. I think it is all in there but I can't be sure.

Share this post


Link to post
Share on other sites
I am actualy making my changes in the config.cpp. I am am replacing it with a simplified version for the knife

Oh good deal, the cpp is a mess, prob be best to make a new one anyways for the knife as it seems the rest of the other weapons are not even used,

I would assume there would be other scripts or maybe 1 big script where it would add the other weapons, at least i think thats how it would work.

According to the change log it looks as if it was for Arma1 as 2006 was when Arma1 was released.

Share this post


Link to post
Share on other sites

So the wife went out for a few hours tonight so I told the kids to go watch tv to give me a chance to work on this ;)

After banging my head against the keyboard for an hour trying to find a scripting solution like quickly and add then subtract bino and switch between binos and knife I turned my attention toward the the cfgMoves portion(s) of the .cpp. I know nothing about cfgMoves and there is very little reference material. But, with properties like "showInHand" and "enableBinos" there may be some hope there. The problem is that the primary move used by meleeanim.sqf appears to have several parents and I am unsure of the proper config tree due to the different base classes.

What I assume is the problem is this: When we change the slot type of the knife, perhaps we also change its simulation (at least as far as the animation is concerned) that does not allow it to be shown. Perhaps this can be fixed with a cfgMoves change maybe not, but unfortunately, I am over my head. I am happy to keep working on it but what is really needed is an animation expert.

Share this post


Link to post
Share on other sites

Hmm, interesting.

Theres plenty of folks in the forum here that could possibly either give a good clue or basically solve the issue altogether,

i can name a few guys but its really up to them to want to look at the file, they would have to review the

thread here somewhat to get an idea of what we mostly you are dealing with.

As i recognize the commands and such but have no idea on how they all work together, Im 10 cents short of buying the full pack of gum. :D

I'll ask around and see who could take a look at this for us.

Share this post


Link to post
Share on other sites

Hey Loyalguard,

Can you post in code the exact scripts, and cfg or files that your having issues with, Im hoping that the couple of guys i had contacted would possibly take a look at whats going on, and give us/you an idea what the problem is.

Share this post


Link to post
Share on other sites

Below are the key items in question... the knife from cfgWeapons (here type is the default 4096), the animation SLX_ItemSlashStandWalkF from cfgMoves, and SLX_Melee_Anim.sqf that shows the stabbing animation. If we change type = 4096 to type = 131072 the knife doesn't show, instead it is either binos, NVGs, or nothing. What makes changing this value not display the knife.

The configs are extracted from helihunkie's config viewer

SLX_OKC3S_Bayonet_Knife_Item from CfgWeapons

class SLX_OKC3S_Bayonet_Knife_Item : SLX_OKC3S_Bayonet_Knife {

scope = 2;

displayName = "OKC3S Bayonet Knife (I)";

initSpeed = 300;

type = 4096;

magazines[] = {"SLX_OKC3S_Bayonet_Knife_Item"};

modes[] = {"Single"};

SLX_ItemMelee = 1;

// Values from class: SLX_OKC3S_Bayonet_Knife //

model = "\SLX_Melee\OKC3S\SLX_OKC3S_Bayonet_Knife";

picture = "\SLX_Melee\OKC3S\SLX_i_OKC3S.paa";

displayNameMagazine = "Knife Sheath";

shortNameMagazine = "Knife Sheath";

// Values from class: SLX_MeleeWeapon //

SLX_Melee = 1;

access = 2;

scopeWeapon = 2;

scopeMagazine = 0;

valueWeapon = 0;

valueMagazine = 0;

magazineType = 0;

autoReload = 1;

flash = "";

flashSize = 0;

maxLeadSpeed = 100;

muzzlePos = "";

muzzleEnd = "";

dexterity = 20;

uiPicture = "\SLX_Melee\SLX_ui_Melee.paa";

modelSpecial = "";

modelOptics = "";

optics = 0;

distanceZoomMin = 50;

distanceZoomMax = 50;

count = 100000;

reloadTime = 0.1;

magazineReloadTime = 0.1;

drySound[] = {"", 0, 1};

reloadMagazineSound[] = {"", 0, 1};

reloadSound[] = {"", 0, 1};

aiRateOfFire = 0.7;

aiRateOfFireDistance = 2.2;

minRange = 0;

minRangeProbab = 0.8;

midRange = 0.3;

midRangeProbab = 0.8;

maxRange = 3;

maxRangeProbab = 0;

fireLightDuration = 0;

fireLightIntensity = 0;

cursor = "Vehicle_Grenade_W";

cursoraim = "Vehicle_Grenade_W";

cursorSize = 1;

// Values from class: Pistol //

opticsFlare = 0;

nameSound = "Pistol";

bullet1[] = {"ca\sounds\weapons\shells\pistols_shell_metal_04", 0.177828, 1, 30};

bullet2[] = {"ca\sounds\weapons\shells\pistols_shell_metal_03", 0.177828, 1, 30};

bullet3[] = {"ca\sounds\weapons\shells\pistols_shell_metal_02", 0.177828, 1, 30};

bullet4[] = {"ca\sounds\weapons\shells\pistols_shell_metal_01", 0.177828, 1, 30};

bullet5[] = {"ca\sounds\weapons\shells\pistols_shell_dirt_01", 0.316228, 1, 25};

bullet6[] = {"ca\sounds\weapons\shells\pistols_shell_dirt_02", 0.316228, 1, 25};

bullet7[] = {"ca\sounds\weapons\shells\pistols_shell_dirt_03", 0.316228, 1, 25};

bullet8[] = {"ca\sounds\weapons\shells\pistols_shell_dirt_04", 0.316228, 1, 25};

bullet9[] = {"ca\sounds\weapons\shells\pistols_shell_soft_01", 0.177828, 1, 25};

bullet10[] = {"ca\sounds\weapons\shells\pistols_shell_soft_02", 0.177828, 1, 25};

bullet11[] = {"ca\sounds\weapons\shells\pistols_shell_soft_03", 0.177828, 1, 25};

bullet12[] = {"ca\sounds\weapons\shells\pistols_shell_soft_04", 0.177828, 1, 25};

soundBullet[] = {"bullet1", 0.083, "bullet2", 0.083, "bullet3", 0.083, "bullet4", 0.083, "bullet5", 0.083, "bullet6", 0.083, "bullet7", 0.083, "bullet8", 0.083, "bullet9", 0.083, "bullet10", 0.083, "bullet11", 0.083, "bullet12", 0.083};

htMin = 1;

htMax = 300;

afMax = 0;

mfMax = 0;

mFact = 1;

tBody = 100;

opticsZoomMin = 0.25;

opticsZoomInit = 0.85;

opticsZoomMax = 1.3;

// Values from class: PistolCore //

canLock = 0;

// Values from class: Default //

value = 2;

ammo = "";

showAimCursorInternal = 1;

cursorAimOn = "";

laser = 0;

simulation = "Weapon";

multiplier = 1;

burst = 1;

sound[] = {"", 1, 1};

soundBegin[] = {"sound", 1};

soundEnd[] = {"sound", 1};

soundLoop[] = {"sound", 1};

soundContinuous = 0;

soundBurst = 1;

emptySound[] = {"", 1, 1};

ballisticsComputer = 0;

irDistance = 0;

dispersion = 0.002;

aiDispersionCoefX = 1;

aiDispersionCoefY = 1;

enableAttack = 1;

ffMagnitude = 0;

ffFrequency = 1;

ffCount = 1;

recoil = "empty";

recoilProne = "";

modelMagazine = "";

irLaserPos = "laser pos";

irLaserEnd = "laser dir";

cartridgePos = "nabojnicestart";

cartridgeVel = "nabojniceend";

selectionFireAnim = "zasleh";

memoryPointCamera = "eye";

useModelOptics = 1;

opticsID = 0;

opticsPPEffects[] = {};

forceOptics = 0;

useAsBinocular = 0;

opticsDisablePeripherialVision = 0.67;

primary = 10;

showSwitchAction = 0;

showEmpty = 1;

autoFire = 0;

autoAimEnabled = 1;

showToPlayer = 1;

backgroundReload = 0;

reloadAction = "";

muzzles[] = {"this"};

useAction = 0;

useActionTitle = "";

canDrop = 1;

weaponLockDelay = 0;

weaponLockSystem = 0;

cmImmunity = 1;

handAnim[] = {};

lockingTargetSound[] = {"\ca\Tracked\Data\Sound\alarm_loop1", 0.000316228, 2};

lockedTargetSound[] = {"\ca\Tracked\Data\Sound\alarm_loop1", 0.000316228, 6};

artilleryDispersion = 1;

artilleryCharge = 1;

fireSpreadAngle = "1.25f";

descriptionShort = "";

}


[/spoiler]

SLX_ItemSlashStandWalkF from CfgMoves
class SLX_ItemSlashStandWalkF : AmovPercMstpSrasWpstDnon { 
 actions = "PistolStandActions"; 
 file = "\Ca\Anims\Characters\data\Anim\sdr\mel\erc\stp\non\non\AmelPercMstpSnonWnonDnon_amaterUder3"; 
 speed = 0.7; 
 looped = 1; 
 showHandGun = 0; 
 showItemInHand = 0; 
 showItemInRightHand = 1; 
 limitGunMovement = 0.6; 
 disableWeapons = 0; 
 disableWeaponsLong = 0; 
 aimPrecision = 0.1; 
 relSpeedMin = 0.7; 
 relSpeedMax = 1; 
 interpolationSpeed = 20; 
 connectTo[] = {}; 
 connectFrom[] = {}; 
 interpolateFrom[] = {"AmovPercMstpSrasWpstDnon", 2, "AmovPercMwlkSrasWpstDf", 2, "AmovPercMrunSlowWpstDf", 2, "AmovPercMstpSnonWnonDnon", 2, "AmovPercMwlkSnonWnonDf", 2, "AmovPercMrunSnonWnonDf", 2, "AmovPercMstpSrasWrflDnon", 2, "AmovPercMwlkSrasWrflDf", 2, "AmovPercMrunSrasWrflDf", 2, "AmovPknlMstpSrasWrflDnon", 2, "SLX_ItemSlashStandWalkF", 3}; 
 interpolateTo[] = {"AmovPercMstpSrasWpstDnon", 2, "AmovPercMwlkSrasWpstDf", 2, "AmovPercMrunSlowWpstDf", 2, "AmovPercMstpSnonWnonDnon", 2, "AmovPercMwlkSnonWnonDf", 2, "AmovPercMrunSnonWnonDf", 2, "AmovPercMstpSrasWrflDnon", 2, "AmovPercMwlkSrasWrflDf", 2, "AmovPercMrunSrasWrflDf", 2, "AmovPknlMstpSrasWrflDnon", 2, "SLX_ItemSlashStandWalkF", 3}; 

 // Values from class: AmovPercMstpSrasWpstDnon //

 leftHandIKCurve[] = {1}; 
 rightHandIKCurve[] = {1}; 
 duty = -0.4; 
 showWeaponAim = 1; 
 disableHandGranade = 0; 
 aiming = "aimingPistol"; 
 aimingBody = "aimingUpPistol"; 
 soundEnabled = 0; 
 enableBinocular = 1; 
 leftHandIKBeg = 1; 
 leftHandIKEnd = 1; 
 rightHandIKBeg = 1; 
 rightHandIKEnd = 1; 
 collisionShape = "ca\Anims\Characters\Data\Geom\Sdr\Perc_Wpst.p3d"; 
 weaponIK = 2; 
 enableOptics = 2; 
 headBobStrength = 0.223881; 
 headBobMode = 2; 

 // Values from class: StandBase //

 leaningFactorBeg = 1; 
 leaningFactorEnd = 1; 

 // Values from class: Default //

 soundEdge[] = {0.5, 1}; 
 variantsPlayer[] = {}; 
 variantsAI[] = {}; 
 variantAfter[] = {5, 10, 20}; 
 interpolateWith[] = {}; 
 forceAim = 0; 
 access = 3; 
 enableMissile = 0; 
 onLandBeg = 0; 
 onLandEnd = 0; 
 onLadder = 0; 
 canPullTrigger = 1; 
 visibleSize = 0.75012; 
 camShakeFire = 1; 
 soundOverride = ""; 
 terminal = 0; 
 equivalentTo = ""; 
 connectAs = ""; 
 leaning = "leaningDefault"; 
 untiltWeapon = "untiltWeaponDefault"; 
 legs = "legsDefault"; 
 head = "headDefault"; 
 leaningFactorZeroPoint = -1; 
 interpolationRestart = 0; 
 enableDirectControl = 1; 
 controlHead = 0; 
 hasCollShapeSafe = 0; 
 collisionShapeSafe = ""; 
 boundingSphere = 1; 
 enableAutoActions = 0; 
 preload = 0; 
 walkcycles = 1; 
}

SLX_Melee_Anim.sqf

// ;player addEventHandler ["FIRED",{_this exec "SLX_MELEE\SLX_MELEE_ANIM.SQS"}]
// SLX_Melee_Fired = (compile preProcessFileLineNumbers 'SLX_Melee\SLX_Melee_Anim.sqf');
_unit = _this select 0;
_weapon=(_this select 1);

if(!(canstand _unit))exitwith{};

if( (!local _unit) || ((_this select 5) iskindof "SLX_ZombieHandHit") )exitwith{};

_unit setVariable ["SLX_MeleeAnim",[true,1]];

_ammo=_unit ammo _weapon;
_ammo=((ceil (_ammo*.1))*10)-5;

_target=vehicle _unit findnearestEnemy vehicle _unit;

if( ((weapons _unit) find "Binocular")<((weapons _unit) find _weapon) )then{_unit removeweapon "Binocular"; _unit addweapon "Binocular"};
if( ((weapons _unit) find "NVGoggles")<((weapons _unit) find _weapon) )then{_unit removeweapon "NVGoggles"; _unit addweapon "NVGoggles"};
_unit selectWeapon _weapon;

if( (!isplayer _unit) && (!isnull _target) )then{
_dir=((getpos _target select 0) - (getpos _unit select 0)) atan2 ((getpos _target select 1) - (getpos _unit select 1)); 

_unit setdir _dir; 
_unit setvelocity [((velocity _unit) select 0) + (((_unit weapondirection _weapon) select 0)*2.5),((velocity _unit) select 1) + (((_unit weapondirection _weapon) select 1)*2.5),((velocity _unit) select 2)];
};


_moves=["slx_itemslashstandwalkf"];

_unit playmoveNow (_moves select floor(random((count _moves)-0.5)));

[_unit,_moves,_ammo,_weapon] spawn {

_unit=_this select 0;
_moves=_this select 1;
_ammo=_this select 2;
_weapon=_this select 3;

_daytime=daytime+(0.000284195*1);
_st=time;
waitUntil { 
((animationstate _unit) in _moves) 
||
(daytime>_daytime)
||
(time>_st+1)
};

if((!((animationstate _unit) in _moves)))then{
_unit switchmove (_moves select floor(random((count _moves)-0.5)));
};


sleep 0.1;

_daytime=daytime+(0.000284195*1);
_st=time;
waitUntil {
(!((animationstate _unit) in _moves))
||
((_ammo-25)>(_unit ammo _weapon))
||
(daytime>_daytime)
||
(time>_st+1)
};

_unit setVariable ["SLX_MeleeAnim",[false,1]];
};

Share this post


Link to post
Share on other sites

Hey Loyalguard,

Got a reply from smookie, this is what he says:

It depends on how knife is working, but if it is not replacing the binoc, it will not appear in the soldier mesh as long as it does not exist as a proxy.

In other words, a new proxy would have to be added to EACH soldier mesh for this to be showable as a new piece of equipment.

Then it would require engine coding so that the knife would be actually usable as a different kind of eq/wep than the preexisting ones.

There would be a workaround for this by having a sticky action menu or key activation (predefinable in userconfig)

which would delete one of the mentioned pieces (lets say BINOCs) and add them back again when using knife has finished.

I will ask him to ask these other guys to see what they know.

but does what he says make sense to you, or does that answer the questions regarding the issue with the binos?

Edited by Gnter Severloh

Share this post


Link to post
Share on other sites

It does help/confirm what I thought might be the problem. If you think about all of the item type (type = 131072) "weapons" in game such as map, radio, compass, etc. -- you never see them in a unit's hand -- only in the gear (or map) screen. So, when we made the knife that same type of weapon, there is no way for the game to show it in the unit's hand.

I am afraid we may be out of options without a major overhaul which is beyond my abilities :(

That being said, if the knife remains a

binocular" type (type =4096), if you use the knife you will find that the player can have binos, NVGs, and a knife all in inventory -- just not visible in the gear screen.

Share this post


Link to post
Share on other sites
If you think about all of the item type (type = 131072) "weapons" in game such as map, radio, compass, etc. -- you never see them in a unit's hand -- only in the gear (or map) screen. So, when we made the knife that same type of weapon, there is no way for the game to show it in the unit's hand.

A ha!

that makes absolute sense! why didn't we think of this before, you are right the map, compass and what not do not show in ones hand,

however the compass does show when you press a corresponding key for it and map shows when you press M.

Idea

But now this gives me the idea that maybe we should move the knife to the pistol slot, problem is if we do that then

you will have only one option, you either want a knife or a pistol, but you cant have both. Shall we try it?

I shall try it and see if it works ingame.

---------- Post added at 05:44 AM ---------- Previous post was at 05:20 AM ----------

Back.

Alright i tested it changed the config, in slx_melee to slot 2 which is the pistol slot. problem is the knife dont showup at all

in the gear or outside with character, so either i missed a spot in the cfg or it wont work at all.

this is the error i got apon startup:

and before the mission started:

Warning Message: Script SLX_Melee\XEH_PostInit_Once.sqf not found
[2927,88.198,0,"CBA_VERSIONING: cba=0.8.2.169, "]
[2927,88.237,0,"XEH: PostInit Finished. State: _isClient=true, _isJip=false, _isDedClient=false, _isServer=true, _isDedServer=false, _playerCheckDone=true, _sp=true, _startInitDone=true, _postInitDone=true, _mpRespawn=false, _machineType=1, _sessionId=2"]
Warning Message: Cannot open object slx_melee\okc3s\slx_okc3s_bayonet_knife.p3d
Warning Message: Picture \slx_melee\okc3s\slx_i_okc3s.paa not found
Warning Message: Picture \slx_melee\okc3s\slx_i_okc3s.paa not found
Warning Message: Picture \slx_melee\okc3s\slx_i_okc3s.paa not found
Warning Message: Picture \slx_melee\okc3s\slx_i_okc3s.paa not found
Cannot load sound 'slx_melee\sound\slx_quickswing.wss'
Cannot load sound 'slx_melee\sound\slx_quickswing.wss'
Cannot load sound 'slx_melee\sound\slx_quickswing.wss'
Cannot load sound 'slx_melee\sound\slx_quickswing.wss'
Warning Message: Picture \slx_melee\okc3s\slx_i_okc3s.paa not found
Warning Message: Picture \slx_melee\okc3s\slx_i_okc3s.paa not found
Warning Message: Picture \slx_melee\okc3s\slx_i_okc3s.paa not found

However when i went into the gear the knife was there, although you couldn't see it the words (title of weapon)were there.

When you clicked on it the pistol slot highlighted as all the slots highlight (light up) when you click on the weapon or item.

im going to review the slx_melee cpp again and see if I missed anything or had something wrong.

slot 2 is pistol slot according to the wiki:

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

---------- Post added at 06:14 AM ---------- Previous post was at 05:44 AM ----------

Nope the cpp is correct the way I had it.

I had another idea to test the original file before I started this thread with files in question to change the slots,

and well with the knife being in the binos slot and we know you cannot have the bios or nvg with the knive.

The knife does show in th player character's hand when in the slot.

At this point after all the testing might just have to just rebuild the whole file to just have the knife but in the slot below

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

In a way leaving it as is, is the only option.

Im wondering if we can just rebuild this, remove all the extra weapons listed, and just have t with the 2 knives for the ak47,

and the bluefor one, and allocate it to the right slot with updated cpp pointing to the new slot so that the new slot loads the pic of the knife.

your thoughts loyalguard.

Share this post


Link to post
Share on other sites

I did play with pistols a little bit. Let me take a look again. No promises on time but let me see what I can so.

Share this post


Link to post
Share on other sites

Ok,

I did move the knife to the pistol slot but not even the pic would show up in the gear, unlike the previous slot in the

small items slots where the knife would not show up in the player character's hand.

Thing too i forgot to mention was that in the pistol slot, when you switch to the knife ingame in terms of going to

use the weapon and then hit left mouse button to fire it, the player character doesn't do the animation like he

does with the other slots, basically nothing happens so its rather farked.

and that just changing the number in the cpp to the pistol slot which is 2.

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  

×