Blockland Forums > Modification Help

Making hats? (New feature idea)

Pages: (1/7) > >>

Demian:

How would I make a hat of my own without using those hat mods?

Swollow:

-Create a model
-Create a script
  
--- Code: ---datablock ShapeBaseImageData(HatImage)
{
shapeFile = "./Hat.dts";
emap = true;
mountPoint = $HeadSlot;
offset = "0 -0.05 0.1";
eyeOffset = "0 0 10 1";
rotation = eulerToMatrix("0 0 0");
scale = "1 1 1";
doColorShift = false;
//colorShiftColor = "0.392 0.196 0.0 1.000";
};

function servercmdHat(%client)
{
  if(isObject(%client.player))
  {
   %client.player.hideNode($hat[%i]);
   %client.player.mountimage(Hatimage, 1);
  }
}

--- End code ---
something along the lines of this I'm not exactly sure if it works though
Hope I helped also on a side note its fun to add emmiters to the hat image so you can have flaming hats

Demian:

Commands are gay. I want it to be a regular item in your inv that you activate to wear and take off.

Mawpius:


--- Quote from: Demian on October 09, 2011, 04:04:22 PM ---Commands are gay. I want it to be a regular item in your inv that you activate to wear and take off.

--- End quote ---
You could probably just make a weapon, and use image::onFire to toggle the hat.

Swollow:


--- Code: ---datablock ItemData(HatItem)
{
category = "Item";  // Mission editor category

equipment = true;

//its already a member of item namespace so dont break it
//className = "Item"; // For inventory system

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

//gui stuff
uiName = "Demian's Hat";
iconName = "./HatIcon";
doColorShift = false;
//colorShiftColor = "0.200 0.200 0.200 1.000";

// Dynamic properties defined by the scripts
image = HatImage;
canDrop = true;
};

//Images
datablock ShapeBaseImageData(HatImage)
{
shapeFile = "./Hat.dts";
emap = true;
mountPoint = $HeadSlot;
offset = "0 -0.05 0.1";
eyeOffset = "0 0 10 1";
rotation = eulerToMatrix("0 0 0");
scale = "1 1 1";
doColorShift = false;
//colorShiftColor = "0.392 0.196 0.0 1.000";
};
datablock ShapeBaseImageData(HatImage)
{
   // Basic Item properties
   shapeFile = "base/data/shapes/empty.dts";
   emap = true;

   // Specify mount point & offset for 3rd person, and eye offset
   // for first person rendering.
   mountPoint = 0;
   offset = "0.13 0.2 -0.8";
   rotation = eulerToMatrix("0 0 0");
   eyeOffset = "0.13 0.2 -0.8";
   eyeRotation = 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 = false;

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

   // Projectile && Ammo.
   item =HatItem;

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

   doColorShift = true;
   colorShiftColor = HatItem.colorShiftColor; //"0.200 0.200 0.200 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";


stateName[1]                     = "Ready";
stateTransitionOnTriggerDown[1]  = "Fire";
stateAllowImageChange[1]         = true;


stateName[2]                    = "Fire";
stateTransitionOnTriggerUp[2] = "Ready";
stateScript[2]                  = "onFire";
stateSound[2]       = "HatEquipsound";
};

function HatImage::onFire(%this, %obj, %slot)
{
%client=%obj.client;
if(!%obj.Hatison)
{
%obj.Hatison = 1;
%client.centerPrint("\c6You put on the hat.",3);

for(%i = 0;$hat[%i] !$= "";%i++)
{
%obj.hideNode($hat[%i]);
}
%obj.unmountimage(1);
%obj.mountimage(Hatimage, 1);
serverPlay3d(HatEquipSound,%pos);
}else{
%obj.Hatison = 0;
%client.centerPrint("\c6You took off the hat.",3);

%obj.unmountimage(1);

%client.applyBodyParts();
%client.applyBodyColors();
serverPlay3d(HatUnequipSound,%pos);
}
}
--- End code ---
Hopefully this should work but i haven't tested it sorry that you didn't want commands


Pages: (1/7) > >>

Go to full version