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

Members Online

»
0 Active | 8 Guests
Online:

LATEST FORUM THREADS

»
warfare
CoD4 Map + Mod Releases
Voting menu on maps
CoD+UO General
Hauling 911
CoDBO3 General

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
Page
Previous Page Next Page
subscribe
Author Topic: Change Player in Object
lineage2soul
General Member
Since: Oct 25, 2010
Posts: 24
Last: Nov 8, 2010
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Sunday, Nov. 7, 2010 11:52 am
Xylozi writes...
Quote:
Here is an example piece that you can mess with:

Code:

main()
{
	// change 'bike01' to the xmodel filename
	precacheModel( "bike01" );

	// setup the cvar
	setCvar( "scr_bike", "" );
	
	// monitor the cvar and when it changes, thread a function
	while(1)
	{
		if( getCvar( "scr_bike" ) != "" )
			thread changeToBike();
	
		wait 0.05;
	}
}

changeToBike()
{
	id = getCvarInt( "scr_bike" );
	setCvar( "scr_bike", "" );
	
	players = getEntArray( "player", "classname" );
	for( i = 0; i < players.size; i++ )
	{
		if( players[i] getEntityNumber() == id )
			players[i] thread transformPlayer();
	}
}

transformPlayer()
{
	if( !isDefined( self.isBike ) )
		self.isBike = false;
		
	self notify( "model_change" );
		
	// if player isn't a bike, make them so
	if( !self.isBike )
	{	
		self.isBike = true;
		
		self hide();
		
		self.bikeModel = spawn( "script_model", ( 0, 0, 0 ) );
		self.bikeModel.origin = self.origin;
		self.bikeModel.angles = ( 0, self.angles[1], 0 );
		self.bikeModel setModel( "bike01" );
		self.bikeModel LinkTo( self );
		
		self thread monitorBike();
		self thread bikeCleanup();
	}
	else
	{
		// 'model_change' notify will reverse bike
		self.isBike = false;
	}
}

monitorBike()
{
	self endon( "disconnect" );
	self endon( "death" );
	self endon( "joined_spectator" );
	self endon( "model_change" );
	
	while(1)
	{
		self.bikeModel.origin = self.origin;
		self.bikeModel.angles = ( 0, self.angles[1], 0 );
		
		wait 0.05;
	}
}

bikeCleanup()
{
	self waittill_any( "disconnect", "death", "joined_spectator", "model_change" );

	self.bikeModel Delete();
	
	waittillframeend;
	
	if( isDefined( self ) )
		self Show();
}

waittill_any( string1, string2, string3, string4, string5 )
{
	assert( isdefined( string1 ) );
	
	if ( isdefined( string2 ) )
		self endon( string2 );

	if ( isdefined( string3 ) )
		self endon( string3 );

	if ( isdefined( string4 ) )
		self endon( string4 );

	if ( isdefined( string5 ) )
		self endon( string5 );
	
	self waittill( string1 );
}


i try but i get this error:

******* script compile error *******
unknown function: (file 'maps/pam/sd.gsc', line 98)
thread maps\mp\gametypes\_bike::init();
*
************************************
********************
Share |
Xylozi
General Member
Since: Jul 12, 2008
Posts: 218
Last: Mar 1, 2012
[view latest posts]
Level 4
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Sunday, Nov. 7, 2010 12:02 pm
You need to copy that code above and make a new file called _bike.gsc. Then change that line to:

Code:
thread maps\mp\gametypes\_bike::main();
Share |
lineage2soul
General Member
Since: Oct 25, 2010
Posts: 24
Last: Nov 8, 2010
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Sunday, Nov. 7, 2010 01:51 pm
i using this script:
bike() //maps\mp\gametypes\_uber::bike();
{
self setclientcvar( "cg_thirdPerson", "1" );
self setclientcvar( "cg_thirdPersonRange", "150" );
bike = spawn("script_model", self.origin + (0,0,15) );
bear setmodel("xmodel/prop_bike");
bike.angles = (self.angles);
bike linkto(self);
self hide();
self setModel("");
self iprintln("^2Press USE button to unhide yourself");

while (1)
{

wait(0.05);

if(self UseButtonPressed())
{
self setclientcvar( "cg_thirdPerson", "0" );
bear delete();
self iprintln("^1Now you're unhidden");
self show();
hidden();
return(0);
}
if(self.health <= 0)
{
self setclientcvar( "cg_thirdPerson", "0" );
bear delete();
self show();
hidden();
return(0);
}
}
}


But i don't know what is command i will keep searching.
Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Sunday, Nov. 7, 2010 04:42 pm
wth? mixing bear and bike?
Do you have any clue what you are doing or trying to do?
Share |
lineage2soul
General Member
Since: Oct 25, 2010
Posts: 24
Last: Nov 8, 2010
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Sunday, Nov. 7, 2010 04:44 pm
ohh sory now fixed script:
bike() //maps\mp\gametypes\_uber::bike();
{
self setclientcvar( "cg_thirdPerson", "1" );
self setclientcvar( "cg_thirdPersonRange", "150" );
bike = spawn("script_model", self.origin + (0,0,15) );
bike setmodel("xmodel/prop_bike");
bike.angles = (self.angles);
bike linkto(self);
self hide();
self setModel("");
self iprintln("^2Press USE button to unhide yourself");

while (1)
{

wait(0.05);

if(self UseButtonPressed())
{
self setclientcvar( "cg_thirdPerson", "0" );
bike delete();
self iprintln("^1Now you're unhidden");
self show();
hidden();
return(0);
}
if(self.health <= 0)
{
self setclientcvar( "cg_thirdPerson", "0" );
bike delete();
self show();
hidden();
return(0);
}
}
}
Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Sunday, Nov. 7, 2010 05:37 pm
how about a self waittill("killed_player");?
Does the same as the health part, only more reliable, and less heavy.
Share |
lineage2soul
General Member
Since: Oct 25, 2010
Posts: 24
Last: Nov 8, 2010
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Sunday, Nov. 7, 2010 05:39 pm
I want just working script i don't have any errors but i don't know what is command i want to have transforms only for me
Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Sunday, Nov. 7, 2010 05:57 pm
Well, ive seen plenty of code that could do it fly by just on this page.
Just use the code on the first post of this second page.
Share |
lineage2soul
General Member
Since: Oct 25, 2010
Posts: 24
Last: Nov 8, 2010
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Sunday, Nov. 7, 2010 05:59 pm
so what is command?
Share |
clanhelio
General Member
Since: Aug 30, 2008
Posts: 223
Last: Mar 24, 2011
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Monday, Nov. 8, 2010 05:06 am
This guy obviously doesn't know WHAT is going on. You obviously need to learn to CRAWL before you can WALK, or rather have people on the internet walk for you
Share |
Restricted Access Topic is Locked
Page
Previous Page Next Page
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

»