Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds

Members Online

»
0 Active | 108 Guests
Online:

LATEST FORUM THREADS

»
CoD: Battle Royale
CoD+UO Map + Mod Releases
Damaged .pk3's
CoD Mapping
heli to attack ai
CoD4 SP Mapping

Forums

»

Welcome to the MODSonline.com forums. Looking for Frequently Asked Questions? Check out our FAQs section or search it out using the SEARCH link below. If you are new here, you may want to check out our rules and this great user's guide to the forums and the website.
For more mapping and modding information, see our Wiki: MODSonWiki.com

Jump To:
Forum: All Forums : Call of Duty 2
Category: CoD2 Scripting
Scripting and coding with Call of Duty 2.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked subscribe
Author Topic: about deployable mg script in sp
Rafif_Daffa
General Member
Since: Jun 23, 2013
Posts: 19
Last: Oct 21, 2013
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Monday, Oct. 21, 2013 12:47 pm
hello, i am trying make a deployable g script in sp, but i got little problem, are sombody can help me resolve the problem??

this is my mg script

#include maps\_utility;

init()
{

precachemodel("xmodel/weapon_30cal");

precacheturret("mg42_bipod_stand");

thread turretPlant();

}

GetTargetedPos(num)
{
startOrigin = self getEye()+self getPlayerEyeOffset();
forward = anglesToForward(self getplayerangles());
forward = vector_scale( forward, num );
endOrigin = startOrigin + forward;

trace = bulletTrace( startOrigin, endOrigin, false, self );
if ( trace["fraction"] == 1.0 || trace["surfacetype"] == "default")
return ( undefined );
else
return ( trace["position"] );
}
getPlayerEyeOffset()
{
self endon("death");

offset = (0,0,18);

if(self.stance == 1) offset = (0,0,2);
if(self.stance == 0) offset = (0,0,-27);

return offset;
}
vector_scale (vec, scale)
{
vec = (vec[0] * scale, vec[1] * scale, vec[2] * scale);
return vec;
}

turretPlant()
{


self endon("death");

while(1)
{


if(self useButtonPressed())
{

position = GetTargetedPos(100000);

angles = self.angles;

typ = "mg42_bipod_stand";
model = "xmodel/weapon_30cal";

turret = spawnTurret ("misc_turret", position, typ);
turret setmodel(model);
turret.angles = angles;
turret hide();

turret SetTopArc(40);
turret SetBottomArc(30);
turret SetLeftArc(45);
turret SetRightArc(45);

self playSound("weap_pickup");
wait 2;

if(isDefined(turret)) turret show();


}


// * Solange warten bis deplanting *
if(isDefined(turret) && distance(turret.origin,self.origin) < 85)
{

self turretUnplant(turret);


}



}
}

turretUnplant(turret)
{
self endon("death");

self playSound("weap_pickup");
wait 2;
if(isDefined(turret))
{

turret delete();

}
}


Share |
Restricted Access Topic is Locked subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 Scripting

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»