Blockland Forums > Modification Help
Making hats? (New feature idea)
<< < (2/7) > >>
Demian:
Does the model needs some special armatures and/or empties apart from the usual Shape and Detail32. Also how would I hide the player's head node when the hat is equipped?

By the way, two image datablocks with the same name? The script doesn't work.

Wait, I get this error: Error: cannot change namespace parent linkage for Item from ShapeBase to ItemData.


--- Code: ---datablock ItemData(IT_SkullHead)
{
category = "Item";
className = "Item";

shapeFile = "./skull.dts";
image = "IM_SkullHead";
rotate = false;
emap = true;

uiName = "Skull Head";
iconName = "Add-Ons/Weapon_Gun/icon_gun";
canDrop = true;

mass = 1;
drag = 0.1;
density = 0.1;
friction = 0.5;
elasticity = 0.1;

sticky = 0;
gravityMod = 1;
maxVelocity = -1;
dynamicType = 0;

doColorShift = false;
colorShiftColor = "0 0 0 0";
};

datablock ShapeBaseImageData(IM_SkullHead)
{
className = "ItemImage";

shapeFile = "./skull.dts";
Item = "IT_SkullHead";

emap = true;
firstPersonParticles = true;
armReady = false;
melee = false;

mountPoint = $HeadSlot;
offset = "0 -0.05 0.1";
rotation = eulerToMatrix("0 0 0");
eyeOffset = "0 0 10 1";
eyeRotation = "0 0 0 0";
correctMuzzleVector = false;

doColorShift = false;
colorShiftColor = "0 0 0 0";

stateName[0] = "Activate";
stateWaitForTimeout[2] = false;
stateTimeoutValue[0] = 0.1;
stateTransitionOnTimeout[0] = "Ready";

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

stateName[2]   = "Equip";
stateScript[2]   = "onFire";
stateTransitionOnTriggerUp[1] = "Ready";
};


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

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

%obj.unmountimage(1);

%client.applyBodyParts();
%client.applyBodyColors();
}
}
--- End code ---
ChappersTeddy:
I'd like to see some player-made default hats for once. Can someone please help Demian with this.
Demian:

--- Quote from: ChappersTeddy on October 10, 2011, 11:52:48 AM ---I'd like to see some player-made default hats for once. Can someone please help Demian with this.

--- End quote ---
Does not compute
Mawpius:
TBH I'm not too sure about that error, but it should work if you change the mountpoint to 0 instead of $Headslot (you can't activate an item from your head).
Also, some of your state numbers are wrong.
Demian:
Okay a lot better now. It displays the messages and the model is visible but the hat mounts my right hand. It is visible after the inventory is closed or another item is selected so that works too.

What is the mount point for the head? How do I hide the player's head node when the hat is equipped?
Navigation
Message Index
Next page
Previous page

Go to full version