Author Topic: Beginning Modder  (Read 1191 times)

Hello all you out there! I recently got blockland and am having a very good time with it. After I took a look at what everyone else has made (Go Heedicalking!), I decided to try my hand at making my own add ons. I looked at all the guides I could find on these forums, looked online a bit (No luck there) as well as taking a look at existing scripts. I have experience with C derivatives and TGL doesn't seem that complicated.

I know a deal of stuff is required for a, let's say, vehicle, addon to work. Model files, animations, colors, and most importantly the .cs. I decided to try my hand at a simple mod. I took the horse vehicle and pasted in some stuff from the MAS swarm fighter, which I really love. In particular, I added in the gun parts of the main script (the projectile info and the actual firing script) and tried it out.

Of course, it didn't work. I found this was because I hadn't changed the names. I have it up to the point where I've changed the UI names in the code (nothing else, as not to disrupt file paths) and can now find it in my add ons list. Unfortunately, I cannot find it when I put down a vehicle spawn.

Can anyone tell me where I went wrong?

P.S. I am not a noob! I know how to use the search button! I've found several guides, but none of them seem to solve my problem in a specific way. I would be quite glad if I were wrong (Just post the link to the topic). I've read the comments of other topics no people have posted and am expecting to get yelled at and stuff like they did, but hey, I had to give it a shot.

-Welknair

You might want to either check your console, and post what it's saying .. or attach the script in question.

My telekinesis isn't what it used to be.

So I copy pasted the horse vehicle .zip (yes, it still is a .zip) and I tweaked it's script to be as follows, as well as changing the description and the namecheck to be accurate. Due to the swarm fighter script, I added the weapon support. That's it.

Here's the server script:


//-----------------------------------------------------------------------------
// Torque Game Engine
// Copyright (C) GarageGames.com, Inc.
//-----------------------------------------------------------------------------
datablock ProjectileData(swarmFighterProjectile)
{
   projectileShapeName = "add-ons/Weapon_Gun/bullet.dts";
   directDamage        = 5;
   directDamageType    = $DamageType::Gun;
   radiusDamageType    = $DamageType::Gun;

   brickExplosionRadius = 0;
   brickExplosionImpact = true;          //destroy a brick if we hit it directly?
   brickExplosionForce  = 10;
   brickExplosionMaxVolume = 1;          //max volume of bricks that we can destroy
   brickExplosionMaxVolumeFloati ng = 2;  //max volume of bricks that we can destroy if they aren't connected to the ground

   impactImpulse        = 350;
   verticalImpulse     = 1;
   explosion           = gunExplosion;
   particleEmitter     = "";

   muzzleVelocity      = 100;
   velInheritFactor    = 1;

   armingDelay         = 00;
   lifetime            = 4000;
   fadeDelay           = 3500;
   bounceElasticity    = 0.5;
   bounceFriction      = 0.20;
   isBallistic         = false;
   gravityMod = 0.0;

   hasLight    = false;
   lightRadius = 3.0;
   lightColor  = "0 0 0.5";

   uiName = "";
};
// Load dts shapes and merge animations
datablock TSShapeConstructor(HorseDts)
{
   baseShape  = "./horse.dts";
   sequence0  = "./h_root.dsq root";

   sequence1  = "./h_run.dsq run";
   sequence2  = "./h_run.dsq walk";
   sequence3  = "./h_back.dsq back";
   sequence4  = "./h_side.dsq side";

   sequence5  = "./h_root.dsq crouch";
   sequence6  = "./h_run.dsq crouchRun";
   sequence7  = "./h_back.dsq crouchBack";
   sequence8  = "./h_side.dsq crouchSide";

   sequence9  = "./h_look.dsq look";
   sequence10 = "./h_root.dsq headside";
   sequence11 = "./h_root.dsq headUp";

   sequence12 = "./h_jump.dsq jump";
   sequence13 = "./h_jump.dsq standjump";
   sequence14 = "./h_root.dsq fall";
   sequence15 = "./h_root.dsq land";

   sequence16 = "./h_armAttack.dsq armAttack";
   sequence17 = "./h_root.dsq armReadyLeft";
   sequence18 = "./h_root.dsq armReadyRight";
   sequence19 = "./h_root.dsq armReadyBoth";
   sequence20 = "./h_spearReady.dsq spearready"; 
   sequence21 = "./h_root.dsq spearThrow";

   sequence22 = "./h_root.dsq talk"; 

   sequence23 = "./h_death1.dsq death1";
   
   sequence24 = "./h_shiftUp.dsq shiftUp";
   sequence25 = "./h_shiftDown.dsq shiftDown";
   sequence26 = "./h_shiftAway.dsq shiftAway";
   sequence27 = "./h_shiftTo.dsq shiftTo";
   sequence28 = "./h_shiftLeft.dsq shiftLeft";
   sequence29 = "./h_shiftRight.dsq shiftRight";
   sequence30 = "./h_rotCW.dsq rotCW";
   sequence31 = "./h_rotCCW.dsq rotCCW";

   sequence32 = "./h_root.dsq undo";
   sequence33 = "./h_plant.dsq plant";

   sequence34 = "./h_root.dsq sit";

   sequence35 = "./h_root.dsq wrench";

   sequence36 = "./h_root.dsq activate";
   sequence37 = "./h_root.dsq activate2";

   sequence38 = "./h_root.dsq leftrecoil";
};   


