UGX-Mods

Call of Duty 5: World at War => Downloadable Items for Mappers => Custom Maps, Mods & Tools => Scripts => Topic started by: BluntStuffy on August 05, 2016, 09:22:10 pm

Title: [TUTORIAL] Mortar Strike
Post by: BluntStuffy on August 05, 2016, 09:22:10 pm
Just a fun script i came across a few days ago, have it laying around for ages but not going to use it myself prob so why not upload it?


Instructions included in the dl as well.


Add this to a .csv:
Code Snippet
Plaintext
// mortar strike
sound,mortar_strike,,,
weapon,sp/mortar_strike
material,hud_icon_m8_white_smoke
xmodel,projectile_us_smoke_grenade
xmodel,mortar_shell
fx,weapon/satchel/fx_explosion_satchel_generic
fx,blst_custom/streak_marker_smoke
fx,misc/fx_ui_airstrike_smk_green



Open _zombiemode, around line 60-70 you'll see similar line's. Add this one:

Code Snippet
Plaintext
	maps\_blst_mortar_strike::init();

   


( this might be a bit different in your version of _weapons, so pay attention! )
open _zombiemode_weapons, and look for this line inside the treasure_chest_give_weapon() function:
Code Snippet
Plaintext
	if( !( weapon_string == "fraggrenade" || weapon_string == "stielhandgranate" || weapon_string == "molotov" || weapon_string == "zombie_cymbal_monkey" ) )

Add this part to it:
Code Snippet
Plaintext
	|| weapon_string == "mortar_strike"
   
   
So it looks like:
Code Snippet
Plaintext
	if( !( weapon_string == "fraggrenade" || weapon_string == "stielhandgranate" || weapon_string == "molotov" || weapon_string == "zombie_cymbal_monkey" || weapon_string == "mortar_strike" ) )



Next a few lines down, you'll see this line:
Code Snippet
Plaintext
	if( weapon_string != "fraggrenade" && weapon_string != "stielhandgranate" && weapon_string != "molotov" && weapon_string != "zombie_cymbal_monkey" )
   
This time we're going to add:
Code Snippet
Plaintext
	&& weapon_string != "mortar_strike" 
   
So in the end it looks like:
Code Snippet
Plaintext
			if( weapon_string != "fraggrenade" && weapon_string != "stielhandgranate" && weapon_string != "molotov" && weapon_string != "zombie_cymbal_monkey" && weapon_string != "mortar_strike" )




Next look for the function treasure_chest_give_weapon(), and in there look for these lines:
Code Snippet
Plaintext
	self GiveWeapon( weapon_string, 0 );
self GiveMaxAmmo( weapon_string );
self SwitchToWeapon( weapon_string );
   
Right ABOVE those lines, paste in these new ones:
Code Snippet
Plaintext
	if( weapon_string == "mortar_strike" )
{
self thread maps\_blst_mortar_strike::player_give_mortar();
play_weapon_vo("zombie_cymbal_monkey");
return;
}
   



Dont forget to add the weapon 'mortar_strike" to both dlc3_code and _zombiemode_weapons, like you would with any other weapon.



If you want to give the players a mortar strike in another way then through the box, use this line of code ( using 'give' in the console will not work!! ):

   player thread maps\_blst_mortar_strike::player_give_mortar();



The Script:
Spoiler: click to open...
Code Snippet
Plaintext
#include maps\_utility;
#include common_scripts\utility;
#include maps\_zombiemode_utility;

////////////////////////////////////////////////
///// Mortar Strike:    /////
///// by: BluntStuffy    /////
///// Please give credit when used..       /////
////////////////////////////////////////////////

