UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

[Tutorial] Second Pack-a-Punch Machine (Currently Excluding Xmodel/Fx/Sounds)

broken avatar :(
Created 12 years ago
by alaurenc9
0 Members and 1 Guest are viewing this topic.
3,482 views
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 30 December 2012
Last active: 2 years ago
Posts
577
Respect
Forum Rank
Zombie Enslaver
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Signature
My preferred name is "xSanchez78".
Check me out here: www.steamcommunity.com/id/xSanchez78
×
alaurenc9's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
alaurenc9's Contact & Social LinksxSanchez78xSanchez78xSanchez78xSanchez78xSanchez78xSanchez78
Hello Guys
My name is xSanchez78.
Today I have created a Second Pack-a-Punch Machine.
It uses the same script as the pack-a-punch machine found in "_zombiemode_perks.gsc"
But is heavily modded by me and placed into a standalone ".gsc" file.

Go into "Root/raw/maps" and copy any ".gsc" file.
Paste it onto your desktop.
Rename it to "_weapon_bundle.gsc".
Here is the script to place into it:
Code Snippet
Plaintext
//================================================================================================
// Script Name  : Weapon Bundle Upgrade Machine
// Author : xSanchez78
// Notes : call "maps\_weapon_bundle::main();" after "maps\_zombiemode::main();" in "mapname.gsc".
//
//================================================================================================
#include common_scripts\utility;
#include maps\_utility;
#include maps\_zombiemode_utility;
#include maps\_zombiemode_zone_manager;
#include maps\_music;
#include maps\dlc3_code;
#include maps\dlc3_teleporter;

main()
{
vending_bundle_trigger = GetEntArray("zombie_vending_bundle", "targetname");
if ( vending_bundle_trigger.size >= 1 )
{
array_thread( vending_bundle_trigger, ::vending_bundle );
}
level.bundle_timeout = 15;
level thread turn_Bundle_on();
}

turn_Bundle_on()
{
flag_wait("electricity_on");
vending_bundle_trigger = GetEntArray("zombie_vending_bundle", "targetname");
for(i=0; i<vending_bundle_trigger.size; i++ )
{
perk = getent(vending_bundle_trigger[i].target, "targetname");
if(isDefined(perk))
{
perk thread activate_bundle();
}
}
}

activate_bundle()
{
self setmodel("zombie_vending_packapunch_on");
self playsound("perks_power_on");
self vibrate((0,-100,0), 0.3, 0.4, 3);
timer = 0;
duration = 0.05;
level notify( "Bundle_On" );
}

vending_bundle()
{
perk_machine = GetEnt( self.target, "targetname" );
if( isDefined( perk_machine.target ) )
{
perk_machine.wait_flag = GetEnt( perk_machine.target, "targetname" );
}
self UseTriggerRequireLookAt();
self SetHintString( "The power must be activated first" );
self SetCursorHint( "HINT_NOICON" );
level waittill("Bundle_On");
self thread maps\_zombiemode_weapons::decide_hide_show_hint();
bundle_rollers = spawn("script_origin", self.origin);
bundle_timer = spawn("script_origin", self.origin);
bundle_rollers playloopsound("packa_rollers_loop");
self SetHintString( "Press & hold &&1 to Bundle Weapon [Cost: 5000]" );
for( ;; )
{
self waittill( "trigger", player );
index = maps\_zombiemode_weapons::get_player_index(player);
cost = 5000;
plr = "plr_" + index + "_";
if( !player maps\_zombiemode_weapons::can_buy_weapon() )
{
wait( 0.1 );
continue;
}
if (player maps\_laststand::player_is_in_laststand() )
{
wait( 0.1 );
continue;
}
if( player isThrowingGrenade() )
{
wait( 0.1 );
continue;
}
if( player isSwitchingWeapons() )
{
wait(0.1);
continue;
}
current_weapon = player getCurrentWeapon();
if( !IsDefined( level.zombie_include_weapons[current_weapon] ) || !IsDefined( level.zombie_include_weapons[current_weapon + "_bundled"] ) )
{
iprintlnbold ("This Weapon Is Not Bundle-Able");
continue;
}
if ( player.score < cost )
{
self playsound("deny");
player thread maps\_zombiemode_perks::play_no_money_perk_dialog();
continue;
}
player maps\_zombiemode_score::minus_to_player_score( cost );
self achievement_notify("perk_used");
sound = "bottle_dispense3d";
playsoundatposition(sound, self.origin);
rand = randomintrange(1,100);
if( rand <= 8 )
{
player thread maps\_zombiemode_perks::play_packa_wait_dialog(plr);
}
origin = self.origin;
angles = self.angles;
if( isDefined(perk_machine))
{
origin = perk_machine.origin+(0,0,35);
angles = perk_machine.angles+(0,90,0);
}
self disable_trigger();
player thread do_knuckle_crack();
self.current_weapon = current_weapon;
weaponmodel = player third_person_weapon_bundle( current_weapon, origin, angles, bundle_rollers, perk_machine );
self enable_trigger();
self SetHintString( "Press & hold &&1 to Take Bundled Weapon" );
self setvisibletoplayer( player );
self thread wait_for_player_to_take( player, current_weapon, bundle_timer );
self thread wait_for_timeout( bundle_timer );
self waittill_either( "bundle_timeout", "bundle_taken" );
self.current_weapon = "";
weaponmodel delete();
self SetHintString( "Press & hold &&1 to Bundle Weapon [Cost: 5000]" );
self setvisibletoall();
}
}

do_knuckle_crack()
{
gun = self bundle_knuckle_crack_begin();
self.is_drinking = 1;
self waittill_any( "fake_death", "death", "player_downed", "weapon_change_complete" );
self bundle_knuckle_crack_end( gun );
self.is_drinking = undefined;
}

bundle_knuckle_crack_begin()
{
self DisableOffhandWeapons();
self DisableWeaponCycling();
self AllowLean( false );
self AllowAds( false );
self AllowSprint( false );
self AllowProne( false );
self AllowMelee( false );
if ( self GetStance() == "prone" )
{
self SetStance( "crouch" );
}
primaries = self GetWeaponsListPrimaries();
gun = self GetCurrentWeapon();
weapon = "zombie_knuckle_crack";
if ( gun != "none" && gun != "mine_bouncing_betty" )
{
self TakeWeapon( gun );
}
else
{
return;
}
if( primaries.size <= 1 )
{
self GiveWeapon( "zombie_colt" );
}
self GiveWeapon( weapon );
self SwitchToWeapon( weapon );
return gun;
}

bundle_knuckle_crack_end( gun )
{
assert( gun != "zombie_perk_bottle_doubletap" );
assert( gun != "zombie_perk_bottle_revive" );
assert( gun != "zombie_perk_bottle_jugg" );
assert( gun != "zombie_perk_bottle_sleight" );
assert( gun != "syrette" );
self EnableOffhandWeapons();
self EnableWeaponCycling();
self AllowLean( true );
self AllowAds( true );
self AllowSprint( true );
self AllowProne( true );
self AllowMelee( true );
weapon = "zombie_knuckle_crack";
if ( self maps\_laststand::player_is_in_laststand() )
{
self TakeWeapon(weapon);
return;
}
self TakeWeapon(weapon);
primaries = self GetWeaponsListPrimaries();
if( isDefined( primaries ) && primaries.size > 0 )
{
self SwitchToWeapon( primaries[0] );
}
else
{
self SwitchToWeapon( "zombie_colt" );
}
}

third_person_weapon_bundle( current_weapon, origin, angles, bundle_rollers, perk_machine )
{
forward = anglesToForward( angles );
interact_pos = origin + (forward*-25);
worldgun = spawn( "script_model", interact_pos );
worldgun.angles  = self.angles;
worldgun setModel( GetWeaponModel( current_weapon ) );
PlayFx( level._effect["packapunch_fx"], origin+(0,1,-34), forward );
worldgun rotateto( angles+(0,90,0), 0.35, 0, 0 );
wait( 0.5 );
worldgun moveto( origin, 0.5, 0, 0 );
bundle_rollers playsound( "packa_weap_upgrade" );
if( isDefined( perk_machine.wait_flag ) )
{
perk_machine.wait_flag rotateto( perk_machine.wait_flag.angles+(179, 0, 0), 0.25, 0, 0 );
}
wait( 0.35 );
worldgun delete();
wait( 6 );
bundle_rollers playsound( "packa_weap_ready" );
worldgun = spawn( "script_model", origin );
worldgun.angles  = angles+(0,90,0);
worldgun setModel( GetWeaponModel( current_weapon+"_bundled" ) );
worldgun moveto( interact_pos, 0.5, 0, 0 );
if( isDefined( perk_machine.wait_flag ) )
{
perk_machine.wait_flag rotateto( perk_machine.wait_flag.angles-(179, 0, 0), 0.25, 0, 0 );
}
wait( 0.5 );
worldgun moveto( origin, level.bundle_timeout, 0, 0);
return worldgun;
}

wait_for_player_to_take( player, weapon, bundle_timer )
{
index = maps\_zombiemode_weapons::get_player_index(player);
plr = "plr_" + index + "_";
self endon( "bundle_timeout" );
while( true )
{
bundle_timer playloopsound( "ticktock_loop" );
self waittill( "trigger", trigger_player );
bundle_timer stoploopsound(.05);
if( trigger_player == player )
{
if( !player maps\_laststand::player_is_in_laststand() )
{
self notify( "bundle_taken" );
primaries = player GetWeaponsListPrimaries();
if( isDefined( primaries ) && primaries.size >= 2 )
{
player maps\_zombiemode_weapons::weapon_give( weapon+"_bundled" );
}
else
{
player GiveWeapon( weapon+"_bundled" );
player GiveMaxAmmo( weapon+"_bundled" );
}
player SwitchToWeapon( weapon+"_bundled" );
player achievement_notify( "DLC3_ZOMBIE_PAP_ONCE" );
player achievement_notify( "DLC3_ZOMBIE_TWO_UPGRADED" );
player thread maps\_zombiemode_perks::play_packa_get_dialog(plr);
return;
}
}
wait( 0.05 );
}
}

wait_for_timeout( bundle_timer )
{
self endon( "bundle_taken" );
wait( level.bundle_timeout );
self notify( "bundle_timeout" );
bundle_timer stoploopsound(.05);
bundle_timer playsound( "packa_deny" );
}



Place this ".gsc" file into "Root/mods/mapname/maps".
Add "maps\_weapon_bundle::main();" before "maps\_zombiemode::main();" in "mapname.gsc".

Now here is how to make a new weapon to be bundled after it has been upgraded.
Make your new weapon file.
Rename it to "WEAPONNAME_upgraded_bundled".
I will not show you how to change the weapon's on-screen name, ammo, camo, or damage amount.
This can be found in other tutorials, but for this I will just show you how to set your gun up.

Go into Launcher.
Go into the "Mob Builder" Tab.
Add this into the "mod.csv".
Code Snippet
Plaintext
weapon,sp\WEAPONNAME_upgraded_bundled

Go into "_zombiemode_weapons.gsc".
Find the "init_weapons()" function.
Add this to it:
Code Snippet
Plaintext
add_zombie_weapon( "WEAPONNAME_upgraded_bundled", "Press & hold &&1 to buy WEAPONNAME [Cost: 10000]", 10000, "" );
Go into "dlc3_code.gsc"
Find the "include_weapons()" function.
Add this to it:
Code Snippet
Plaintext
include_weapon( "WEAPONNAME_upgraded_bundled", false );

As I said at the top, this will be set up like pack-a-punch.
So If you have a custom xmodel, make sure it has the slot for the weapon to go in and out of.
This tutorial I plan on editing over a period of time.
So when I get the availability in my schedule, I will make an xmodel and provide a link for it.
But unfortunately right now, I dont have one, Im sorry Ill work on it.

Open Radiant.
Make a trigger_use like this:
   targetname = zombie_vending_bundle
   target = (PICK_A_NAME_TO_TARGET_THE_MACHINE)

Make you custom machine xmodel.
Again make sure it has the slot for the weapon to go in and out of, like pack-a-punch.
Make the machine's KVP's look like this:
   targetname = (TRIGGER_USE_TARGET)
   target = (PICK_A_NAME_TO_TARGET_THE_FLAG)

If you want the wait flag that pops up behind pap while your paping, add the xmodel of a custom one of yours.
Make it's KVP's like this:
   targetname = (MACHINE_TARGET)

Like I said, this is a project I am going to work on for a long time.
If you like this tutorial, expect an update one day.
I will hope to have come up with a custom xmodel, along with some new fx and sounds.

Open Launcher.
Compile Your Map.
Go to Mob Builder.
Make sure to select the following in the IWD List:

maps/mapname.gsc
maps/_weapon_bundle.gsc
maps/_zombiemode_weapons.gsc
maps/dlc3_code.gsc
weapons/sp/WEAPONNAME_upgraded_bundled

Again as it says above, make sure to check all your new weapon files in the "weapons/sp" folder.
Again I will be back with some updates to this tutorial, such as a custom model, fx, and sounds.
It will all be included in a download link, and updated to this tut once I'm done w/ them.
Credit me, xSanchez78, for this.
Enjoy & Peace.
Last Edit: November 21, 2014, 08:21:36 am by alaurenc9

 
Loading ...