datablock AudioProfile(HorseJumpSound)
{
   fileName = "./jumpHorse.wav";
   description = AudioClose3d;
   preload = true;
};


datablock DebrisData( HorseDebris )
{
   explodeOnMaxBounce = false;

   elasticity = 0.15;
   friction = 0.5;

   lifetime = 4.0;
   lifetimeVariance = 0.0;

   minSpinSpeed = 40;
   maxSpinSpeed = 600;

   numBounces = 5;
   bounceVariance = 0;

   staticOnMaxBounce = true;
   gravModifier = 1.0;

   useRadiusMass = true;
   baseRadius = 1;

   velocity = 20.0;
   velocityVariance = 12.0;
};             

datablock PlayerData(HorseArmor)
{
   renderFirstPerson = false;
   emap = false;
   
   className = Armor;
   shapeFile = "./horse.dts";
   cameraMaxDist = 8;
   cameraTilt = 0.261;//0.174 * 2.5; //~25 degrees
   cameraVerticalOffset = 2.3;
   computeCRC = false;
 
   cameraDefaultFov = 90.0;
   cameraMinFov = 5.0;
   cameraMaxFov = 120.0;
   
   //debrisShapeName = "~/data/shapes/player/debris_player.dts";
   //debris = horseDebris;

   aiAvoidThis = true;

   minLookAngle = -1.5708;
   maxLookAngle = 1.5708;
   maxFreelookAngle = 3.0;

   mass = 90;
   drag = 0.1;
   density = 0.7;
   maxDamage = 250;
   maxEnergy =  10;
   repairRate = 0.33;

   rechargeRate = 0.4;

   runForce = 28 * 90;
   runEnergyDrain = 0;
   minRunEnergy = 0;
   maxForwardSpeed = 12;
   maxBackwardSpeed = 6;
   maxSideSpeed = 1;

   maxForwardCrouchSpeed = 12;
   maxBackwardCrouchSpeed = 6;
   maxSideCrouchSpeed = 1;

   maxForwardProneSpeed = 0;
   maxBackwardProneSpeed = 0;
   maxSideProneSpeed = 0;

   maxForwardWalkSpeed = 0;
   maxBackwardWalkSpeed = 0;
   maxSideWalkSpeed = 0;

   maxUnderwaterForwardSpeed = 8.4;
   maxUnderwaterBackwardSpeed = 7.8;
   maxUnderwaterSideSpeed = 7.8;

   jumpForce = 17 * 90; //8.3 * 90;
   jumpEnergyDrain = 0;
   minJumpEnergy = 0;
   jumpDelay = 0;

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

   minImpactSpeed = 250;
   speedDamageScale = 3.8;

   boundingBox         = vectorScale("2.5 2.5 2.4", 4);
   crouchBoundingBox   = vectorScale("2.5 2.5 2.4", 4);
   
   pickupRadius = 0.75;
   
   // Foot Prints
   //decalData   = HorseFootprint;
   //decalOffset = 0.25;
   
   jetEmitter = "";
   jetGroundEmitter = "";
   jetGroundDistance = 4;
 
   //footPuffEmitter = LightPuffEmitter;
   footPuffNumParts = 10;
   footPuffRadius = 0.25;

   //dustEmitter = LiftoffDustEmitter;

   splash = PlayerSplash;
   splashVelocity = 4.0;
   splashAngle = 67.0;
   splashFreqMod = 300.0;
   splashVelEpsilon = 0.60;
   bubbleEmitTime = 0.1;
   splashEmitter[0] = PlayerFoamDropletsEmitter;
   splashEmitter[1] = PlayerFoamEmitter;
   splashEmitter[2] = PlayerBubbleEmitter;
   mediumSplashSoundVelocity = 10.0;   
   hardSplashSoundVelocity = 20.0;   
   exitSplashSoundVelocity = 5.0;

   // Controls over slope of runnable/jumpable surfaces
   runSurfaceAngle  = 85;
   jumpSurfaceAngle = 86;

   minJumpSpeed = 20;
   maxJumpSpeed = 30;

   horizMaxSpeed = 68;
   horizResistSpeed = 33;
   horizResistFactor = 0.35;

   upMaxSpeed = 80;
   upResistSpeed = 25;
   upResistFactor = 0.3;
   
   footstepSplashHeight = 0.35;

   //NOTE:  some sounds commented out until wav's are available

   JumpSound         = HorseJumpSound;

   // Footstep Sounds
//   FootSoftSound        = HorseFootFallSound;
//   FootHardSound        = HorseFootFallSound;
//   FootMetalSound       = HorseFootFallSound;
//   FootSnowSound        = HorseFootFallSound;
//   FootShallowSound     = HorseFootFallSound;
//   FootWadingSound      = HorseFootFallSound;
//   FootUnderwaterSound  = HorseFootFallSound;
   //FootBubblesSound     = FootLightBubblesSound;
   //movingBubblesSound   = ArmorMoveBubblesSound;
   //waterBreathSound     = WaterBreathMaleSound;

   //impactSoftSound      = ImpactLightSoftSound;
   //impactHardSound      = ImpactLightHardSound;
   //impactMetalSound     = ImpactLightMetalSound;
   //impactSnowSound      = ImpactLightSnowSound;
   
   impactWaterEasy      = Splash1Sound;
   impactWaterMedium    = Splash1Sound;
   impactWaterHard      = Splash1Sound;
   
   groundImpactMinSpeed    = 10.0;
   groundImpactShakeFreq   = "4.0 4.0 4.0";
   groundImpactShakeAmp    = "1.0 1.0 1.0";
   groundImpactShakeDuration = 0.8;
   groundImpactShakeFalloff = 10.0;
   
   //exitingWater         = ExitingWaterLightSound;

   // Inventory Items
   maxItems   = 10;   //total number of bricks you can carry
   maxWeapons = 5;      //this will be controlled by mini-game code
   maxTools = 5;
   
   uiName = "Gunned Horse";
   rideable = true;
      lookUpLimit = 0.6;
      lookDownLimit = 0.2;

   canRide = false;
   showEnergyBar = false;
   paintable = true;

   brickImage = horseBrickImage;   //the imageData to use for brick deployment

   numMountPoints = 1;
   mountThread[0] = "root";
   mountNode[0] = 2;
};



function HorseArmor::onAdd(%this,%obj)
{
   // Vehicle timeout
   %obj.mountVehicle = true;

   // Default dynamic armor stats
   %obj.setRepairRate(0);

}

////////////////////
//Shooting scripts//
////////////////////

//ShootOnClick//

shootonclickswarmFighter=1;
   
shootonclickswarmFighter_Hold=1;
shootonclickswarmFighter_Shoo tDelay=70;
shootonclickswarmFighter_ReSh ootDelay=70;
shootonclickswarmFighter_Proj ectileCount=4;
shootonclickswarmFighter_Requ iredSlot=0;
shootonclickswarmFighter_Soun d=gunshot1Sound;

//Upper guns

shootonclickswarmFighter_Proj ectile[0]=swarmFighterProjectile;
shootonclickswarmFighter_Posi tion[0]="0.5 0.8 0";
shootonclickswarmFighter_Velo city[0]="200 0 0";
shootonclickswarmFighter_Scal e[0]="1 1 1";

shootonclickswarmFighter_Proj ectile[1]=swarmFighterProjectile;
shootonclickswarmFighter_Posi tion[1]="0.5 -0.8 0";
shootonclickswarmFighter_Velo city[1]="200 0 0";
shootonclickswarmFighter_Scal e[1]="1 1 1";

//Lower guns

shootonclickswarmFighter_Proj ectile[2]=swarmFighterProjectile;
shootonclickswarmFighter_Posi tion[2]="0.5 0.7 -0.1";
shootonclickswarmFighter_Velo city[2]="200 0 0";
shootonclickswarmFighter_Scal e[2]="1 1 1";

shootonclickswarmFighter_Proj ectile[3]=swarmFighterProjectile;
shootonclickswarmFighter_Posi tion[3]="0.5 -0.7 -0.1";
shootonclickswarmFighter_Velo city[3]="200 0 0";
shootonclickswarmFighter_Scal e[3]="1 1 1";
};

//called when the driver of a player-vehicle is unmounted
function HorseArmor::onDriverLeave(%obj, %player)
{
   //do nothing
}


I noticed that the horse is one of the few vehicles with only one .cs file, being the server.cs.

I just noticed the shooting script was outside of the main brackets (*Face Palm*). This meant that there was an odd bracket. Do you think that would cause the vehicle to not appear, or do you think it's something else?

I tried it today with it in the correct spot. Guess what? IT WORKED!!! Thanks to the only guy who was willing to post on this!