init()
{
// level thread test_mortar_strike(); // put this line back in to get a mortar strike 3 seconds after the game starts ( for testing )

level.mortar_drop_count = 35; // amount of mortars that will be launched

level.mortar_damages_other_players = false; // if other players can take damage from your mortar strike

level.player_mortar_radius = 250; // radius of effect of the mortars on the players
level.player_mortar_damage = 50; // max damage from a mortar, when a player is in the center of the radius

level.zombie_mortar_radius = 300; // radius of effect of the mortars on zombies
level.zombie_mortar_damage = 1200; // max damage from a mortar, when a zombie is in the center of the radius

    level._effect[ "marker_explode" ] = loadfx( "misc/fx_ui_airstrike_smk_green");
    level._effect[ "mortar_explosion" ] = loadfx( "weapon/satchel/fx_explosion_satchel_generic");
level._effect[ "mortar_trail" ] = loadfx( "weapon/grenade/fx_trail_rifle_grenade" );
precachemodel( "mortar_shell" );

}

test_mortar_strike()
{
wait 3;

player = get_players();
for( i=0 ;i<player.size ; i++ )
{
player[i] thread player_give_mortar();
}
}

player_give_mortar()
{
self giveweapon("mortar_strike");
self setactionslot(3,"weapon","mortar_strike");
self setweaponammostock("mortar_strike",1);
self thread player_marker_fired();
}

player_marker_fired()
{
self notify( "starting_mortar_watch" );
self endon( "starting_mortar_watch" );

while( 1 )
{
grenade = get_thrown_marker();
if( isdefined( grenade ) )
{
if( self maps\_laststand::player_is_in_laststand() )
{
grenade delete();
continue;
}
grenade hide();
model = spawn( "script_model", grenade.origin );
model SetModel( "projectile_us_smoke_grenade" );
model linkTo( grenade );
model.angles = grenade.angles;
velocitySq = 100000;
oldPos = grenade.origin;

while( velocitySq != 0 )
{
wait( 0.05 );
velocitySq = distanceSquared( grenade.origin, oldPos );
oldPos = grenade.origin;
}

model unlink();
model thread marker_model_cleanup( grenade );

level thread mortar_strike( grenade.origin, self );
}
wait 0.05;
}
}


get_thrown_marker()
{
self endon( "starting_mortar_watch" );

while( true )
{
self waittill( "grenade_fire", grenade, weapname );
if( weapname == "mortar_strike" )
{
return grenade;
}

wait 0.05;
}
}

marker_model_cleanup( grenade )
{
while( 1 )
{
if( !isDefined( grenade ) )
{
if( isDefined( self ) )
{
playfx( level._effect["marker_explode"], self.origin );
self delete();
}
break;
}
wait 0.05;
}
}

mortar_strike( origin, player )
{
mortar_count = level.mortar_drop_count;
mortar_impacts = [];
mortar = [];

for( i=0;i<mortar_count;i++ )
{
offset1 = randomintrange( -400, 401 );
offset2 = randomintrange( -400, 401 );
offset3 = origin+(0,0,75);

mortar_impacts[mortar_impacts.size] = (groundpos( origin+(offset1,offset2,offset3[2]) ) + (0,0,15) );
}

wait 3;
offset1 = randomintrange( 600, 701 );
offset2 = randomintrange( 600, 701 );

for( i=0;i<mortar_impacts.size;i++ )
{
mortar_angle = vectortoangles( mortar_impacts[i]+(offset1,offset2,2500) - mortar_impacts[i] );

mortar[i] = spawn( "script_model", mortar_impacts[i]+(offset1,offset2,2500) );
mortar[i] setmodel( "mortar_shell" );
mortar[i].angles = (mortar_angle-(90,0,90));

mortar[i] hide();
wait randomfloatrange( 0.10, 0.35 );
mortar[i] thread fire_mortar( mortar_impacts[i], player );
}
}

