Author Topic: R2D2  (Read 3377 times)

Code: [Select]
//Player_R2D2.cs

datablock PlayerData(PlayerR2D2Armor : PlayerStandardArmor)
{
   runForce = 100 * 90;
   runEnergyDrain = 0;
   minRunEnergy = 0;
   maxForwardSpeed = 5;
   maxBackwardSpeed = 5;
   maxSideSpeed = 0;
   maxLookAngle = 0;
   maxfreelookangle = 0;
   minfreelookangle = 0;
   minlookangle = 0;


   maxForwardCrouchSpeed = 0;
   maxBackwardCrouchSpeed = 0;
   maxSideCrouchSpeed = 0;

minJetEnergy = 0;
jetEnergyDrain = 0;
canJet = 0;
canjump = 0;

uiName = "R2D2";
showEnergyBar = false;

   runSurfaceAngle  = 55;
   jumpSurfaceAngle = 55;
};

datablock ShapeBaseImageData(R2D2Image)
{
   // Basic Item properties
   shapeFile = "./shapes/SWP/R2D2.dts";
   emap = true;

   // Specify mount point & offset for 3rd person, and eye offset
   // for first person rendering.
   mountPoint = $BackSlot;
   offset = "0 0 -1.3";
   eyeOffset = 1; //"0.0 0.0 20.0";
   rotation = eulerToMatrix( "0 0 0" );

   // When firing from a point offset from the eye, muzzle correction
   // will adjust the muzzle vector to point to the eye LOS point.
   // Since this weapon doesn't actually fire from the muzzle point,
   // we need to turn this off. 
   correctMuzzleVector = true;

   // Add the WeaponImage namespace as a parent, WeaponImage namespace
   // provides some hooks into the inventory system.
   className = "WeaponImage";

   // Projectile && Ammo.
   item = BowItem;
   ammo = " ";
   projectile = GunProjectile;
   projectileType = Projectile;

   //melee particles shoot from eye node for consistancy
   melee = false;
   //raise your arm up or not
   armReady = false;

   doColorShift = true;
   colorShiftColor = "1 1 1 1";

   //casing = " ";

   // Images have a state system which controls how the animations
   // are run, which sounds are played, script callbacks, etc. This
   // state system is downloaded to the client so that clients can
   // predict state changes and animate accordingly.  The following
   // system supports basic ready->fire->reload transitions as
   // well as a no-ammo->dryfire idle state.

   // Initial start up state
stateName[0]                     = "Activate";
stateTimeoutValue[0]             = 5000000000;
stateTransitionOnTimeout[0]       = "Activate";
};

if(%obj.dataBlock $= "PlayerR2D2Armor")
{
   %obj.hidenode("ALL");
   %obj.mountImage(R2D2image,0);
}

So basically when you apply the R2D2 datablock to the player, I want them to become invisible, and have R2D2.dts mounted to them.
« Last Edit: October 19, 2008, 11:33:21 AM by WRB852 »

Your problem right now, I think, is that the little snippet at the bottom isn't in a function. You'd have to package the onSpawn (or whatever it is) to make the code run when the player spawns.

I already knew that, it's just that I have no idea how to "package the onSpawn".


I think Packer's got that one covered. :cookieMonster:

:(

Also i have a suggestion, shouldn't the datablock be playerfueljet?

Code: [Select]
package Name {
function PlayerR2D2Armor::onSpawn(%this, %crap) {
   %this.hidenode("ALL");
   %this.mountImage(R2D2image,0);
   Parent::onSpawn(%this, %crap);
}
};
activatePackage(Name);
Quick stuff, fix it yourself.

Warning - while you were typing 3 new replies have been posted. You may wish to review your post.

Holy loving stuff, shut the forget up you noobs.

Code: [Select]
package Name {
function PlayerR2D2Armor::onSpawn(%this, %crap) {
   %this.hidenode("ALL");
   %this.mountImage(R2D2image,0);
   Parent::onSpawn(%this, %crap);
}
};
activatePackage(Name);
So what should I put under "Name", and "crap"?

Code: [Select]
package Name {
function PlayerR2D2Armor::onSpawn(%this, %crap) {
   %this.hidenode("ALL");
   %this.mountImage(R2D2image,0);
   Parent::onSpawn(%this, %crap);
}
};
activatePackage(Name);
Quick stuff, fix it yourself.

Warning - while you were typing 3 new replies have been posted. You may wish to review your post.

Holy loving stuff, shut the forget up you noobs.

Again, you're an idiot.

Code: [Select]
package R2D2Spawn
{
   function GameConnection::spawnPlayer(%this)
   {
      Parent::spawnPlayer(%this);
      if(isObject(%this.player))
      {
         if(%this.player.dataBlock $= "PlayerR2D2Armor")
         {
            %this.player.hideNode("ALL");
            %this.player.mountImage(R2D2Image,0);
         }
      }
   }
};
activatePackage(R2D2Spawn);

Again, you're an idiot.

Code: [Select]
package R2D2Spawn
{
   function GameConnection::spawnPlayer(%this)
   {
      Parent::spawnPlayer(%this);
      if(isObject(%this.player))
      {
         if(%this.player.dataBlock $= "PlayerR2D2Armor")
         {
            %this.player.hideNode("ALL");
            %this.player.mountImage(R2D2Image,0);
         }
      }
   }
};
activatePackage(R2D2Spawn);
forget you and you're jumping into random topics just to say a small code made in the forums is stuff. That's trolling and it's also being a bitch.
« Last Edit: October 19, 2008, 11:53:14 AM by MegaScience »

Oops, I don't care about your dysfunctional family/bladder. You can't mask your incompetence with pathetic excuses.

The point is you tried to help someone and you did a crappy job and gave him some crappy code that doesn't even work.

You know what. You don't have a life. Not for harassing me, no. I'm talking about your knowledge of code. You are obsessed with getting it right. That can be good, but you're a bitch about it if it's even a little wrong. You'll ignore the fact it's just something given to show how something works and be a bitch about it instead of just saying "This should work"

Do you have a life? Anything? You have such an obsession, you seem to always be there when I post a quick code.

You know what. You don't have a life. Not for harassing me, no. I'm talking about your knowledge of code. You are obsessed with getting it right. That can be good, but you're a bitch about it if it's even a little wrong. You'll ignore the fact it's just something given to show how something works and be a bitch about it instead of just saying "This should work"

Do you have a life? Anything? You have such an obsession, you seem to always be there when I post a quick code.

Haha. You seem to be under the illusion that it takes effort for me to code well. You just code terribly. Your code above does not even illustrate how player spawning works - there isn't even an onSpawn method, you just made it up.

And uh, I don't even need to defend myself regarding "Do you even have a life?" because I think anyone who's been near you for more than a few minutes knows how irreparably socially dysfunctional you are.

Your code above does not even illustrate how player spawning works - there isn't even an onSpawn method, you just made it up.
I already knew that, it's just that I have no idea how to "package the onSpawn".
package Name {
function PlayerR2D2Armor::onSpawn(%this, %crap) {
   %this.hidenode("ALL");
   %this.mountImage(R2D2image,0);
   Parent::onSpawn(%this, %crap);
}
};
activatePackage(Name);


For once, I think I'm on Ephi's side.
Mega, your annoying, especially your constant bitching about people getting their post in before you.