| Author |
Topic: My Tnt Script |
| Carl21221 |
General Member Since: Apr 13, 2006 Posts: 134 Last: Jul 31, 2015 [view latest posts] |
|
|
|
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. |
 |
|
|
| .KiLL3R. |
 |
General Member Since: Oct 26, 2006 Posts: 1437 Last: Jul 3, 2017 [view latest posts] |
|
|
|
|
| novemberdobby |
 |
General Member Since: Sep 17, 2006 Posts: 1965 Last: Oct 13, 2013 [view latest posts] |
|
|
|
|
| Carl21221 |
General Member Since: Apr 13, 2006 Posts: 134 Last: Jul 31, 2015 [view latest posts] |
|
|
|
|
| .KiLL3R. |
 |
General Member Since: Oct 26, 2006 Posts: 1437 Last: Jul 3, 2017 [view latest posts] |
|
|
|
|
| Carl21221 |
General Member Since: Apr 13, 2006 Posts: 134 Last: Jul 31, 2015 [view latest posts] |
|
|
|
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? |
 |
|
|
| .KiLL3R. |
 |
General Member Since: Oct 26, 2006 Posts: 1437 Last: Jul 3, 2017 [view latest posts] |
|
|
|
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
also, in TnTExplo(player) change
self.PLANTEDTnT
to
player.PLANTEDTnT |
 |
|
|
| Carl21221 |
General Member Since: Apr 13, 2006 Posts: 134 Last: Jul 31, 2015 [view latest posts] |
|
|
|
|
| xholyx |
 |
General Member Since: Oct 17, 2007 Posts: 116 Last: Sep 7, 2010 [view latest posts] |
|
|
|
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; |
 |
|
|
| .KiLL3R. |
 |
General Member Since: Oct 26, 2006 Posts: 1437 Last: Jul 3, 2017 [view latest posts] |
|
|
|
|
|
|
mp_TempleCall of Duty: Mods: Multiplayer (624.12Kb)
|