fire_mortar( impact_origin, player )
{
self show();

self.fx_tag = spawn( "script_model", self.origin );
self.fx_tag setmodel( "tag_origin" );
self.fx_tag.angles = self.angles;
self.fx_tag linkto( self );
playfxontag( level._effect["mortar_trail"], self.fx_tag, "tag_origin" );

self moveto( impact_origin, 0.8, 0.15, 0 );
playsoundatposition( "mortar_incoming", impact_origin );
wait 0.9;

self.fx_tag unlink();
self.fx_tag delete();

Earthquake( 0.6, 0.5, impact_origin, 450);
playfx( level._effect["mortar_explosion"], impact_origin );
playsoundatposition( "grenade_explode", impact_origin );

mortar_damage_players(impact_origin, player);
mortar_damage_zombies(impact_origin, player);
physicsexplosioncylinder( impact_origin, 400, 75, 1 );

self delete();
}

mortar_damage_players(impact_origin, player)
{
players = get_array_of_closest(impact_origin, get_players(), undefined, undefined, level.player_mortar_radius);

if( isdefined( players ) && players.size != 0 )
{
for(i=0;i<players.size;i++)
{
if( players[i] != player && !level.mortar_damages_other_players )
{
continue;
}

dist_mult = 1 - ( (distance( players[i].origin, impact_origin ))/level.player_mortar_radius );
damage = int( dist_mult*level.player_mortar_damage );
if( damage < 15 )
{
damage = 15;
}
RadiusDamage( players[i].origin, 10, damage, (damage-10) );
// iprintln( "player damage: "+damage );
}
}

}

