that's more like it :D
package this function in your server.cs or any other file really, it dosent matter where, but you only need this code ONCE
function Armor::onTrigger(%this,%obj,%slot,%val)
{
%CurrentlymountedImage = %obj.getMountedImage(0);
if(%slot == 4 && %val && isObject(%obj.getMountedImage(0) && %obj.getMountedImage(0).item.ImageScopeState != "")
{
if(%obj.getMountedImage(0) == %CurrentlymountedImage.item.ImageHipFireState.getID())
{
%obj.updateArm(%obj.getMountedImage(0).item.ImageScopeState,0);
%obj.mountImage(%obj.getMountedImage(0).item.ImageScopeState,0);
}
else if(%obj.getMountedImage(0) == %CurrentlymountedImage.item.ImageScopeState.getID())
{
%obj.updateArm(%obj.getMountedImage(0).item.ImageHipFireState,0);
%obj.mountImage(%obj.getMountedImage(0).item.ImageHipFireState,0);
}
return;
}
}
i know i forgeted up the alignment on that last bracket. oops.
remove the iron sight package on all of your weapons, then add these variables to each of your weapon's images:
ImageHipFireState = "NAME OF YOUR HIP FIRE IMAGE HERE!";
ImageScopeState = "NAME OF YOUR SCOPE IMAGE HERE!";
here is an example of the scripts on an item in my advanced weapon pack, i give you this just so you know how to define the new variables in the weapon's image, you can ignore all the other crap, it really doesn't apply here.
datablock ItemData(ADV_SMGItem)
{
category = "Weapon"; // Mission editor category
className = "Weapon"; // For inventory system
// Basic Item Properties
shapeFile = "./DTS/SMG/ADV_SMG.dts";
rotate = false;
mass = 1;
density = 0.2;
elasticity = 0.2;
friction = 0.6;
emap = true;
//gui stuff
uiName = "+SMG";
iconName = "./Icon_ADV_SMG";
doColorShift = false;
colorShiftColor = "0.196850 0.196850 0.196850 1.000000";
// Dynamic properties defined by the scripts
image = ADV_SMGDummyImage;
canDrop = true;
//Advanced Weapon properties
maxAmmo = 30;
canReload = 0;
ImageAmmoType = "Medium_rounds";
ImageEmptyState = "ADV_SMGEMPTYImage";
ImageScopeState = "ADV_SMG_SCOPEImage"; //Add this part here
ImageHipFireState = "ADV_SMGImage"; //And this part here, remember to use YOUR items images as the value, not mine.
ImageDummyState = "ADV_SMGDummyImage";
ScopedFOV = 40;
Accuracy = 0.0030;
AccuracyIncrease = 0.0008;
ScopeOffset = "0.0 1.0 -0.57";
//Modding Properties
CanSilence = 1;
CanAddStock = 1;
CanAddRedDot = 1;
CanAddACOG = 1;
//error ids (mod IDs above 1 usually stand for specific error messages)
CanAddMag = 3;
CanAddLazer = 3;
CanAddHuntingScope = 3;
CanAddNightScope = 3;
//mod Remover Item
CanRemoveMods = true;
};
tell me if something here doesn't work, because i edited the scripts a bit to better suit your pack. also if anyone else feels like using this code, feel free.