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

Members Online

»
0 Active | 6 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
Next Page
subscribe
Author Topic: My Tnt Script
Carl21221
General Member
Since: Apr 13, 2006
Posts: 134
Last: Jul 31, 2015
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Friday, Apr. 18, 2008 06:07 pm
I am making a mod where when u hold use for 5 seconds it plants a TnT on the floor which will blow up in a matter of seconds, heres my script.

Code:
main()
{

thread PrecacheFx();
thread Playerconnect();

}

precacheFX()
{
	level._effect["large_vehicle_explosion"]	= loadfx ("fx/explosions/large_vehicle_explosion.efx");
}

Playerconnect()
{
while(1)
	{
	level waittill ("playerconnect", player);
	iprintln ("PlayerconnectDone"); //for debugging
	player thread PlantTnT();
	}
}

PlantTnT()
{
	self endon("disconnect");
	self.PLANTEDTnT = false;
	while(1)
	{
		wait 0.5;
		if(level.player useButtonPressed())
		{
			wait 5;
			TnT = spawn("xmodel/military_tntbomb",level.player.origin);
			iPrintln("PlantTnTComplete"); //For debugging
			self.PLANTEDTnT = true;
			TnT thread TnTExplo(self);
		}
	wait 0.5;

	}
}

TnTExplo(player)
{
	player endon("disconnect");
	wait 10;
	playfx (level._effect["large_vehicle_explosion"], self.origin);
	radiusdamage(self.origin, 500,500,50);
	self delete();
	self.PLANTEDTnT = false;
}


My script is not working at all, and i have tried everything that i have thought of to get it working, but still no luck.

Anyone know why?

ty in advance.
Share |
.KiLL3R.
General Member
Since: Oct 26, 2006
Posts: 1437
Last: Jul 3, 2017
[view latest posts]
Level 8
Category: CoD2 Scripting
Posted: Friday, Apr. 18, 2008 06:32 pm
level.player
change to
self
Share |
novemberdobby
General Member
Since: Sep 17, 2006
Posts: 1965
Last: Oct 13, 2013
[view latest posts]
Level 8
Category: CoD2 Scripting
Posted: Friday, Apr. 18, 2008 06:32 pm
TnT = spawn("xmodel/military_tntbomb",level.player.origin);

should be

TnT = spawn("script_model",self.origin);
TnT setmodel("xmodel/military_tntbomb");

probably, I've not done stuff like that in COD2

edited on Apr. 18, 2008 02:34 pm by NovemberDobby
Share |
Carl21221
General Member
Since: Apr 13, 2006
Posts: 134
Last: Jul 31, 2015
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Friday, Apr. 18, 2008 06:47 pm
done what both of you have said and still no luck. anymore ideas?
Share |
.KiLL3R.
General Member
Since: Oct 26, 2006
Posts: 1437
Last: Jul 3, 2017
[view latest posts]
Level 8
Category: CoD2 Scripting
Posted: Friday, Apr. 18, 2008 08:25 pm
add

precacheModel("xmodel/military_tntbomb");

just above the level._effect = blah thing
Share |
Carl21221
General Member
Since: Apr 13, 2006
Posts: 134
Last: Jul 31, 2015
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Saturday, Apr. 19, 2008 10:03 am
I have put that in just now and still no luck.... -_- lol

Ive just debugged it and i don't think call of duty 2 is loading the script up. This is the whole of my script:

Code:
main()
{
thread PrecacheFx();
thread Playerconnect();
}

precacheFX()
{
	precacheModel("xmodel/military_tntbomb");
	level._effect["large_vehicle_explosion"]	= loadfx ("fx/explosions/large_vehicle_explosion.efx");
}

Playerconnect()
{
while(1)
	{
	level waittill ("connect", player);
	iprintln ("PlayerconnectDone");
	player thread PlantTnT();
	}
}

PlantTnT()
{
	self endon("disconnect");
	self.PLANTEDTnT = false;
	while(1)
	{
		wait 0.5;
		if(self useButtonPressed())
		{
			wait 5;
			TnT = spawn("script_model",level.player.origin);
			TnT setmodel("xmodel/military_tntbomb");

			iPrintln("PlantTnTComplete");
			self.PLANTEDTnT = true;
			TnT thread TnTExplo(self);
		}
	wait 0.5;

	}
}

TnTExplo(player)
{
	player endon("disconnect");
	wait 10;
	playfx (level._effect["large_vehicle_explosion"], self.origin);
	radiusdamage(self.origin, 500,500,50);
	self delete();
	self.PLANTEDTnT = false;
}


And this is the only thing in my iwd file. is there something else which should be in the iwd file with it?
Share |
.KiLL3R.
General Member
Since: Oct 26, 2006
Posts: 1437
Last: Jul 3, 2017
[view latest posts]
Level 8
Category: CoD2 Scripting
Posted: Saturday, Apr. 19, 2008 10:07 am
you didnt change level.player.origin to self.origin where u spawn the model[thumbs_up]

also, in TnTExplo(player) change
self.PLANTEDTnT
to
player.PLANTEDTnT
Share |
Carl21221
General Member
Since: Apr 13, 2006
Posts: 134
Last: Jul 31, 2015
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Saturday, Apr. 19, 2008 10:13 am
Still not workin' :(
Share |
xholyx
General Member
Since: Oct 17, 2007
Posts: 116
Last: Sep 7, 2010
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Saturday, Apr. 19, 2008 10:15 am
Carl21221 writes...
Quote:
Still not workin' :(


have you threaded the script from tdm.gsc etc @ Startgametype?

Code:
 thread maps\mp\gametypes\blablascript.gsc::main;
Share |
.KiLL3R.
General Member
Since: Oct 26, 2006
Posts: 1437
Last: Jul 3, 2017
[view latest posts]
Level 8
Category: CoD2 Scripting
Posted: Saturday, Apr. 19, 2008 10:39 am
thread maps\mp\gametypes\blablascript::main();
Share |
Restricted Access Topic is Locked
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

»