mortar_damage_zombies(impact_origin, player)
{
zombs = get_array_of_closest(impact_origin, getaispeciesarray( "axis" ), undefined, undefined, level.zombie_mortar_radius);

if( isdefined( zombs ) && zombs.size != 0 )
{
for(i=0;i<zombs.size;i++)
{
dist_mult = 1 - ( (distance( zombs[i].origin, impact_origin ))/level.zombie_mortar_radius );
damage = int( dist_mult*level.zombie_mortar_damage );
if( damage < 75 )
{
damage = 75;
}

if( !zombs[i].gibbed && dist_mult > 0.3 )
{
refs = [];
refs[refs.size] = "guts";
refs[refs.size] = "right_arm";
refs[refs.size] = "left_arm";
refs[refs.size] = "right_leg";
refs[refs.size] = "left_leg";
refs[refs.size] = "no_legs";

zombs[i].a.gib_ref = animscripts\death::get_random( refs );
zombs[i] thread animscripts\death::do_gib();
}

zombs[i] dodamage( damage, self.origin, player );
// iprintln( "zombie damage: "+damage );
}
}
}
Title: Re: [TUTORIAL] Mortar Strike
Post by: Psh on August 05, 2016, 09:26:01 pm
Dank :gusta:
Title: Re: [TUTORIAL] Mortar Strike
Post by: KhelMho on August 05, 2016, 09:26:29 pm
What the! Nice  :D
Title: Re: [TUTORIAL] Mortar Strike
Post by: Tim Smith on August 05, 2016, 09:26:45 pm
Good work +1. :)
Title: Re: [TUTORIAL] Mortar Strike
Post by: Sebra on August 05, 2016, 09:34:30 pm
Amazing :D
Title: Re: [TUTORIAL] Mortar Strike
Post by: fiveseven hd on August 06, 2016, 07:55:02 am
Sweet man !  I always appreciate when you release basically anything because all of your work is just amazing.  Thanks for putting this out there for everybody to enjoy. i know i will +1
Title: Re: [TUTORIAL] Mortar Strike
Post by: fanmagic on August 06, 2016, 08:54:29 am
Great, +1 ;)
Title: Re: [TUTORIAL] Mortar Strike
Post by: nikfar1 on August 06, 2016, 03:40:51 pm
You are perfect .thanks +1
Title: Re: [TUTORIAL] Mortar Strike
Post by: Conbini2017 on August 09, 2016, 04:01:23 pm
is cool!  ;)
Title: Re: [TUTORIAL] Mortar Strike
Post by: KhelMho on August 14, 2016, 10:46:34 am
Need help? Where do i put this code?  :-\
Problems:
Powerup "Max ammo" is not working
in mortar  :(

Code Snippet
Plaintext
player thread maps\_blst_mortar_strike::player_give_mortar();
Title: Re: [TUTORIAL] Mortar Strike
Post by: BluntStuffy on August 14, 2016, 11:33:49 am
Need help? Where do i put this code?  :-\
Problems:
Powerup "Max ammo" is not working

In _zombiemode_powerups in the max ammo function, wich is this one:

Code Snippet
Plaintext
full_ammo_powerup( drop_item )
{
players = get_players();

for (i = 0; i < players.size; i++)
{
primaryWeapons = players[i] GetWeaponsList();

for( x = 0; x < primaryWeapons.size; x++ )
{
players[i] GiveMaxAmmo( primaryWeapons[x] );
}
}
// array_thread (players, ::full_ammo_on_hud, drop_item);
level thread full_ammo_on_hud( drop_item );
}

Put it in like this:

Code Snippet
Plaintext
full_ammo_powerup( drop_item )
{
players = get_players();

for (i = 0; i < players.size; i++)
{
                players[i] thread maps\_blst_mortar_strike::player_give_mortar();          //   <---- Add Here!

primaryWeapons = players[i] GetWeaponsList();

for( x = 0; x < primaryWeapons.size; x++ )
{
players[i] GiveMaxAmmo( primaryWeapons[x] );
}
}
// array_thread (players, ::full_ammo_on_hud, drop_item);
level thread full_ammo_on_hud( drop_item );
}
Title: Re: [TUTORIAL] Mortar Strike
Post by: KhelMho on August 14, 2016, 12:21:52 pm
In _zombiemode_powerups in the max ammo function, wich is this one:

Code Snippet
Plaintext
full_ammo_powerup( drop_item )
{
players = get_players();

for (i = 0; i < players.size; i++)
{
primaryWeapons = players[i] GetWeaponsList();

for( x = 0; x < primaryWeapons.size; x++ )
{
players[i] GiveMaxAmmo( primaryWeapons[x] );
}
}
// array_thread (players, ::full_ammo_on_hud, drop_item);
level thread full_ammo_on_hud( drop_item );
}

Put it in like this:

Code Snippet
Plaintext
full_ammo_powerup( drop_item )
{
players = get_players();

for (i = 0; i < players.size; i++)
{
                players[i] thread maps\_blst_mortar_strike::player_give_mortar();          //   <---- Add Here!

primaryWeapons = players[i] GetWeaponsList();

for( x = 0; x < primaryWeapons.size; x++ )
{
players[i] GiveMaxAmmo( primaryWeapons[x] );
}
}
// array_thread (players, ::full_ammo_on_hud, drop_item);
level thread full_ammo_on_hud( drop_item );
}

Thanks BluntStuffy  :)

Spoiler: click to open...
:troll:
Title: Re: [TUTORIAL] Mortar Strike
Post by: BrandynNew on August 15, 2016, 01:30:47 am
Craziest thing I've seen all day man!!! Looks incredible!
Title: Re: [TUTORIAL] Mortar Strike
Post by: robbie696 on October 07, 2016, 02:37:00 pm
Hey,

The problem I am getting isn't only for this tutorial, but always when trying to follow tutorials since I started using UGX mod :S . When I edit a file, and close it, I get a popup asking if I want to change the filew in the archive. When I click yes, I get a new popup saying "access denied"

Could anyone help me with this?
Title: Re: [TUTORIAL] Mortar Strike
Post by: Dust on October 07, 2016, 02:56:12 pm
Hey,

The problem I am getting isn't only for this tutorial, but always when trying to follow tutorials since I started using UGX mod :S . When I edit a file, and close it, I get a popup asking if I want to change the filew in the archive. When I click yes, I get a new popup saying "access denied"

Could anyone help me with this?

