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 subscribe
Author Topic: Script error, tank_d doesnt wanna appear, please HELP!
Garthogg
General Member
Since: Jan 29, 2008
Posts: 21
Last: Feb 6, 2009
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Friday, Feb. 6, 2009 08:46 pm
I dont understand whats wrong, it says uninitialised variable -
tankd show();[banghead]

Quote:
main() {
level._effect["robbanas_fx"] = loadfx("fx/explosions/ammo_supply_exp.efx");
thread wallhide();
thread tanks();
thread turnon();
}

wallhide(){
ruin = getent("rom1", "targetname");
ruin hide();
ruin.origin -= (0, 0, 3000);
}

tanks(){
tankd = getent("tank2", "targetname");
tankd hide();
tankd.origin -= (0, 0, 2000);
}

turnon(){
tank = getent("tank1", "targetname");
tank rotateyaw(-45,10,5,4);
tank playsound("tank_move");
tank waittill("rotatedone");
tank movex(500,10,5,4);
tank waittill("movedone");
thread explosion();
wait(3);
tank rotateyaw(-90,10,5,4);
tank waittill("rotatedone");
tank movex(-500,10,5,4);
tank waittill("movedone");

}


explosion(){
wall = getent("fal1", "targetname");
tank = getent("tank1", "targetname");
ruin = getent("rom1", "targetname");

playfx(level._effect["explosion_fx"], wall.origin);
wall playsound("crashdown");
wall delete();
ruin show();
ruin.origin += (0, 0, 3000);
distance();
wait(23);
tank playsound("tank_boom");
tank delete();
tankd show();
tankd.origin += (0, 0, 2000);
tankdis();

}


distance(){

wall = getent("fal1", "targetname");
wallspot = fal.origin;
players = getentarray("player", "classname");

for(i=0; i if(isdefined(players) && (distance(players.origin, wallspot)<200)){
radiusDamage(players.origin, 32, 100, 90);
}

}

}

tankdis(){

tank = getent("tank1", "targetname");
tankspot = tank.origin;
players = getentarray("player", "classname");

for(i=0; i if(isdefined(players) && (distance(players.origin, tankspot)<300)){
radiusDamage(players.origin, 32, 100, 90);
}

}

}
Share |
Pedro699
General Member
Since: Jun 19, 2006
Posts: 781
Last: Dec 18, 2010
[view latest posts]
Level 7
Category: CoD2 Scripting
Posted: Friday, Feb. 6, 2009 09:24 pm
first thing!

Use the 'code' button - the end of your script has been chopped about!

-----------------

To the problem

Well, quite simply its not defined - i.e it doesn't know what it means.

although you define tankd here:

tankd = getent("tank2", "targetname");

here it is local to the tanks() function. Therefore you need to redefine it in the explosion() function.

Added a line to your code plus some other comments - see below

Code:
main() 
{
   level._effect["robbanas_fx"] = loadfx("fx/explosions/ammo_supply_exp.efx");
   thread wallhide();
   thread tanks();
   thread turnon();
}

wallhide()
{
   ruin = getent("rom1", "targetname");
   ruin hide();
   ruin.origin -= (0, 0, 3000);
}

tanks()
{
   tankd = getent("tank2", "targetname");
   tankd hide();
   tankd.origin -= (0, 0, 2000);
}

turnon()
{
   tank = getent("tank1", "targetname");
   tank rotateyaw(-45,10,5,4);
   tank playsound("tank_move");
   tank waittill("rotatedone");
   tank movex(500,10,5,4);
   tank waittill("movedone");
   thread explosion();
   wait(3);
   tank rotateyaw(-90,10,5,4);
   tank waittill("rotatedone");
   tank movex(-500,10,5,4);
   tank waittill("movedone");
}


explosion()
{
   wall = getent("fal1", "targetname");
   tank = getent("tank1", "targetname");
   ruin = getent("rom1", "targetname");
   
   tankd = getent("tank2", "targetname"); // ADDED THIS LINE

   playfx(level._effect["explosion_fx"], wall.origin);
   wall playsound("crashdown");
   wall delete();
   ruin show();
   ruin.origin += (0, 0, 3000);
   distance();
   wait(23);
   tank playsound("tank_boom");
   tank delete();
   tankd show();
   tankd.origin += (0, 0, 2000);
   tankdis();
}


distance()
{
   wall = getent("fal1", "targetname");
   
   wallspot = wall.origin; // also a problem - was 'fal' - also undefined 
   
   players = getentarray("player", "classname");

   for(i=0; i <  players.size; i++) // repaired for loop
   {
      if(isdefined(players[i]) && (distance(players[i].origin, wallspot)<200))
      {
         radiusDamage(players[i].origin, 32, 100, 90);
      }
   }
}

tankdis()
{
   tank = getent("tank1", "targetname");
   tankspot = tank.origin;
    
   players = getentarray("player", "classname");

   for(i=0; i <  players.size; i++) // repaired for loop
   {
      if(isdefined(players[i]) && (distance(players[i].origin, tankspot)<300))
      {
         radiusDamage(players[i].origin, 32, 100, 90);
      }
   }
}


===============

Edit.

You might also have a problem with your custom distance() function as this is already a built in function. I would suggest you change it to something different.





edited on Feb. 6, 2009 04:31 pm by Pedro699
Share |
Garthogg
General Member
Since: Jan 29, 2008
Posts: 21
Last: Feb 6, 2009
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Friday, Feb. 6, 2009 09:41 pm
Awww, my goodness[banghead]

So many many thanks[duh]
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

»