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

Members Online

»
0 Active | 39 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 4
Category: CoD4 Scripting
Scripting and coding with Call of Duty 4.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername, novemberdobby
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Previous Page
subscribe
Author Topic: Disable Moving Turret
DeekCiti
General Member
Since: Mar 13, 2008
Posts: 1293
Last: Jul 9, 2016
[view latest posts]
Level 8
Category: CoD4 Scripting
Posted: Tuesday, Feb. 24, 2009 01:44 am
Thanks for all your help on this one KILL3R.

I had to add a couple lines to the spawning turret and the original turret. When it spawns a new Turret, it uses default angles, so you'll have to put in your own under enableturret()

self.turret SetLeftArc( 89 );
self.turret SetRightArc( 89 );
self.turret SetTopArc( 45 );
self.turret SetBottomArc( 30 );

Apparently the farthest left and right you can go is 89 degrees. It doesn't like 90. I added these in two places. So for anyone else interested in using a moving platform with a turret, here is a working script. ---> Thanks to KILL3R for all the hard work! [wave]



Finished Working Script:

Code:
main()
{
	thread convoy();
}

convoy()
{
	convoytrigger = getentarray("convoy_trig","targetname");
	for(i=0;i< convoytrigger.size;i++)
		convoytrigger[i] thread convoy_think();
}

convoy_think()
{
	self.convoymoving = false;
	self.convoymodel = getent(self.target, "targetname");
	self.turret = getent(self.convoymodel.target, "targetname");
	self.turret_spawn_origin = spawn("script_origin",self.turret.origin);
	self.turret_spawn_origin.angles = self.turret.angles;
	self.turret_spawn_origin linkto(self.convoymodel);
	self.turret_info_weaponinfo = self.turret.weaponinfo;
	self.turret SetLeftArc( 89 );
	self.turret SetRightArc( 89 );
	self.turret SetTopArc( 45 );
	self.turret SetBottomArc( 30 );



	while(1)
	{
		self waittill("trigger");
		if(!self.convoymoving)
			self thread convoy_move();
	}
}

convoy_move()
{
	self.convoymoving = true;

	iprintlnbold("START");

	self.turret disableturret();

//	self.convoymodel playsound ("portal_in");
	self.convoymodel rotateyaw(90,3,0.5,0.5);
	self.convoymodel moveto ((-704, -800, 496),6,2,2);
	self.convoymodel waittill("movedone");

	self enableturret();

	wait 10;

	iprintlnbold("Move 1");

	self.turret disableturret();

//	self.convoymodel playsound ("portal_in");
	self.convoymodel moveto ((128, 448, 496),6,2,2);
	self.convoymodel waittill("movedone");

	self enableturret();

	wait 10;

	iprintlnbold("Move 2");

	self.turret disableturret();

//	self.convoymodel playsound ("portal_in");
//	self.convoymodel rotateyaw(90,3,0.5,0.5);
	self.convoymodel moveto ((-704, -800, 496),6,2,2);
	self.convoymodel waittill("movedone");

	self enableturret();

	wait 10;

	iprintlnbold("Move 3");


	self.turret disableturret();

//	self.convoymodel playsound ("portal_in");
	self.convoymodel rotateyaw(-90,4,0.5,0.5);
	self.convoymodel moveto ((-704, -800, 72),6,2,2);
	self.convoymodel waittill("movedone");

	self enableturret();

	iprintlnbold("FINISH");

	self.convoymoving = false;
}

disableturret()
{
	self delete();
}

enableturret()
{
	self.turret = spawnturret("misc_turret",self.turret_spawn_origin.origin,self.turret_info_weaponinfo);
	self.turret.angles = self.turret_spawn_origin.angles;
	self.turret setModel("weapon_saw_MG_setup");
	self.turret SetLeftArc( 89 );
	self.turret SetRightArc( 89 );
	self.turret SetTopArc( 45 );
	self.turret SetBottomArc( 30 );
}
Share |
Restricted Access Topic is Locked
Page
Previous Page
subscribe
MODSonline.com Forums : Call of Duty 4 : CoD4 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

»