You need to drag the file out of the .IWD, edit it, then put it back in the IWD.
Title: Re: [TUTORIAL] Mortar Strike
Post by: robbie696 on October 07, 2016, 03:29:30 pm
Taking it out of the IWD, and putting it back in after still gives me an error. It keeps saying I dont have permission when IU try to add/change something.
Title: Re: [TUTORIAL] Mortar Strike
Post by: lmg60 on November 12, 2016, 02:54:40 am
hi, May I download or weapon ?
Title: Re: [TUTORIAL] Mortar Strike
Post by: lmg60 on November 14, 2016, 03:54:04 pm
you will have tutorial but vidéo?
Title: Re: [TUTORIAL] Mortar Strike
Post by: BluntStuffy on November 14, 2016, 06:07:39 pm
hi, May I download or weapon ?

you will have tutorial but vidéo?


Not sure what you mean, the tutorial is in the first post & the script is uploaded as an attachment at the bottom of the first post...
Title: Re: [TUTORIAL] Mortar Strike
Post by: lmg60 on November 14, 2016, 07:25:03 pm
yes I finally find the link but I did everything as said in the tutorial but I have no mortar_strike in the crate weapon
Title: Re: [TUTORIAL] Mortar Strike
Post by: BluntStuffy on November 14, 2016, 09:09:18 pm
yes I finally find the link but I did everything as said in the tutorial but I have no mortar_strike in the crate weapon

And you also did this:

Quote
Dont forget to add the weapon 'mortar_strike" to both dlc3_code and _zombiemode_weapons

and ticked the weapon-file in launcher before compiling?
Title: Re: [TUTORIAL] Mortar Strike
Post by: lmg60 on November 14, 2016, 09:24:00 pm
Yes I did everything well though Can you make a video of se tuto?
Title: Re: [TUTORIAL] Mortar Strike
Post by: BluntStuffy on November 14, 2016, 10:37:50 pm
You want me to make a video of me pasting some line's in a text-editor, i dont see how that's going to help..
Just make sure you read every step carefully, and take it one step at a time.
And also the fact if the weapon shows up in the box or not, is not related to adding the lines in the script ( except for the stuff in _weapons and dlc3_code ).
Title: Re: [TUTORIAL] Mortar Strike
Post by: lmg60 on November 14, 2016, 10:57:41 pm
look my script

