Author Topic: someone tell me whats wrong with this code  (Read 3657 times)

0 Members and 1 Guest are viewing this topic.

Vorter_X_

  • Centurian Lord
  • ********
  • Posts: 2,693
  • Reputation: +2/-0
someone tell me whats wrong with this code
« on: March 14, 2003 01:30 am CST »
this is a wep i made and it wont work

//====================================================================
// PlasRocket Data
//====================================================================

RocketData PlasRocketShell
{
   bulletShapeName  = "mortar.dts";
   explosionTag     = turretExp;
   collisionRadius  = 0.0;
   mass             = 2.0;

   damageClass      = 1;       // 0 impact, 1, radius
   damageValue      = 2;
   damageType       = $MissileDamageType;

   explosionRadius  = 15.5;
   kickBackStrength = 250.0;
   muzzleVelocity   = 65.0;
   terminalVelocity = 80.0;
   acceleration     = 5.0;
   totalTime        = 10.0;
   liveTime         = 3.0;
   lightRange       = 5.0;
   lightColor       = { 1.0, 0.7, 0.5 };
   inheritedVelocityScale = 0.5;

   // rocket specific
   trailType   = 2;                // smoke trail
   trailString = "plasmaex.dts";
   smokeDist   = 1.8;

   soundId = SoundJetHeavy;
};


ItemData PlasRocketAmmo
{
   description = "PRockets";
   className = "Ammo";
   shapeFile = "plasammo";
   heading = "zModifiedAmmo";
   shadowDetailMask = 4;
   price = 20;
};

ItemData PlasRocket1Ammo
{
   description = "PRockets";
   className = "Ammo";
   shapeFile = "plasammo";
   heading = "zModifiedAmmo";
   shadowDetailMask = 4;
   price = 20;
};

ItemData PlasRocket2Ammo
{
   description = "PRockets";
   className = "Ammo";
   shapeFile = "plasammo";
   heading = "zModifiedAmmo";
   shadowDetailMask = 4;
   price = 20;
};

ItemImageData PlasRocket1Image
{
   shapeFile = "plasma";
   mountPoint = 0;
   mountRotation = { 0, 1.57, 0 };
   ammoType = PlasRocket1Ammo;
   weaponType = 0;
   accuFire = true;
   reloadTime = 0.1;
   fireTime = 0.1;
   spinUpTime = 0.2;
   projectileType = PlasRocketShell;
};

ItemData PlasRocket1
{
   description = "PlasRocket";
   className = "Weapon";
   shapeFile = "plasma";
   hudIcon = "plasma";
   heading = "zModifiedWeapons";
   shadowDetailMask = 4;
   imageType = PlasRocket1Image;
   price = 250;
   showWeaponBar = false;
   showInventory = false;
};

ItemImageData PlasRocket2Image
{
   shapeFile = "plasma";
   mountPoint = 0;
   mountRotation = { 0, -1.57, 0 };
   ammoType = PlasRocket2Ammo;
   weaponType = 0;
   accuFire = true;
   reloadTime = 0.1;
   fireTime = 0.1;
   spinUpTime = 0.2;
   projectileType = PlasRocketShell;
};

ItemData PlasRocket2
{
   description = "PlasRocket";
   className = "Weapon";
   shapeFile = "plasma";
   hudIcon = "plasma";
   heading = "zModifiedWeapons";
   shadowDetailMask = 4;
   imageType = PlasRocket2Image;
   price = 250;
   showWeaponBar = false;
   showInventory = false;
};

ItemImageData PlasRocketImage
{
   shapeFile = "breath";
   mountPoint = 0;
   weaponType = 0;
   ammoType = PlasRocketAmmo;
   accuFire = true;
   reloadTime = 0.1;
   fireTime = 0.1;
   spinUpTime = 0.2;
   sfxFire = SoundFire;
   sfxActivate = SoundPickUpWeapon;
   sfxReload = SoundReload;
};

ItemData PlasRocket
{
   description = "PlasRocket";
   className = "Weapon";
   shapeFile = "plasma";
   hudIcon = "plasma";
   heading = "zmodifiedWeapons";
   shadowDetailMask = 4;
   imageType = PlasRocketImage;
   price = 250;
   showWeaponBar = true;
};

