Yeah it is.I have been wondering about this for awhile now. Is it possible to add attatchments to your weapons in zombies via script?
That's sure but how, someone should take a look into the packer punch script and find it out.Yeah it is.
Here is "my" pack-a-punch script:That's sure but how, someone should take a look into the packer punch script and find it out.
packAPunch()
{
weap = maps\mp\zombies\_zm_weapons::get_base_name(self getCurrentWeapon());
weapon = get_upgraded(weap);
papGun = "zombie_knuckle_crack";
if(isDefined(weapon))
{
self TakeWeapon(weap);
self GiveWeapon(papGun);
self SwitchToWeapon(papGun);
wait 2;
self playSound("zmb_perks_packa_ready");
wait 1;
self TakeWeapon(papGun);
// Here it returns the weapon options (camo, attachments)
self GiveWeapon(weapon, 0, self maps\mp\zombies\_zm_weapons::get_pack_a_punch_weapon_options(weapon));
self GiveStartAmmo(weapon);
self SwitchToWeapon(weapon);
}
}
get_upgraded(weaponname)
{
if(isDefined(level.zombie_weapons[weaponname]) && isDefined(level.zombie_weapons[weaponname].upgrade_name))
{
return maps\mp\zombies\_zm_weapons::get_upgrade_weapon(weaponname, false);
}
else
{
return maps\mp\zombies\_zm_weapons::get_upgrade_weapon(weaponname, true);
}
}
get_pack_a_punch_weapon_options( weapon )
{
if ( !isDefined( self.pack_a_punch_weapon_options ) )
{
self.pack_a_punch_weapon_options = [];
}
if ( !is_weapon_upgraded( weapon ) )
{
return self calcweaponoptions( 0, 0, 0, 0, 0 );
}
if ( isDefined( self.pack_a_punch_weapon_options[ weapon ] ) )
{
return self.pack_a_punch_weapon_options[ weapon ];
}
smiley_face_reticle_index = 1;
base = get_base_name( weapon );
camo_index = 39;
lens_index = randomintrange( 0, 6 );
reticle_index = randomintrange( 0, 16 );
reticle_color_index = randomintrange( 0, 6 );
plain_reticle_index = 16;
r = randomint( 10 );
use_plain = r < 3;
if ( base == "saritch_upgraded_zm" )
{
reticle_index = smiley_face_reticle_index;
}
else
{
if ( use_plain )
{
reticle_index = plain_reticle_index;
}
}
/#
if ( getDvarInt( #"471F9AB9" ) >= 0 )
{
reticle_index = getDvarInt( #"471F9AB9" );
#/
}
scary_eyes_reticle_index = 8;
purple_reticle_color_index = 3;
if ( reticle_index == scary_eyes_reticle_index )
{
reticle_color_index = purple_reticle_color_index;
}
letter_a_reticle_index = 2;
pink_reticle_color_index = 6;
if ( reticle_index == letter_a_reticle_index )
{
reticle_color_index = pink_reticle_color_index;
}
letter_e_reticle_index = 7;
green_reticle_color_index = 1;
if ( reticle_index == letter_e_reticle_index )
{
reticle_color_index = green_reticle_color_index;
}
self.pack_a_punch_weapon_options[ weapon ] = self calcweaponoptions( camo_index, lens_index, reticle_index, reticle_color_index );
return self.pack_a_punch_weapon_options[ weapon ];
}
self GiveWeapon(weapon, 0, self calcweaponoptions( camo_index, lens_index, reticle_index, reticle_color_index ));
Yeah, no. That is how to change your retical. Check _zm_weapons, somewhere about 1/3rd down there is a load attachments script where the level stores attachment data.Here is "my" pack-a-punch script:
The answer is in the original GSC file maps\mp\zombies\_zm_weapons. It randomizes weapon data and then calculates the weapon options based on the results:Code:packAPunch() { weap = maps\mp\zombies\_zm_weapons::get_base_name(self getCurrentWeapon()); weapon = get_upgraded(weap); papGun = "zombie_knuckle_crack"; if(isDefined(weapon)) { self TakeWeapon(weap); self GiveWeapon(papGun); self SwitchToWeapon(papGun); wait 2; self playSound("zmb_perks_packa_ready"); wait 1; self TakeWeapon(papGun); // Here it returns the weapon options (camo, attachments) self GiveWeapon(weapon, 0, self maps\mp\zombies\_zm_weapons::get_pack_a_punch_weapon_options(weapon)); self GiveStartAmmo(weapon); self SwitchToWeapon(weapon); } } get_upgraded(weaponname) { if(isDefined(level.zombie_weapons[weaponname]) && isDefined(level.zombie_weapons[weaponname].upgrade_name)) { return maps\mp\zombies\_zm_weapons::get_upgrade_weapon(weaponname, false); } else { return maps\mp\zombies\_zm_weapons::get_upgrade_weapon(weaponname, true); } }
So now it should be obvious how to customize it. It's actually somewhat like on MultiplayerCode:get_pack_a_punch_weapon_options( weapon ) { if ( !isDefined( self.pack_a_punch_weapon_options ) ) { self.pack_a_punch_weapon_options = []; } if ( !is_weapon_upgraded( weapon ) ) { return self calcweaponoptions( 0, 0, 0, 0, 0 ); } if ( isDefined( self.pack_a_punch_weapon_options[ weapon ] ) ) { return self.pack_a_punch_weapon_options[ weapon ]; } smiley_face_reticle_index = 1; base = get_base_name( weapon ); camo_index = 39; lens_index = randomintrange( 0, 6 ); reticle_index = randomintrange( 0, 16 ); reticle_color_index = randomintrange( 0, 6 ); plain_reticle_index = 16; r = randomint( 10 ); use_plain = r < 3; if ( base == "saritch_upgraded_zm" ) { reticle_index = smiley_face_reticle_index; } else { if ( use_plain ) { reticle_index = plain_reticle_index; } } /# if ( getDvarInt( #"471F9AB9" ) >= 0 ) { reticle_index = getDvarInt( #"471F9AB9" ); #/ } scary_eyes_reticle_index = 8; purple_reticle_color_index = 3; if ( reticle_index == scary_eyes_reticle_index ) { reticle_color_index = purple_reticle_color_index; } letter_a_reticle_index = 2; pink_reticle_color_index = 6; if ( reticle_index == letter_a_reticle_index ) { reticle_color_index = pink_reticle_color_index; } letter_e_reticle_index = 7; green_reticle_color_index = 1; if ( reticle_index == letter_e_reticle_index ) { reticle_color_index = green_reticle_color_index; } self.pack_a_punch_weapon_options[ weapon ] = self calcweaponoptions( camo_index, lens_index, reticle_index, reticle_color_index ); return self.pack_a_punch_weapon_options[ weapon ]; }
There you have it.Code:self GiveWeapon(weapon, 0, self calcweaponoptions( camo_index, lens_index, reticle_index, reticle_color_index ));
buyWeapon(weapon)
{
baseWeapon = maps\mp\zombies\_zm_weapons::get_base_name(weapon);
// No attachments and upgraded?
if(weapon == baseWeapon && maps\mp\zombies\_zm_weapons::is_weapon_upgraded(weapon))
{
unpackedWeapon = maps\mp\zombies\_zm_weapons::get_base_weapon_name(weapon, true);
weaponStruct = level.zombie_weapons[unpackedWeapon];
if(isDefined(weaponStruct))
{
defaultAttachment = weaponStruct.default_attachment;
if(isDefined(defaultAttachment) && defaultAttachment != "none")
{
// Add the default attachment
weapon = weapon + "+" + defaultAttachment;
}
}
}
self maps/mp/zombies/_zm_weapons::weapon_give(weapon);
}
attachments = level.zombie_weapons[unpackedWeapon].addon_attachments;