(https://www.ugx-mods.com/forum/proxy.php?request=http%3A%2F%2Fimage.noelshack.com%2Ffichiers%2F2016%2F46%2F1479164168-mortar.jpg&hash=cd1c3befdbc662e5b5222528a8aaea07a8fd99fe)
Title: Re: [TUTORIAL] Mortar Strike
Post by: ERAWEX on June 09, 2017, 04:16:07 pm
Hi there,

I am having trubble with adding the "mortar_strike" in to the _zombiemode_weapons.gsc.

I have never added a weapon of any kind and have no idea what to put in.

Could you help?

Thanks,
ERAWEX
Title: Re: [TUTORIAL] Mortar Strike
Post by: DeletedUser on March 12, 2021, 04:11:27 pm
this isnt working for me
Title: Re: [TUTORIAL] Mortar Strike
Post by: Мика Тян on July 06, 2023, 01:38:23 pm
 
Just a fun script i came across a few days ago, have it laying around for ages but not going to use it myself prob so why not upload it?
 
Instructions included in the dl as well.
 
 
Add this to a .csv:
Code Snippet
Plaintext
// mortar strike
sound,mortar_strike,,,
weapon,sp/mortar_strike
material,hud_icon_m8_white_smoke
xmodel,projectile_us_smoke_grenade
xmodel,mortar_shell
fx,weapon/satchel/fx_explosion_satchel_generic
fx,blst_custom/streak_marker_smoke
fx,misc/fx_ui_airstrike_smk_green



Open _zombiemode, around line 60-70 you'll see similar line's. Add this one:
 
Code Snippet
Plaintext
maps\_blst_mortar_strike::init();

 


( this might be a bit different in your version of _weapons, so pay attention! )
open _zombiemode_weapons, and look for this line inside the treasure_chest_give_weapon() function:
Code Snippet
Plaintext
if( !( weapon_string == "fraggrenade" || weapon_string == "stielhandgranate" || weapon_string == "molotov" || weapon_string == "zombie_cymbal_monkey" ) )

Add this part to it:
Code Snippet
Plaintext
|| weapon_string == "mortar_strike"

 
So it looks like:
Code Snippet
Plaintext
if( !( weapon_string == "fraggrenade" || weapon_string == "stielhandgranate" || weapon_string == "molotov" || weapon_string == "zombie_cymbal_monkey" || weapon_string == "mortar_strike" ) )



Next a few lines down, you'll see this line:
Code Snippet
Plaintext
if( weapon_string != "fraggrenade" && weapon_string != "stielhandgranate" && weapon_string != "molotov" && weapon_string != "zombie_cymbal_monkey" )

This time we're going to add:
Code Snippet
Plaintext
&& weapon_string != "mortar_strike" 

So in the end it looks like:
Code Snippet
Plaintext
if( weapon_string != "fraggrenade" && weapon_string != "stielhandgranate" && weapon_string != "molotov" && weapon_string != "zombie_cymbal_monkey" && weapon_string != "mortar_strike" )



 
Next look for the function treasure_chest_give_weapon(), and in there look for these lines:
Code Snippet
Plaintext
self GiveWeapon( weapon_string, 0 );
self GiveMaxAmmo( weapon_string );
self SwitchToWeapon( weapon_string );

Right ABOVE those lines, paste in these new ones:
Code Snippet
Plaintext
if( weapon_string == "mortar_strike" )
{
self thread maps\_blst_mortar_strike::player_give_mortar();
play_weapon_vo("zombie_cymbal_monkey");
return;
}

 


Dont forget to add the weapon 'mortar_strike" to both dlc3_code and _zombiemode_weapons, like you would with any other weapon.
 


If you want to give the players a mortar strike in another way then through the box, use this line of code ( using 'give' in the console will not work!! ):
 
player thread maps\_blst_mortar_strike::player_give_mortar();
 
 
 
The Script:
Spoiler: click to show...
Code Snippet
Plaintext
#include maps\_utility;
#include common_scripts\utility;
#include maps\_zombiemode_utility;

////////////////////////////////////////////////
///// Mortar Strike:   /////
///// by: BluntStuffy   /////
///// Please give credit when used..       /////
////////////////////////////////////////////////

init()
{
// level thread test_mortar_strike(); // put this line back in to get a mortar strike 3 seconds after the game starts ( for testing )

level.mortar_drop_count = 35; // amount of mortars that will be launched

level.mortar_damages_other_players = false; // if other players can take damage from your mortar strike

level.player_mortar_radius = 250; // radius of effect of the mortars on the players
level.player_mortar_damage = 50; // max damage from a mortar, when a player is in the center of the radius

level.zombie_mortar_radius = 300; // radius of effect of the mortars on zombies
level.zombie_mortar_damage = 1200; // max damage from a mortar, when a zombie is in the center of the radius

    level._effect = loadfx( "misc/fx_ui_airstrike_smk_green");
    level._effect = loadfx( "weapon/satchel/fx_explosion_satchel_generic");
level._effect = loadfx( "weapon/grenade/fx_trail_rifle_grenade" );
precachemodel( "mortar_shell" );

}

test_mortar_strike()
{
wait 3;

player = get_players();
for( i=0 ;i 0.3 )
{
refs = ;
refs[refs.size] = "guts";
refs[refs.size] = "right_arm";
refs[refs.size] = "left_arm";
refs[refs.size] = "right_leg";
refs[refs.size] = "left_leg";
refs[refs.size] = "no_legs";

zombs[i].a.gib_ref = animscripts\death::get_random( refs );
zombs[i] thread animscripts\death::do_gib();
}

zombs[i] dodamage( damage, self.origin, player );
// iprintln( "zombie damage: "+damage );
}
}
}
its doesnt work