Blockland Forums > Modification Help

Making hats? (New feature idea)

Pages: << < (4/7) > >>

Demian:

How do you play multiple animations one after another? Like right hand shift away and root after that.

Mawpius:

You could do something like..

--- Code: ---%obj.schedule(0,"playthread",0,sit);
%obj.schedule(500,"playthread",1,activate2);
%obj.schedule(1000,"playthread",0,root);
--- End code ---


Demian:

Not my style but this situation calls for it: http://www.youtube.com/watch?v=P3ALwKeSEYs

Thank you for the fast help! I'll fiddle a bit more with the states and animation timings, but otherwise it is perfect.



Here's the script. The animation timings are off.

--- 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 = true;
colorShiftColor = "1 1 0.949 1";
};

datablock ShapeBaseImageData(IM_Skull)
{
shapeFile = "./skull.dts";
emap = true;
mountPoint = $HeadSlot;
offset = "0 0 0";
eyeOffset = "0 0 10 1";
rotation = eulerToMatrix("0 0 0");
scale = "1 1 1";
doColorShift = true;
colorShiftColor = "1 1 0.949 1";
};

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

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

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

mountPoint = 0;
offset = "0 0 0";
rotation = eulerToMatrix("0 0 0");
eyeOffset = "0 0 0 0";
eyeRotation = "0 0 0 0";
correctMuzzleVector = false;

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

stateName[0] = "Ready";
stateAllowImageChange[0] = true;
stateWaitForTimeout[0] = true;
stateTimeoutValue[0] = 0.1;
stateTransitionOnTriggerDown[0] = "Equip";

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

function IM_SkullHead::onFire(%this, %obj, %slot)
{
%client=%obj.client;
if(!%obj.HatWear)
{
%obj.HatWear = 1;

for(%i = 0;$hat[%i] !$= "";%i++)
{
%obj.hideNode($hat[%i]);
%obj.hideNode("headskin");
}
%obj.unMountImage(1);
%obj.mountimage(IM_Skull, 1);
%obj.unMountImage(0);
%obj.mountimage(IM_SkullHeadEmpty,0);
%obj.schedule(0,"playThread",1,shiftAway);
%obj.schedule(1000,"playThread",1,root);
//%obj.playThread(1, root);
}
}

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

shapeFile = "base/data/shapes/empty.dts";
Item = "IT_SkullHead";

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

mountPoint = 0;
offset = "0 0 0";
rotation = eulerToMatrix("0 0 0");
eyeOffset = "0 0 0 0";
eyeRotation = "0 0 0 0";
correctMuzzleVector = false;

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

stateName[0] = "Ready";
stateAllowImageChange[0] = true;
stateWaitForTimeout[0] = true;
stateTimeoutValue[0] = 0.1;
stateTransitionOnTriggerDown[0] = "Equip";

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

function IM_SkullHeadEmpty::onFire(%this, %obj, %slot)
{
%client=%obj.client;
if(%obj.HatWear)
{
%obj.HatWear = 0;

%obj.unMountImage(1);
%obj.unHideNode("headskin");
%obj.unMountImage(0);
%obj.mountimage(IM_SkullHead,0);
%obj.schedule(0,"playThread",1,shiftAway);
%obj.schedule(1000,"playThread",1,armreadyright);

%client.applyBodyParts();
%client.applyBodyColors();
}
}
--- End code ---


Mawpius:

I'm glad it worked out :p

Demian:

I would really like to release the finished script as a resource for others who would fancy making a hat of their own. This is why I need to make sure the script works perfectly without bugs. Here's the template hat add-on.

http://mirror.dataorb.net/Item_HatItem.zip

I'll finish the work on animations later. Now, there's a bug. I equip the hat, close inventory, open inventory and select the hat again. This causes another hat to appear in my hand making it impossible to remove the already equipped hat. I do not know how to fix this. Help please.

Pages: << < (4/7) > >>

Go to full version