function PlasRocketImage::onFire(%player, %slot)
{
   %state1 = Player::getItemState(%player,6);
    %state2 = Player::getItemState(%player,7);
    if(%state1 != "Fire" && %state1 != "Reload" && %state2 != "Fire" && %state2 != "Reload")
   {
      %client = GameBase::getOwnerClient(%player);
      Player::decItemCount(%player, "PlasRocketAmmo", 1);
      %num = Player::getItemCount(%player, "PlasRocketAmmo");
      if(%client.hd == 0)
      {
         %client.hd = 1;
         if(%num == 1)
            Player::setItemCount(%player, "PlasRocket1Ammo", 0);
         else
            Player::setItemCount(%player, "PlasRocket1Ammo", %num);
          //Player::trigger(%player,6,true);
          //Player::trigger(%player,6,false);
       }
      else
      {
         %client.hd = 0;
          if(%num == 1)
             Player::setItemCount(%player, "PlasRocket2Ammo", 0);
          else
            Player::setItemCount(%player, "PlasRocket2Ammo", %num);
          //Player::trigger(%player,7,true);
          //Player::trigger(%player,7,false);
       }
    }
}

function PlasRocket::onMount(%player,%item)
{   
   %num = Player::getItemCount(%player, "PlasRocketAmmo");
   Player::setItemCount(%player, "PlasRocket1Ammo", %num);
   Player::mountItem(%player, PlasRocket1, 6);
    Player::setItemCount(%player, "PlasRocket2Ammo", %num);
    Player::mountItem(%player, PlasRocket2, 7);
   bottomprint(Player::getClient(%player), "<jc><f2>* * <f1>" @ %item.description @ " <f2> * *", 5);
}

function PlasRocket::onUnmount(%player,%imageSlot)
{   
   Player::unmountItem(%player,6);
    Player::unmountItem(%player,7);
}

$ItemMax[lfemale, PlasRocket] = 1;
$ItemMax[larmor, PlasRocket] = 1;
$ItemMax[mfemale, PlasRocket] = 1;
$ItemMax[marmor, PlasRocket] = 1;
$ItemMax[harmor, PlasRocket] = 1;
$ItemMax[sfemale, PlasRocket] = 1;
$ItemMax[sarmor, PlasRocket] = 1;
$ItemMax[ffemale, PlasRocket] = 1;
$ItemMax[farmor, PlasRocket] = 1;
$ItemMax[karmor, PlasRocket] = 1;

$ItemMax[lfemale, PlasRocketAmmo] = 20;
$ItemMax[larmor, PlasRocketAmmo] = 20;
$ItemMax[mfemale, PlasRocketAmmo] = 45;
$ItemMax[marmor, PlasRocketAmmo] = 45;
$ItemMax[harmor, PlasRocketAmmo] = 50;
$ItemMax[sarmor, PlasRocketAmmo] = 25;
$ItemMax[sfemale, PlasRocketAmmo] = 25;
$ItemMax[Farmor, PlasRocketAmmo] = 50;
$ItemMax[Ffemale, PlasRocketAmmo] = 50;
$ItemMax[Karmor, PlasRocketAmmo] = 100;

$InvList[PlasRocket] = 1;
$RemoteInvList[PlasRocket] = 1;
$InvList[PlasRocketAmmo] = 1;
$RemoteInvList[PlasRocketAmmo] = 1;

$AutoUse[PlasRocket] = false;
$SellAmmo[PlasRocketAmmo] = 35;
$WeaponAmmo[PlasRocket] = PlasRocketAmmo;
$ammopackitems[52] = plasrocketammo;

addWeapon(PlasRocket);








yes i do realize that some of it went off the side well if it did its still same line
« Last Edit: December 31, 1969 06:00 pm CST by Vorter_X_ »

eViL

  • Uber Menace
  • *******
  • Posts: 1,022
  • Reputation: +0/-0
(No subject)
« Reply #1 on: March 14, 2003 01:34 am CST »
ok, 2 things:
1) what part doesn't work, the image, the item, the firing process, mounting process, etc... ?
2) why are u using image slots 6+ ?  normal mods use item slots 3-8, not 6-10.
« Last Edit: December 31, 1969 06:00 pm CST by eViL »
Quote from: "LastWish || NextWish"
eViL, you were probably the coolest but most misunderstood person in this community.. maybe the rest will find out how cool of a person you are some day, and don't get too mad at the people who dont understand you.. its their loss in the end.

Vorter_X_

  • Centurian Lord
  • ********
  • Posts: 2,693
  • Reputation: +2/-0
