Post: [SCRIPT] Valkyrie Rockets
06-02-2012, 09:25 PM #1
Choco
Respect my authoritah!!
(adsbygoogle = window.adsbygoogle || []).push({}); Hello everyone Smile

Since daftvader never released his Valkyrie Rocket script, I decided to write my own and it works pretty well.

BIG THANKS to DaftVader for releasing his magic bullets script, I used pieces of that to build this script. Also, credit goes to him for the Green Screen script. I used IELIITEMODZX's Reaper HUD's for the crosshairs, so credit to him as well.

Video: (sorry about the quality and lack of sound)


Simply call this thread from your menu:

    self thread Valkyrie();


And here is the script itself:

    Valkyrie()
{
self endon("death");
self.oldWeap=self GetCurrentWeapon();
self GiveWeapon("rpg_mp");
self switchToWeapon("rpg_mp");
self allowAds(false);
self iPrintln("Press [{+attack}] to Fire Valkyrie");
for(;Winky Winky{
if(self AttackButtonPressed()&&self GetCurrentWeapon()=="rpg_mp"){
self takeWeapon("rpg_mp");
self thread ValkFly();break;}
wait .01;
}
}
ValkFly()
{
self notify("stop_ufo");
self.ufo=false;
self.oldPos=self.origin;
self.oldAngles=self.angles;
self.maxhealth=9999999;
self.health=self.maxhealth;
rocket=spawn("script_model",self.origin);
rocket setModel("projectile_rpg7");
rocket.angles=self.angles;
self playLocalSound("weap_rpg_fire_plr");
rocket playloopsound("weap_rpg_loop");
self linkto(rocket);
self hide();
self disableWeapons();
self thread ValkHuds();
self thread greenscreen(0,0,840,900);
for(;Winky Winky
{
vec=anglestoforward(self getPlayerAngles());
speed=(vec[0]*100,vec[1]*100,vec[2]*100);
if(bullettracepassed(self.origin+(0,0,65),self.ori gin+speed+(0,0,65),false,undefined)){
rocket moveTo(self.origin+speed,0.1);
playfx(level.chopper_fx["smoke"]["trail"],self.origin);
rocket.angles=self.angles;}
else{
self playSound("hind_helicopter_secondary_exp");
radiusDamage(self.origin,1000,500,1,self);
playfx(loadfx("explosions/grenadeExp_concrete_1"),self.origin);
rocket delete();
rocket stopLoopSound();
for(r=0;r<self.r.size;r++)self.r[r] destroy();
self notify("boom");
self iPrintlnBold("\n\n\n\n\n");
wait 1;
self setOrigin(self.oldPos);
self.angles=self.oldAngles;
self enableWeapons();
self.maxhealth=100;
self.health=self.maxhealth;
self unlink();
self switchToWeapon(self.oldWeap);
self show();
self allowAds(true);
break;}
wait .01;
}
}
ValkHuds()
{
coord=strTok("21,0,2,24;-20,0,2,24;0,-11,40,2;0,11,40,2;0,-39,2,57;0,39,2,57;-48,0,57,2;49,0,57,2;-155,-122,2,21;-154,122,2,21;155,122,2,21;155,-122,2,21;-145,132,21,2;145,-132,21,2;-145,-132,21,2;146,132,21,2",";");
for(k=0;k<coord.size;k++)
{
tCoord=strTok(coord[k],",");
self.r[k]=createHuds(int(tCoord[0]),int(tCoord[1]),int(tCoord[2]),int(tCoord[3]));
self.r[k].alpha=1;
}
}
Greenscreen(x,y,width,height) {
g=newClientHudElem(self);
g.width=width;
g.height=height;
g.align="CENTER";
g.relative="MIDDLE";
g.children=[];
g.sort=1;
g.alpha=0.2;
g setParent(level.uiParent);
g setShader("white",width,height);
g.hidden=false;
g.color=(0,1,0);
g setPoint("CENTER","MIDDLE",x,y);
self thread destroyvision(g);
}
createHuds(x,y,width,height)
{
hud = newClientHudElem(self);
hud.width = width;
hud.height = height;
hud.align = "CENTER";
hud.relative = "MIDDLE";
hud.children = [];
hud.sort = 3;
hud.alpha = 1;
hud setParent(level.uiParent);
hud setShader("white",width,height);
hud.hidden = false;
hud setPoint("CENTER","",x,y);
hud thread destroyGunHuds(self);
return hud;
}
destroyGunHuds(player)
{
player waittill("death");
if(isDefined(self))
self destroyElem();
}


Once again thanks to Daftvader for the magic bullets/greenscreen scripts and IELIITEMODZX for the HUDs :y:

Enjoy it everyone =D
(adsbygoogle = window.adsbygoogle || []).push({});

The following 13 users say thank you to Choco for this useful post:

forflah123, Harry, IamLewisModz-x, INSAN3LY_D34TH, IVI40A3Fusionz, KingcreekS, Newelly, Ninja, Cmd-X, Taylor, TOM DAINTY

The following 3 users groaned at Choco for this awful post:

247Yamato, x_DaftVader_x, zxz0O0
06-03-2012, 03:16 AM #11
Choco
Respect my authoritah!!
Originally posted by Bloodfocus View Post
What this do?



and this : ?


The second one just creates the HUD's, but I will explain the first:

    for(;Winky Winky //Makes this function loop forever until stopped
{
vec=anglestoforward(self getPlayerAngles()); //Initializes the variable "vec" as the angles facing straight ahead of your player

speed=(vec[0]*100,vec[1]*100,vec[2]*100); //Initializes the variable "speed" as the angles from "vec" multiplied by 100

if(bullettracepassed(self.origin+(0,0,65),self.origin+speed+(0,0,65),false,undefined)) //Check if a bullet launched from you is able to pass the point of your origin + the distances from the "speed" variable + 65 on the Z axis (to make the height of the check equal to what you see)
{
rocket moveTo(self.origin+speed,0.1); //Moves the rocket forward a short distance if above check returns true
playfx(level.chopper_fx["smoke"]["trail"],self.origin); //Plays the smoke trail effect at your origin/the rocket's origin if the check returned true
rocket.angles=self.angles; //sets the rocket's angles equal to yours if the check returned true
}
else //if the check returned false it does what is contained within the brackets
{

self playSound("hind_helicopter_secondary_exp"); //Play explosion sound

radiusDamage(self.origin,1000,500,1,self); //Creates an explosion at your origin

playfx(loadfx("explosions/grenadeExp_concrete_1"),self.origin); //plays explosion effects at your origin

rocket delete(); //deletes the rocket model

rocket stopLoopSound(); //stops the RPG loop sound started earlier

for(r=0;r<self.r.size;r++)self.r[r] destroy(); //destroys each HUD element within the HUD array

self notify("boom"); //notifies "boom" to your entity, stopping some other functions that have been running

self iPrintlnBold("\n\n\n\n\n"); //clear iPrintlnBold lines, I really should have removed this

wait 1; //waits 1 second before continuing

self setOrigin(self.oldPos); //Moves you to where you were before firing the valkyrie rocket

self.angles=self.oldAngles; //Resets your angles to what they were before

self enableWeapons(); //Reenables using weapons

self.maxhealth=100; //resets your max health to default

self.health=self.maxhealth; //resets your health to the default max health

self unlink(); //unlinks you from the rocket

self switchToWeapon(self.oldWeap); //switches you to your old weapon

self show(); //unhides you so other players can see you

self allowAds(true); //allows you to aim down sight again

break; //exits the loop and continues with the function
}
wait .01; //makes the loop wait .01 seconds before restarting to prevent the game from auto terminating the loop
}


Hope that helps explain it :y:

The following user thanked Choco for this useful post:

KingcreekS
06-03-2012, 08:56 AM #12
DlBSY993
There's 0nly 1..
Originally posted by Choco View Post
The second one just creates the HUD's, but I will explain the first:

    for(;Winky Winky //Makes this function loop forever until stopped
{
vec=anglestoforward(self getPlayerAngles()); //Initializes the variable "vec" as the angles facing straight ahead of your player

speed=(vec[0]*100,vec[1]*100,vec[2]*100); //Initializes the variable "speed" as the angles from "vec" multiplied by 100

if(bullettracepassed(self.origin+(0,0,65),self.origin+speed+(0,0,65),false,undefined)) //Check if a bullet launched from you is able to pass the point of your origin + the distances from the "speed" variable + 65 on the Z axis (to make the height of the check equal to what you see)
{
rocket moveTo(self.origin+speed,0.1); //Moves the rocket forward a short distance if above check returns true
playfx(level.chopper_fx["smoke"]["trail"],self.origin); //Plays the smoke trail effect at your origin/the rocket's origin if the check returned true
rocket.angles=self.angles; //sets the rocket's angles equal to yours if the check returned true
}
else //if the check returned false it does what is contained within the brackets
{

self playSound("hind_helicopter_secondary_exp"); //Play explosion sound

radiusDamage(self.origin,1000,500,1,self); //Creates an explosion at your origin

playfx(loadfx("explosions/grenadeExp_concrete_1"),self.origin); //plays explosion effects at your origin

rocket delete(); //deletes the rocket model

rocket stopLoopSound(); //stops the RPG loop sound started earlier

for(r=0;r<self.r.size;r++)self.r[r] destroy(); //destroys each HUD element within the HUD array

self notify("boom"); //notifies "boom" to your entity, stopping some other functions that have been running

self iPrintlnBold("\n\n\n\n\n"); //clear iPrintlnBold lines, I really should have removed this

wait 1; //waits 1 second before continuing

self setOrigin(self.oldPos); //Moves you to where you were before firing the valkyrie rocket

self.angles=self.oldAngles; //Resets your angles to what they were before

self enableWeapons(); //Reenables using weapons

self.maxhealth=100; //resets your max health to default

self.health=self.maxhealth; //resets your health to the default max health

self unlink(); //unlinks you from the rocket

self switchToWeapon(self.oldWeap); //switches you to your old weapon

self show(); //unhides you so other players can see you

self allowAds(true); //allows you to aim down sight again

break; //exits the loop and continues with the function
}
wait .01; //makes the loop wait .01 seconds before restarting to prevent the game from auto terminating the loop
}


Hope that helps explain it :y:


Y YUNO CREATE SOMETHING NEW :yuno: The cod4 scene isnt going to get any better if you keep posting a remake of something.. Have a new idea completely that isnt a kill streak from another game. I may go back to cod4 modding for a little while, just to post some off my newer things I never finished.

The following 3 users say thank you to DlBSY993 for this useful post:

247Yamato, x_DaftVader_x, zxz0O0
06-03-2012, 11:29 AM #13
Originally posted by Choco View Post
Sorry I didn't notice I was missing it :p I'll update it when I get on my computer. And I use the two functions because I made this for my own use and I already had both in my patch :p
ahh lol ok Winky Winky
06-04-2012, 02:22 AM #14
Toke
PC Master Race
very good i'll be using
06-05-2012, 02:24 AM #15
idropcats
Bounty hunter
awesome code!
06-20-2012, 11:56 PM #16
z AppLe o
Do a barrel roll!
You need to fix the code, something is wrong with it.
06-29-2012, 03:10 AM #17
The problem has to do with this


vec=anglestoforward(self getPlayerAngles());
speed=(vec[0]*100,vec[1]*100,vec[2]*100);
if(bullettracepassed(self.origin+(0,0,65),self.ori gin+speed+(0,0,65),false,undefined))
{
rocket moveTo(self.origin+speed,0.1);
playfx(level.chopper_fx["smoke"]["trail"],self.origin);
rocket.angles=self.angles;
}

and you thread destroyvision but to not have the code there either.
06-29-2012, 04:13 AM #18
oG-Modder
Do a barrel roll!
Love it good work

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo