Author Topic: How do i make models for blockland?  (Read 1669 times)

Hello,i would like to start to model to make addons,i already know the basic of modeling and animating,but where do i start? I fear to make something too big or too small,i already use 3ds Max 2016,so dont even think of telling me to change to milkshape or blender,i dont want to scrap my knowledge with 3ds Max,so can someone Tell me how?

You'll have to at least export the model as something that Blender can read and then use Blender to export the model as a dts.

Or export to .3ds, import that into ms3d and then export as .dts. If you're interested in coding them as well, start with a sword as it's probably the easiest to understand code-wise. I'll do a quick run-down of how I learned. It took me a while to find a decent process of making things, so hopefully this helps you.

Since I advised on making a sword, open weapon_swords .cs file with notepad and look into that. Datablocks are what the game uses to define objects. You should start by finding and studying ItemData (the thing you pick up in game) and ShapeBaseImageData (the thing you hold in your hand / use). Link those two datablocks together, make sure you link correctly to the .dts file in the datablocks, and you should have something that you can hold in your players hand. From there, learn about projectiles and explosions if you're interested in making weapons, items, tools or player emotes. Once you're comfortable with that then learn about particle and emitter datablocks. Keep it simple to start with and only mess with the obvious ones, using another weapons as a base to work from. Essentially, emitters are the object that fire out particles, and particles define what the particles look like and how they behave. Sound datablocks are pretty easy after that too.

This isn't the way weapons are written out but it's a good way to make them, just format it the same (work from the bottom up). Custom functions at the end are usually tied to the
Code: [Select]
stateScript[#] = ""; lines, with player animations (arm swing in swords example) or item usage being the most popular functions to tie in with the states. So function weaponImage::onFire would be tied to stateScript[3] = "onFire"; as an example off the top of my head

Hope this helped!
« Last Edit: September 23, 2015, 06:36:18 PM by Jervan »

When you say studying ItemData and ShapeBaseImageData,you mean i need to study those so i can make  a model that fits the player hands? right?

Not so that you can make the model, you have to use a modeling program for that. But if you mean so you can make it exist in-game, yes. ShapeBaseImageData is the Datablock that belongs in the players hand. You can't scale the model so you'd need to make it the right scale using your modeling program (that's what I do first) but after that you can offset and rotate it using the numbers in the datablock. You need the ItemData to be able to spawn it on a brick and put it in your inventory when you walk over it (to be able to get it in your hand in the first place).

I added some extra comments on those 2 datablocks to help you understand the relevant line by line of what it's doing

Code: [Select]
//////////
// item //
//////////
datablock ItemData(swordItem)
{
category = "Weapon";  // Mission editor category
className = "Weapon"; // For inventory system

// Basic Item Properties
shapeFile = "./sword.dts";
mass = 1;
density = 0.2;
elasticity = 0.2;
friction = 0.6;
emap = true;

//gui stuff
uiName = "Sword"; //this is what it will be called in the wrench box and inventory
iconName = "./icon_sword"; //this is an icon image file for the inventory
doColorShift = true; //same as shapebaseimagedata, check the comment there
colorShiftColor = "0.471 0.471 0.471 1.000";

// Dynamic properties defined by the scripts
image = swordImage; //this is tying to shapebaseimagedata
canDrop = true; //whether you can throw it away or not using ctrl W
};

////////////////
//weapon image//
////////////////
datablock ShapeBaseImageData(swordImage)
{
   // Basic Item properties
   shapeFile = "./sword.dts"; //the model that will be used
   emap = true; //no idea

   // Specify mount point & offset for 3rd person, and eye offset
   // for first person rendering.
   mountPoint = 0; //0  is the right hand
   offset = "0 0 0"; //offset changes where the center of the model is in relation to the mount point

   // 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 = false;

   eyeOffset = "0.7 1.2 -0.25"; //where abouts on your screen you see the item in 1st person. dont use this if you want it to just be where it naturally is

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

   // Projectile && Ammo.
   item = swordItem; // this links to the ItemData datablock
   ammo = " ";
   projectile = swordProjectile; //this is the projectile that will be fired when statefire is true in an image state
   projectileType = Projectile; //the projectile is a projectile I guess..

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

   //casing = " ";
   doColorShift = true; //if you have any alpha textures on the model you can tint or colour them here
   colorShiftColor = "0.471 0.471 0.471 1.000";

   // 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]             = 0.5;
stateTransitionOnTimeout[0]      = "Ready";
stateSound[0]                    = swordDrawSound; //when it is activated, the sword draw sound is played, then it takes half a second to be ready

stateName[1]                     = "Ready";
stateTransitionOnTriggerDown[1]  = "PreFire"; //now it is ready, when the mouse is clicked ("transition on trigger down") it goes to prefire.
stateAllowImageChange[1]         = true; //this line means you can change the weapon / tool you're wielding to something else while the weapon is in this state

stateName[2] = "PreFire";
stateScript[2]                  = "onPreFire"; //ties to the function swordImage::onPrefire
stateAllowImageChange[2]        = false; //you can no longer change what you're wielding until this state is finished
stateTimeoutValue[2]            = 0.1;
stateTransitionOnTimeout[2]     = "Fire"; //in 1 tenth of a second it goes to the "fire" state

stateName[3]                    = "Fire";
stateTransitionOnTimeout[3]     = "CheckFire";
stateTimeoutValue[3]            = 0.2; //in a fifth of a second it goes to checkfire
stateFire[3]                    = true; //it shoots a projectile in this state
stateAllowImageChange[3]        = false; //you still can't change weapons in this state
stateSequence[3]                = "Fire"; //the sword animates since in first person it wouldn't move since the eyeOffset was changed to a custom value
stateScript[3]                  = "onFire"; //ties to function swordImage::onFire
stateWaitForTimeout[3] = true; //the timeout can't be circumvented

stateName[4] = "CheckFire";
stateTransitionOnTriggerUp[4] = "StopFire"; //if they have let go of the left mouse button, it stops swinging
stateTransitionOnTriggerDown[4] = "Fire";  //if they still have the mouse button down then it keeps swinging

stateName[5]                    = "StopFire";
stateTransitionOnTimeout[5]     = "Ready";
stateTimeoutValue[5]            = 0.2;
stateAllowImageChange[5]        = false;
stateWaitForTimeout[5] = true;
stateSequence[5]                = "StopFire"; //stop swinging animation
stateScript[5]                  = "onStopFire"; //links to swordImage::onStopFire

};

function swordImage::onPreFire(%this, %obj, %slot)
{
%obj.playthread(2, armattack); //animates the players arm up and down
}

function swordImage::onStopFire(%this, %obj, %slot)
{
%obj.playthread(2, root); //resets the players arm
}
Important to note that when messing about with image states, always check the bracketed numbers if there's a problem. Couldn't tell you how many times I've pasted a line and not changed the number

Or export to .3ds, import that into ms3d and then export as .dts. If you're interested in coding them as well, start with a sword as it's probably the easiest to understand code-wise
erm, I found bricks made with DTS objects easiest to understand.

Code: [Select]
datablock StaticShapeData(AnvilShape) //Name of your model datablock.
{
shapefile="./shapes/anvil.dts"; //Points to your model.
};

datablock fxDtsBrickData(AnvilBrickData) //Datablock of your brick.
{
category="RPG"; //Category. Can be anything you want. This is the tab in the brick menu.
subCategory="Functional"; //Subcat in the tab mentioned in category.
uiName="Anvil"; //Name you'll see under the icon.
iconName = "./icons/unknown"; //Icon shown in the brick menu.

brickSizeX=2; //X size of your brick.
brickSizeY=5; //Y size of your brick.
brickSizeZ=6; //Z size of your brick.

//Is a prop!
isProp=1; //To avoid making the model mounting code ourselves, we're going to use System_Propsys. This varible tells the prop system that it's a prop and has a model to mount.

//Brick
brickRender=0; //If we render the brick, we will see the model inside of the blb brick. We have to disable it.
brickCollide=1;
brickRaycast=1;


spawnModel=AnvilShape; //Name of your model.
modelOffset="-0.3 0 0"; //Offset it so it's in place where you want it.
modelScale="2 2 2"; //Scale it to the size you want.

colorCount=1; //I am unsure about this but it gave me a syntax error if it wasn't here.

colorGroup[0]="ALL";
colorMode[0]="Intensity"; //Modifies the color of the model if you didn't give it a texture.
colorShift[0]="1 1 1 1"; //Modifies the color of the model if you didn't give it a texture.
};

erm, I found bricks made with DTS objects easiest to understand.

Code: [Select]
datablock StaticShapeData(AnvilShape) //Name of your model datablock.
{
shapefile="./shapes/anvil.dts"; //Points to your model.
};

datablock fxDtsBrickData(AnvilBrickData) //Datablock of your brick.
{
category="RPG"; //Category. Can be anything you want. This is the tab in the brick menu.
subCategory="Functional"; //Subcat in the tab mentioned in category.
uiName="Anvil"; //Name you'll see under the icon.
iconName = "./icons/unknown"; //Icon shown in the brick menu.

brickSizeX=2; //X size of your brick.
brickSizeY=5; //Y size of your brick.
brickSizeZ=6; //Z size of your brick.

//Is a prop!
isProp=1; //To avoid making the model mounting code ourselves, we're going to use System_Propsys. This varible tells the prop system that it's a prop and has a model to mount.

//Brick
brickRender=0; //If we render the brick, we will see the model inside of the blb brick. We have to disable it.
brickCollide=1;
brickRaycast=1;


spawnModel=AnvilShape; //Name of your model.
modelOffset="-0.3 0 0"; //Offset it so it's in place where you want it.
modelScale="2 2 2"; //Scale it to the size you want.

colorCount=1; //I am unsure about this but it gave me a syntax error if it wasn't here.

colorGroup[0]="ALL";
colorMode[0]="Intensity"; //Modifies the color of the model if you didn't give it a texture.
colorShift[0]="1 1 1 1"; //Modifies the color of the model if you didn't give it a texture.
};
different strokes for different folks yo

If you are using 3dsmax, then there should be a dts exporter for it. It's on the main site among the downloads.