(No subject)
« Reply #2 on: March 14, 2003 01:43 am CST »
first off its the images and ammos that are undefined so it tells me in tribes console

secondly this is a copy of code that works which is why i want to know why this one doesnt work.... i have the same exact code layout on a diff wep and it works perfectly ive been testing them for past few days and the other one works but this one wont even load up
« Last Edit: December 31, 1969 06:00 pm CST by Vorter_X_ »

eViL

  • Uber Menace
  • *******
  • Posts: 1,022
  • Reputation: +0/-0
(No subject)
« Reply #3 on: March 14, 2003 01:44 am CST »
check ur vars then, if u overwrite stuff, tribes throws a massive fit and spits out a pile of malarkey.
« Last Edit: December 31, 1969 06:00 pm CST by eViL »
Quote from: "LastWish || NextWish"
eViL, you were probably the coolest but most misunderstood person in this community.. maybe the rest will find out how cool of a person you are some day, and don't get too mad at the people who dont understand you.. its their loss in the end.

Vorter_X_

  • Centurian Lord
  • ********
  • Posts: 2,693
  • Reputation: +2/-0
(No subject)
« Reply #4 on: March 14, 2003 01:46 am CST »
ok well umm is there a possible easier way to code reg tribes language for weps... like make it shorter and simpler and do the same bullmalarkey
« Last Edit: December 31, 1969 06:00 pm CST by Vorter_X_ »

eViL

  • Uber Menace
  • *******
  • Posts: 1,022
  • Reputation: +0/-0
(No subject)
« Reply #5 on: March 14, 2003 01:48 am CST »
lol, no, not for multiple image weapons, u have to define them all and load them all and unload them all, and spawn the right projectiles... yep, fun stuff.
« Last Edit: December 31, 1969 06:00 pm CST by eViL »
Quote from: "LastWish || NextWish"
eViL, you were probably the coolest but most misunderstood person in this community.. maybe the rest will find out how cool of a person you are some day, and don't get too mad at the people who dont understand you.. its their loss in the end.

Vorter_X_

  • Centurian Lord
  • ********
  • Posts: 2,693
  • Reputation: +2/-0
(No subject)
« Reply #6 on: March 14, 2003 01:51 am CST »
well it all works with this other code and its the same EXACT layout... why wouldnt it work for this one?
« Last Edit: December 31, 1969 06:00 pm CST by Vorter_X_ »

Vorter_X_

  • Centurian Lord
  • ********
  • Posts: 2,693
  • Reputation: +2/-0
(No subject)
« Reply #7 on: March 14, 2003 01:59 am CST »
notice there is 400 some views on this now heheh i got bored for a minute
« Last Edit: December 31, 1969 06:00 pm CST by Vorter_X_ »

Vorter_X_

  • Centurian Lord
  • ********
  • Posts: 2,693
  • Reputation: +2/-0
(No subject)
« Reply #8 on: March 14, 2003 02:16 am CST »
ok i got the shape and everything but the firing thing working...
« Last Edit: December 31, 1969 06:00 pm CST by Vorter_X_ »

Vorter_X_

  • Centurian Lord
  • ********
  • Posts: 2,693
  • Reputation: +2/-0
(No subject)
« Reply #9 on: March 14, 2003 09:33 pm CST »
can ya help with that part eViL???
« Last Edit: December 31, 1969 06:00 pm CST by Vorter_X_ »

eViL

  • Uber Menace
  • *******
  • Posts: 1,022
  • Reputation: +0/-0
(No subject)
« Reply #10 on: March 14, 2003 09:48 pm CST »
u have to do Projectile::spawnProjectile( ); instead of player::trigger( );
« Last Edit: December 31, 1969 06:00 pm CST by eViL »
Quote from: "LastWish || NextWish"
eViL, you were probably the coolest but most misunderstood person in this community.. maybe the rest will find out how cool of a person you are some day, and don't get too mad at the people who dont understand you.. its their loss in the end.

Vorter_X_

  • Centurian Lord
  • ********
  • Posts: 2,693
  • Reputation: +2/-0
(No subject)
« Reply #11 on: March 14, 2003 09:55 pm CST »
hmm good idea but what to put in Projectile::spawnProjectile(this area);

and i got it to fire haha works perfectly W00T

hah
« Last Edit: December 31, 1969 06:00 pm CST by Vorter_X_ »